Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Infinite loop on connection lost #1103

Closed
pasis opened this issue May 31, 2019 · 0 comments
Closed

Infinite loop on connection lost #1103

pasis opened this issue May 31, 2019 · 0 comments
Labels
Milestone

Comments

@pasis
Copy link
Member

pasis commented May 31, 2019

When my laptop wakes up from sleep, Profanity can hang on trying to disconnect after connection is already lost.

Backtrace:

(gdb) bt
#0  0x00007fa61bf7f198 in nanosleep () from /lib64/libc.so.6
#1  0x00007fa61bfac2c4 in usleep () from /lib64/libc.so.6
#2  0x00007fa61ebff549 in xmpp_run_once (ctx=0x556634d82290, timeout=10) at src/event.c:214
#3  0x00005566340e3a7d in connection_disconnect () at src/xmpp/connection.c:203
#4  0x00005566340e2c83 in session_disconnect () at src/xmpp/session.c:231
#5  0x00005566340f2ade in ev_disconnect_cleanup () at src/event/common.c:54
#6  0x00005566340f2d5b in sv_ev_lost_connection () at src/event/server_events.c:215
#7  0x00005566340e2fb9 in session_lost_connection () at src/xmpp/session.c:362
#8  0x00005566340e3693 in _connection_handler (xmpp_conn=<optimized out>, status=<optimized out>, error=<optimized out>, stream_error=<optimized out>,
    userdata=<optimized out>) at src/xmpp/connection.c:498
#9  0x00007fa61ebff4e0 in xmpp_run_once (ctx=0x556634d82290, timeout=10) at src/event.c:273
#10 0x00005566340ddfd5 in prof_run (log_level=<optimized out>, account_name=<optimized out>) at src/profanity.c:127
#11 0x00005566340da79f in main (argc=<optimized out>, argv=<optimized out>) at src/main.c:170

Logs:

30/05/2019 22:57:05: prof: DBG: Autoping: Sending ping request: prof_ping_7b5c20e6-cce7-4569-923a-4fdef354ab58
30/05/2019 22:57:05: conn: DBG: SENT: <iq id="prof_ping_7b5c20e6-cce7-4569-923a-4fdef354ab58" type="get"><ping xmlns="urn:xmpp:ping"/></iq>
30/05/2019 22:57:06: tls: DBG: error=5 errno=104
30/05/2019 22:57:06: xmpp: DBG: Unrecoverable TLS error, 5.
30/05/2019 22:57:06: xmpp: DBG: Closing socket.
30/05/2019 22:57:06: tls: DBG: error=5 errno=32
30/05/2019 22:57:06: prof: DBG: Connection handler: XMPP_CONN_DISCONNECT
30/05/2019 22:57:06: prof: DBG: Connection handler: Lost connection for unknown reason
30/05/2019 22:57:06: prof: INF: Closing connection

So, as we can see, libstrophe closes socket and fires connection handler with XMPP_CONN_DISCONNECT. It is not connected anymore. But Profanity calls xmpp_disconnect() and runs xmpp_run_once() in a loop. Profanity waits for some event that is not occurs (need to check the code to find it out).

It is just a guess, but maybe closing connection after XMPP_CONN_DISCONNECT is the root cause and should be done at all.

@pasis pasis added the bug label May 31, 2019
@jubalh jubalh added this to the 0.7.0 milestone May 31, 2019
@jubalh jubalh closed this as completed in c2d3c3e Jun 3, 2019
jubalh added a commit that referenced this issue Jun 3, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants