[ejabberd] Exmpp bot with gen_server connect_TCP problem

CGS cgsmcmlxxv at gmail.com
Wed Nov 2 16:43:26 MSK 2011

The main difference is that in proc_lib:spawn(...) the errors are not 
handled (the thread just silently dies), while in gen_server the errors 
are handled through handle_info and terminate. If you manage to handle 
all the situations, gen_server doesn't crash, but exits in the worst 
case. The echo example doesn't handle all the cases (for example, I 
found some message loop back - the same message returned to the sender - 
which usually crashes that example), so, the server just crashes because 
it doesn't know how to handle the information (the most accurate words 
would be it doesn't match the received information with any match 
pattern). That's why the gen_server crashes reporting an error, while 
spawned threads do not report the crash (nobody asks them to report).


On 11/02/2011 01:34 PM, Alexander Kuleshov wrote:
> 2011/11/2 CGS <cgsmcmlxxv at gmail.com <mailto:cgsmcmlxxv at gmail.com>>
>     An Ejabberd module is a part of the server-side XMPP. EXMPP is the
>     client-side XMPP. What you are trying is to embed client-side into
>     server-side which is meaningless because you try to connect to the
>     server from within. For handling the packets, use the server
>     handlers. For sending/receiving packets to/for an user, use
>     client-side XMPP.
>     Now, depending what you need, there are some options from which I
>     can guess few which may help you:
>     1. Server-application communication: see external services, for
>     example.
>     2. User packet redirection: see Ejabberd handlers.
>     3. Server-server communication: see s2s module, for example.
>     But, since I have no knowledge about what you need, there may be
>     other options which fit better your project.
>     Cheers,
>     CGS
> Hello, thank you for reply.
> I have ejabberd module which will start with ejabberd, and i need to 
> run xmpp bot from this module. If i run it wihtout gen_server, only 
> spawn/loop/receive it's ok, but when i try to run my bot with 
> gen_server i got this crash reports.
> Why?
> _______________________________________________
> ejabberd mailing list
> ejabberd at jabber.ru
> http://lists.jabber.ru/mailman/listinfo/ejabberd

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.jabber.ru/pipermail/ejabberd/attachments/20111102/f6581fe7/attachment.html>

More information about the ejabberd mailing list