hannesm / jackline

minimalistic secure XMPP client in OCaml
BSD 2-Clause "Simplified" License
251 stars 20 forks source link

State confusion on connection loss #105

Closed andreasdotorg closed 8 years ago

andreasdotorg commented 8 years ago

21:37:02 * TLS session info * (TLS_1_0 TLS_DHE_RSA_WITH_AES_256_CBC_SHA) 21:38:35 * async error * Unix.Unix_error(Unix.EBADF, "check_descriptor", "") 21:38:35 * async error * Invalid_argument("ping timeout") 21:39:05 * session error * Invalid_argument("could not resolve hostname jabber.berlin.ccc.de") 21:41:55 * connecting * to jabber.berlin.ccc.de (213.73.91.34 on port 5222) 09:38:19 * error * already connected ─6d─< andreas@jabber.berlin.ccc.de/ocaml >────────────────────────────────────────────────────────────────────────────────────────────────────────────────────[ offline ]─

After losing the session, some part of jackline thinks I'm still connected and gives me the "already connected" error message, even though I am clearly offline.

hannesm commented 8 years ago

did netstat -an | grep 213.73.91.34 show some dangling connection in CONNECTED state? I saw this once, and there the TCP layer was established, but not the XMPP layer (including STARTTLS).... so, resource cleanups should be done more fine-grained, and session should only be there once authentication finished...

andreasdotorg commented 8 years ago

Didn't check...

hannesm commented 8 years ago

this is still an issue -- I recently saw a deadlock where multiple syns have been sent to the server... also likely to break if TCP layer gets negotiated, but not more (reason is that main loop puts on /connect sth into connect mbox, which loop does wait for connection establishment)... need some simplifications..

hannesm commented 8 years ago

actual fix for this might have been 2a4e18c0c352113ef3db2c22f2afb3b6417a54aa ... there was a stretch of guarding close, avoid fd leak, and get rid of deadlock...