Client gets disconnected unexpectedly

I just within the last hour finally got ejabberd running after using jabberd2 for a few weeks. It seems that all jabber is moving the ejabberd route and that was the motivation for me doing so.

I have tried it in the past but each time it failed miserably and eventually I gave up, untill tonight.

I was so pleased when I was able to log into the web interface and see that it was actually up and running. Even getting authentication working with mysql was a breeze. At least I think it's working. I couldn't log into the web front end untill I added the admin username and password to the mysql database.

But on to my issue...

Any help would be appreaciated because I have no idea what any of this log info means.

 

From: ejabberd.log

=INFO REPORT==== 2006-11-22 02:48:18 ===
I(<0.206.0>:ejabberd_listener:90): (#Port<0.332>) Accepted connection {{xx,xx,xxx,xxx},49108} -> {{xx,xxx,xx,xxx},5222}

=ERROR REPORT==== 2006-11-22 02:48:18 ===
** Generic server <0.310.0> terminating
** Last message in was {tcp,#Port<0.332>,
                            <<60,63,120,109,108,32,118,101,114,115,105,111,110,61,34,49,46,
48,34,63,62,10,60,115,116,114,101,97,109,58,115,116,114,101,97,109,32,120,109,108,110,115,
58,115,116,114,101,97,109,61,34,104,116,116,112,58,47,47,101,116,104,101,114,120,46,106,97,
98,98,101,114,46,111,114,103,47,115,116,114,101,97,109,115,34,32,120,109,108,110,115,61,34,
106,97,98,98,101,114,58,99,108,105,101,110,116,34,32,116,111,61,34,105,109,46,100,97,114,107,
108,105,103,104,116,46,99,111,46,122,97,34,32,62,10>>}
** When Server state == {state,#Port<0.332>,
                               gen_tcp,
                               none,
                               <0.309.0>,
                               65536,
                               {xml_stream_state,
                                   <0.309.0>,
                                   #Port<0.333>,
                                   [],
                                   0,
                                   65536},
                               infinity}
** Reason for termination ==
** {badarg,[{erlang,port_close,[#Port<0.333>]},
            {xml_stream,close,1},
            {ejabberd_receiver,terminate,2},
            {gen_server,terminate,6},
            {proc_lib,init_p,5}]}

 

From: messages

Nov 22 02:59:54 hostname grsec: From xx.xx.xxx.xxx: exec of /opt/ejabberd-1.1.2/bin/child_setup (   -    ) 
by /opt/ejabberd-1.1.2/bin/beam[beam:19234] uid/euid:0/0 gid/egid:0/0, parent 
/opt/ejabberd-1.1.2/bin/beam[beam:18778] uid/euid:0/0 gid/egid:0/0

Nov 22 02:59:54 hostname grsec: From xx.xx.xxx.xxx: exec of /bin/bash ( exec expat_erl ) by 
/opt/ejabberd-1.1.2/bin/child_setup[child_setup:19234] uid/euid:0/0 gid/egid:0/0, parent 
/opt/ejabberd-1.1.2/bin/beam[beam:18778] uid/euid:0/0 gid/egid:0/0

Environment

Linux gentoo 2.6.17-hardened-r1 #5 SMP Wed Nov 1 02:30:44 SAST 2006 x86_64
AMD Athlon(tm) 64 X2 Dual Core Processor 4200+ AuthenticAMD GNU/Linux

Try with and without STARTTLS

To find where is the problem, and for what reason, try connecting with other options: STARTTLS, old SSL or just plain. You may need to try with different clients.

more than unhappy.

Triend with TLS, SSL, just plain old unencrypted.
Tried gaim, psi, and even jabbin ...

None of them worked.
I then thought it might be related to the hardened kernel so I tried to run it on my home PC. Also Gentoo amd64 but running a standard kernel. Exactly the same issue.

It's amazing how people carry on about ejabberd being so easy to install.
This evening must be about the 20th time I've tried to install it and not once have I managed to get it to work.

Have the ejabberd developers ever tried installing wildfire or jabberd2? Because both of those are a piece of piss to install, but ejabberd?

Maybe it's a 64bit gentoo thing? No wait, I tried installing it onto a windows box once too...

Honestly, it boggles my mind that other people manage to get this installed and working.

Issues on Gentoo

_AA_ wrote:

I then thought it might be related to the hardened kernel so I tried to run it on my home PC. Also Gentoo amd64 but running a standard kernel. Exactly the same issue.

Did you tried to connect using telnet? Can you test on another distribution? Can you test on another architecture? Can you test with another Erlang version?

_AA_ wrote:

It's amazing how people carry on about ejabberd being so easy to install.
This evening must be about the 20th time I've tried to install it and not once have I managed to get it to work.

ejabberd is easy to install; you are just experiencing:

  • a configuration problem (ejabberd, clients, DNS, firewall...),
  • a Gentoo-related problem,
  • a AMD64-related problem,
  • an unknown bug in ejabberd or Erlang.
_AA_ wrote:

Maybe it's a 64bit gentoo thing? No wait, I tried installing it onto a windows box once too...

...and did that worked? If that did also not worked I guess it is a configuration problem because ejabberd is known to run on Windows, and Windows installations are normally very similar...

_AA_ wrote:

Honestly, it boggles my mind that other people manage to get this installed and working.

The only thing I had to do, was "portinstall erlang-lite && portinstall ejabberd", and editing a few things in the configuration file (domain name for example)...IMO that's not hard.

--
sander

Gentoo

it's definately specific to your setup. either the hardened, 64bit or amd.

i have ejabberd running since 0.7.5 version on two of my Gentoo machines without issue.

i notice that your ejabberd is in /opt, it doesn't look like you used the Gentoo ebuilds to install. (maybe they don't support your architecture... i only have experience with the x86 builds).

but the second of my installs is not via the ebuild, i just downloaded and configed and make installed the erlang and ejabberd packages the old fashioned way and still had no problems.

which version of erlang are you using? from the log messages it looks like something is trying to start an external process 'exec expat_erl'. on my system there is no expat_erl program, only an expat_erl.so shared library.

i would guess that there's something a bit weird in the expat XML library on your system that is causing different things to happen than on my system.

FWIW, my system:

Linux gir 2.6.17-gentoo-r8 #1 SMP PREEMPT Thu Sep 21 12:02:28 PDT 2006 i686 Intel(R) Pentium(R) 4 CPU 3.20GHz GenuineIntel GNU/Linux

# emerge -pv ejabberd
...
Calculating dependencies... done!
[ebuild R ] net-im/ejabberd-1.1.2-r1 USE="ldap mod_muc mod_pubsub ssl web -mod_irc -odbc" 0 kB

Poof. I just rebooted my

Poof. I just rebooted my jabber server due to kernel upgrade, and suddenly I found myself with exactly the same problem you describe. I am also running hardened gentoo, so I thought at first it might be related, but it is not, it is much simpler. Gentoo recently bumped erlang version in stable x86, so I just re-emerged ejabberd using new erlang and everything works perfectly. Maybe emerging ejabberd again might help you too.

or check /etc/init.d/ejabberd

I had this happen also. I had to restart the server after running out of disk space and it refused to come back up. I just made a little change to /etc/init.d/ejabberd:

< --exec /usr/lib/erlang/erts-5.5/bin/beam \
> --exec /usr/lib/erlang/erts-5.5.1/bin/beam \

And it started right up.

Problem behind a problem

The message above is mostly irrelevant. If I understand correctly, something has made the expat process die, so the connection must be terminated with an appropriate error message. However, during the termination a function tries to close the expat port, which of course fails (since it is already closed), so the interesting error message has no chance of being printed. (I could be entirely wrong, of course)

So try this patch. It won't make it work better, but you'll get a better error message.

--- orig/src/xml_stream.erl
+++ mod/src/xml_stream.erl
@@ -110,7 +110,7 @@
     State#xml_stream_state{stack = NewStack, size = NewSize}.
 
 close(#xml_stream_state{port = Port}) ->
-    port_close(Port).
+    catch port_close(Port).
 
 
 parse_element(Str) ->
Syndicate content