Android IRC clients get disconnected silently #554

Closed
opened 2026-10-05 04:29:27 +02:00 by adam · 14 comments
Owner

When connecting to znc from an android client(Andchat/Holoirc), after 8-10 minutes of the phone being locked I notice that I can't receive or send any messages, but the client shows that I'm still connected to znc.

I once check the list of connected clients(listclients and listsockets) from my desktop when this happened and only the desktop client appeared connected.

Note that before I started using znc I used the RizonBNC that disconnected me every 20-30 minutes while I was using IRC from android, difference was that the client was aware that the connection was closed.

--- Want to back this issue? **[Post a bounty on it!](https://www.bountysource.com/issues/25854893-android-irc-clients-get-disconnected-silently?utm_campaign=plugin&utm_content=tracker%2F1759&utm_medium=issues&utm_source=github)** We accept bounties via [Bountysource](https://www.bountysource.com/?utm_campaign=plugin&utm_content=tracker%2F1759&utm_medium=issues&utm_source=github).
When connecting to znc from an android client(Andchat/Holoirc), after 8-10 minutes of the phone being locked I notice that I can't receive or send any messages, but the client shows that I'm still connected to znc. I once check the list of connected clients(listclients and listsockets) from my desktop when this happened and only the desktop client appeared connected. Note that before I started using znc I used the RizonBNC that disconnected me every 20-30 minutes while I was using IRC from android, difference was that the client was aware that the connection was closed. ## <bountysource-plugin> --- Want to back this issue? **[Post a bounty on it!](https://www.bountysource.com/issues/25854893-android-irc-clients-get-disconnected-silently?utm_campaign=plugin&utm_content=tracker%2F1759&utm_medium=issues&utm_source=github)** We accept bounties via [Bountysource](https://www.bountysource.com/?utm_campaign=plugin&utm_content=tracker%2F1759&utm_medium=issues&utm_source=github). </bountysource-plugin> <!-- github-sync-id:101398778 -->
adam closed this issue 2026-10-05 04:29:27 +02:00
Author
Owner

Phone being locked makes it sound like client issue. Does your phone happen to disable network connections when the screen is locked?

Also which version of ZNC are you using, /msg *status version?

Phone being locked makes it sound like client issue. Does your phone happen to disable network connections when the screen is locked? Also which version of ZNC are you using, `/msg *status version`? <!-- github-comment-id:131791263 -->
Author
Owner

@Mikaela ZNC 1.2
I have wifi always on during sleep and wifi optimization on. Turning wifi optimization off didn't resolve the problem.

@Mikaela ZNC 1.2 I have wifi always on during sleep and wifi optimization on. Turning wifi optimization off didn't resolve the problem. <!-- github-comment-id:131794518 -->
Author
Owner

@bno1 you should upgrade to 1.6.1 and see if this happens with it. 1.2 is 2 years old and had security issue which is why 1.4 was released. 1.4 again isn't validating SSL certificates and is affected by POODLE, FREAK etc.

@bno1 you should upgrade to 1.6.1 and see if this happens with it. 1.2 is 2 years old and had security issue which is why 1.4 was released. 1.4 again isn't validating SSL certificates and is affected by POODLE, FREAK etc. <!-- github-comment-id:131796752 -->
Author
Owner

@Mikaela I updated and the issue persists

@Mikaela I updated and the issue persists <!-- github-comment-id:132160164 -->
Author
Owner

Then it`s something with your device / irc client.

Then it`s something with your device / irc client. <!-- github-comment-id:132171446 -->
Author
Owner

"znc -D" can help you to see what's going on and why/how client disconnects.

2015-08-18 11:57 GMT+01:00 Edža notifications@github.com:

Then it`s something with your device / irc client.

—
Reply to this email directly or view it on GitHub
https://github.com/znc/znc/issues/1032#issuecomment-132171446.

"znc -D" can help you to see what's going on and why/how client disconnects. 2015-08-18 11:57 GMT+01:00 Edža notifications@github.com: > Then it`s something with your device / irc client. > > — > Reply to this email directly or view it on GitHub > https://github.com/znc/znc/issues/1032#issuecomment-132171446. <!-- github-comment-id:132173324 -->
Author
Owner

I did 2 tests with the debug option:

  1. While the phone was locked on smart power saving profile(the default I use)

  2. While the phone was charging and unlocked through the whole test on normal power saving profile
    The client is AndChat 1.4.3.2

  3. Result: after locking the phone the client doesn't send nor respond to pings. The client doesn't detect the closed connection.

    // `/ping start` then locked the phone 
    [2015-08-18 16:19:38.967690] (MY_NICK/Rizon) CLI -> ZNC [PING start]
    [2015-08-18 16:19:38.967766] (MY_NICK/Rizon) ZNC -> CLI [:irc.znc.in PONG irc.znc.in start]
    [2015-08-18 16:19:38.967821] (MY_NICK/Rizon) ZNC -> IRC [PING start]
    [2015-08-18 16:19:39.060644] (MY_NICK/Rizon) IRC -> ZNC [:irc.broke-it.com PONG irc.broke-it.com :start]
    [2015-08-18 16:21:41.477026] (MY_NICK/Rizon) IRC -> ZNC [PING :irc.broke-it.com]
    [2015-08-18 16:21:41.477121] (MY_NICK/Rizon) ZNC -> IRC [PONG :irc.broke-it.com]
    [2015-08-18 16:23:46.455332] (MY_NICK/Rizon) IRC -> ZNC [PING :irc.broke-it.com]
    [2015-08-18 16:23:46.455816] (MY_NICK/Rizon) ZNC -> IRC [PONG :irc.broke-it.com]
    [2015-08-18 16:24:27.871916] (MY_NICK/Rizon) ZNC -> CLI [PING :ZNC]
    [2015-08-18 16:24:57.881109] (MY_NICK/Rizon) ZNC -> CLI [PING :ZNC]
    [2015-08-18 16:25:27.948415] (MY_NICK/Rizon) ZNC -> CLI [PING :ZNC]
    [2015-08-18 16:25:51.444948] (MY_NICK/Rizon) IRC -> ZNC [PING :irc.broke-it.com]
    [2015-08-18 16:25:51.445049] (MY_NICK/Rizon) ZNC -> IRC [PONG :irc.broke-it.com]
    [2015-08-18 16:25:57.988596] (MY_NICK/Rizon) ZNC -> CLI [PING :ZNC]
    [2015-08-18 16:26:27.992866] (MY_NICK/Rizon) ZNC -> CLI [PING :ZNC]
    [2015-08-18 16:26:57.997046] (MY_NICK/Rizon) ZNC -> CLI [PING :ZNC]
    [2015-08-18 16:27:28.001311] (MY_NICK/Rizon) ZNC -> CLI [PING :ZNC]
    [2015-08-18 16:27:56.481518] (MY_NICK/Rizon) IRC -> ZNC [PING :irc.broke-it.com]
    [2015-08-18 16:27:56.481591] (MY_NICK/Rizon) ZNC -> IRC [PONG :irc.broke-it.com]
    [2015-08-18 16:27:58.005493] (MY_NICK/Rizon) ZNC -> CLI [PING :ZNC]
    [2015-08-18 16:28:28.009790] (MY_NICK/Rizon) ZNC -> CLI [PING :ZNC]
    [2015-08-18 16:28:39.837862] (MY_NICK/Rizon) ZNC -> CLI [ERROR :Closing link [Timeout]]
    [2015-08-18 16:28:39.837941] USR::MY_NICK == Disconnected()
    [2015-08-18 16:28:39.837960] (MY_NICK/Rizon) ZNC -> CLI [:MY_NICK!~MY_NICK@whatever PART #tmp]
    
  4. Result: the client sends only one ping to znc then never responds. After znc disconnects the client it immediately reconnects, as it is configured to.

    [2015-08-18 16:32:01.892684] (MY_NICK/Rizon) CLI -> ZNC [PING start]
    [2015-08-18 16:32:01.892750] (MY_NICK/Rizon) ZNC -> CLI [:irc.znc.in PONG irc.znc.in start]
    [2015-08-18 16:32:01.892804] (MY_NICK/Rizon) ZNC -> IRC [PING start]
    [2015-08-18 16:32:01.985701] (MY_NICK/Rizon) IRC -> ZNC [:irc.broke-it.com PONG irc.broke-it.com :start]
    [2015-08-18 16:34:06.464084] (MY_NICK/Rizon) IRC -> ZNC [PING :irc.broke-it.com]
    [2015-08-18 16:34:06.464159] (MY_NICK/Rizon) ZNC -> IRC [PONG :irc.broke-it.com]
    [2015-08-18 16:34:23.657767] (MY_NICK/Rizon) CLI -> ZNC [PING :1439915664325]
    [2015-08-18 16:34:23.657880] (MY_NICK/Rizon) ZNC -> CLI [:irc.znc.in PONG irc.znc.in :1439915664325]
    [2015-08-18 16:34:23.657946] (MY_NICK/Rizon) ZNC -> IRC [PING :1439915664325]
    [2015-08-18 16:34:23.750671] (MY_NICK/Rizon) IRC -> ZNC [:irc.broke-it.com PONG irc.broke-it.com :1439915664325]
    [2015-08-18 16:36:26.457388] (MY_NICK/Rizon) IRC -> ZNC [PING :irc.broke-it.com]
    [2015-08-18 16:36:26.457467] (MY_NICK/Rizon) ZNC -> IRC [PONG :irc.broke-it.com]
    [2015-08-18 16:38:31.451570] (MY_NICK/Rizon) IRC -> ZNC [PING :irc.broke-it.com]
    [2015-08-18 16:38:31.451686] (MY_NICK/Rizon) ZNC -> IRC [PONG :irc.broke-it.com]
    [2015-08-18 16:38:58.314417] (MY_NICK/Rizon) ZNC -> CLI [PING :ZNC]
    [2015-08-18 16:39:28.314650] (MY_NICK/Rizon) ZNC -> CLI [PING :ZNC]
    [2015-08-18 16:39:58.314908] (MY_NICK/Rizon) ZNC -> CLI [PING :ZNC]
    [2015-08-18 16:40:28.315130] (MY_NICK/Rizon) ZNC -> CLI [PING :ZNC]
    [2015-08-18 16:40:36.439428] (MY_NICK/Rizon) IRC -> ZNC [PING :irc.broke-it.com]
    [2015-08-18 16:40:36.439503] (MY_NICK/Rizon) ZNC -> IRC [PONG :irc.broke-it.com]
    [2015-08-18 16:40:58.339304] (MY_NICK/Rizon) ZNC -> CLI [PING :ZNC]
    [2015-08-18 16:41:28.343598] (MY_NICK/Rizon) ZNC -> CLI [PING :ZNC]
    [2015-08-18 16:41:58.347751] (MY_NICK/Rizon) ZNC -> CLI [PING :ZNC]
    [2015-08-18 16:42:28.352001] (MY_NICK/Rizon) ZNC -> CLI [PING :ZNC]
    [2015-08-18 16:42:41.451420] (MY_NICK/Rizon) IRC -> ZNC [PING :irc.broke-it.com]
    [2015-08-18 16:42:41.451504] (MY_NICK/Rizon) ZNC -> IRC [PONG :irc.broke-it.com]
    [2015-08-18 16:42:58.356202] (MY_NICK/Rizon) ZNC -> CLI [PING :ZNC]
    [2015-08-18 16:43:23.968432] (MY_NICK/Rizon) ZNC -> CLI [ERROR :Closing link [Timeout]]
    [2015-08-18 16:43:23.968521] USR::MY_NICK == Disconnected()
    [2015-08-18 16:43:23.968547] (MY_NICK/Rizon) ZNC -> CLI [:MY_NICK!~MY_NICK@whatever PART #tmp]
    

I will do some more testing with other, more recent irc clients and test direct connections to the network too. I highly doubt it's znc's fault here.

I did 2 tests with the debug option: 1. While the phone was locked on smart power saving profile(the default I use) 2. While the phone was charging and unlocked through the whole test on normal power saving profile The client is AndChat 1.4.3.2 1. Result: after locking the phone the client doesn't send nor respond to pings. The client doesn't detect the closed connection. ``` // `/ping start` then locked the phone [2015-08-18 16:19:38.967690] (MY_NICK/Rizon) CLI -> ZNC [PING start] [2015-08-18 16:19:38.967766] (MY_NICK/Rizon) ZNC -> CLI [:irc.znc.in PONG irc.znc.in start] [2015-08-18 16:19:38.967821] (MY_NICK/Rizon) ZNC -> IRC [PING start] [2015-08-18 16:19:39.060644] (MY_NICK/Rizon) IRC -> ZNC [:irc.broke-it.com PONG irc.broke-it.com :start] [2015-08-18 16:21:41.477026] (MY_NICK/Rizon) IRC -> ZNC [PING :irc.broke-it.com] [2015-08-18 16:21:41.477121] (MY_NICK/Rizon) ZNC -> IRC [PONG :irc.broke-it.com] [2015-08-18 16:23:46.455332] (MY_NICK/Rizon) IRC -> ZNC [PING :irc.broke-it.com] [2015-08-18 16:23:46.455816] (MY_NICK/Rizon) ZNC -> IRC [PONG :irc.broke-it.com] [2015-08-18 16:24:27.871916] (MY_NICK/Rizon) ZNC -> CLI [PING :ZNC] [2015-08-18 16:24:57.881109] (MY_NICK/Rizon) ZNC -> CLI [PING :ZNC] [2015-08-18 16:25:27.948415] (MY_NICK/Rizon) ZNC -> CLI [PING :ZNC] [2015-08-18 16:25:51.444948] (MY_NICK/Rizon) IRC -> ZNC [PING :irc.broke-it.com] [2015-08-18 16:25:51.445049] (MY_NICK/Rizon) ZNC -> IRC [PONG :irc.broke-it.com] [2015-08-18 16:25:57.988596] (MY_NICK/Rizon) ZNC -> CLI [PING :ZNC] [2015-08-18 16:26:27.992866] (MY_NICK/Rizon) ZNC -> CLI [PING :ZNC] [2015-08-18 16:26:57.997046] (MY_NICK/Rizon) ZNC -> CLI [PING :ZNC] [2015-08-18 16:27:28.001311] (MY_NICK/Rizon) ZNC -> CLI [PING :ZNC] [2015-08-18 16:27:56.481518] (MY_NICK/Rizon) IRC -> ZNC [PING :irc.broke-it.com] [2015-08-18 16:27:56.481591] (MY_NICK/Rizon) ZNC -> IRC [PONG :irc.broke-it.com] [2015-08-18 16:27:58.005493] (MY_NICK/Rizon) ZNC -> CLI [PING :ZNC] [2015-08-18 16:28:28.009790] (MY_NICK/Rizon) ZNC -> CLI [PING :ZNC] [2015-08-18 16:28:39.837862] (MY_NICK/Rizon) ZNC -> CLI [ERROR :Closing link [Timeout]] [2015-08-18 16:28:39.837941] USR::MY_NICK == Disconnected() [2015-08-18 16:28:39.837960] (MY_NICK/Rizon) ZNC -> CLI [:MY_NICK!~MY_NICK@whatever PART #tmp] ``` 2. Result: the client sends only one ping to znc then never responds. After znc disconnects the client it immediately reconnects, as it is configured to. ``` [2015-08-18 16:32:01.892684] (MY_NICK/Rizon) CLI -> ZNC [PING start] [2015-08-18 16:32:01.892750] (MY_NICK/Rizon) ZNC -> CLI [:irc.znc.in PONG irc.znc.in start] [2015-08-18 16:32:01.892804] (MY_NICK/Rizon) ZNC -> IRC [PING start] [2015-08-18 16:32:01.985701] (MY_NICK/Rizon) IRC -> ZNC [:irc.broke-it.com PONG irc.broke-it.com :start] [2015-08-18 16:34:06.464084] (MY_NICK/Rizon) IRC -> ZNC [PING :irc.broke-it.com] [2015-08-18 16:34:06.464159] (MY_NICK/Rizon) ZNC -> IRC [PONG :irc.broke-it.com] [2015-08-18 16:34:23.657767] (MY_NICK/Rizon) CLI -> ZNC [PING :1439915664325] [2015-08-18 16:34:23.657880] (MY_NICK/Rizon) ZNC -> CLI [:irc.znc.in PONG irc.znc.in :1439915664325] [2015-08-18 16:34:23.657946] (MY_NICK/Rizon) ZNC -> IRC [PING :1439915664325] [2015-08-18 16:34:23.750671] (MY_NICK/Rizon) IRC -> ZNC [:irc.broke-it.com PONG irc.broke-it.com :1439915664325] [2015-08-18 16:36:26.457388] (MY_NICK/Rizon) IRC -> ZNC [PING :irc.broke-it.com] [2015-08-18 16:36:26.457467] (MY_NICK/Rizon) ZNC -> IRC [PONG :irc.broke-it.com] [2015-08-18 16:38:31.451570] (MY_NICK/Rizon) IRC -> ZNC [PING :irc.broke-it.com] [2015-08-18 16:38:31.451686] (MY_NICK/Rizon) ZNC -> IRC [PONG :irc.broke-it.com] [2015-08-18 16:38:58.314417] (MY_NICK/Rizon) ZNC -> CLI [PING :ZNC] [2015-08-18 16:39:28.314650] (MY_NICK/Rizon) ZNC -> CLI [PING :ZNC] [2015-08-18 16:39:58.314908] (MY_NICK/Rizon) ZNC -> CLI [PING :ZNC] [2015-08-18 16:40:28.315130] (MY_NICK/Rizon) ZNC -> CLI [PING :ZNC] [2015-08-18 16:40:36.439428] (MY_NICK/Rizon) IRC -> ZNC [PING :irc.broke-it.com] [2015-08-18 16:40:36.439503] (MY_NICK/Rizon) ZNC -> IRC [PONG :irc.broke-it.com] [2015-08-18 16:40:58.339304] (MY_NICK/Rizon) ZNC -> CLI [PING :ZNC] [2015-08-18 16:41:28.343598] (MY_NICK/Rizon) ZNC -> CLI [PING :ZNC] [2015-08-18 16:41:58.347751] (MY_NICK/Rizon) ZNC -> CLI [PING :ZNC] [2015-08-18 16:42:28.352001] (MY_NICK/Rizon) ZNC -> CLI [PING :ZNC] [2015-08-18 16:42:41.451420] (MY_NICK/Rizon) IRC -> ZNC [PING :irc.broke-it.com] [2015-08-18 16:42:41.451504] (MY_NICK/Rizon) ZNC -> IRC [PONG :irc.broke-it.com] [2015-08-18 16:42:58.356202] (MY_NICK/Rizon) ZNC -> CLI [PING :ZNC] [2015-08-18 16:43:23.968432] (MY_NICK/Rizon) ZNC -> CLI [ERROR :Closing link [Timeout]] [2015-08-18 16:43:23.968521] USR::MY_NICK == Disconnected() [2015-08-18 16:43:23.968547] (MY_NICK/Rizon) ZNC -> CLI [:MY_NICK!~MY_NICK@whatever PART #tmp] ``` I will do some more testing with other, more recent irc clients and test direct connections to the network too. I highly doubt it's znc's fault here. <!-- github-comment-id:132281479 -->
Author
Owner

I think "smart power saving" is your problem. Try to turn it off for one test.

I think "smart power saving" is your problem. Try to turn it off for one test. <!-- github-comment-id:132464484 -->
Author
Owner

@urbels Yes, it can cause the connection to timeout. After testing some more clients I noticed that most of them don't reply do znc's pings whether or not the phone is locked. AndroIRC performs well when ping is enabled from the settings menu.

@urbels Yes, it can cause the connection to timeout. After testing some more clients I noticed that most of them don't reply do znc's pings whether or not the phone is locked. AndroIRC performs well when ping is enabled from the settings menu. <!-- github-comment-id:132548930 -->
Author
Owner

I tested shroudBNC and it works as expected. The only difference I noticed between the two is the client ping frequency. sbnc pings the client every 90 seconds, while znc pings it every 270 seconds. I set sbnc's ping frequency to 360s and it exhibits the same problem as znc. I'll try to recompile znc with 60s ping frequency and see how it behaves.

I tested shroudBNC and it works as expected. The only difference I noticed between the two is the client ping frequency. sbnc pings the client every 90 seconds, while znc pings it every 270 seconds. I set sbnc's ping frequency to 360s and it exhibits the same problem as znc. I'll try to recompile znc with 60s ping frequency and see how it behaves. <!-- github-comment-id:132777789 -->
Author
Owner

Yes, its working. 20 minutes locked with power saving features on and it's still connected.

So summary of the problem.

I think that the phone, after a few minutes of cpu inactivity, goes into a deep sleep mode and fails to reply to znc's pings. For some reason this leads to the connection breaking(the client thinks it's still connected but can't send or receive anything). Increasing znc's ping frequency from one ping per 4.5 minutes to one ping per minute stops my phone from going into deep sleep and losing connection. I still blame my cheap phone running an old android version for this issue.

I said earlier that most android IRC clients fail to reply to pings properly, except AndroIRC. This is false, they all reply properly, it's just that AndroIRC specifically sends pings to the server every 10-30 seconds, keeping the phone off deep sleep for longer, but even so it loses connection at some point.

As a suggestion make PING_FREQUENCY, PING_SLACK and NO_TRAFFIC_TIMEOUT in class CIRCNetwork configurable in znc.conf.

Yes, its working. 20 minutes locked with power saving features on and it's still connected. So summary of the problem. I think that the phone, after a few minutes of cpu inactivity, goes into a deep sleep mode and fails to reply to znc's pings. For some reason this leads to the connection breaking(the client thinks it's still connected but can't send or receive anything). Increasing znc's ping frequency from one ping per 4.5 minutes to one ping per minute stops my phone from going into deep sleep and losing connection. I still blame my cheap phone running an old android version for this issue. I said earlier that most android IRC clients fail to reply to pings properly, except AndroIRC. This is false, they all reply properly, it's just that AndroIRC specifically sends pings to the server every 10-30 seconds, keeping the phone off deep sleep for longer, but even so it loses connection at some point. As a suggestion make PING_FREQUENCY, PING_SLACK and NO_TRAFFIC_TIMEOUT in class CIRCNetwork configurable in znc.conf. <!-- github-comment-id:132808253 -->
Author
Owner

#979 decreased that timeout to 2m.

#979 decreased that timeout to 2m. <!-- github-comment-id:132814563 -->
Author
Owner

Actually https://github.com/znc/znc/issues/980 lowered it and https://github.com/znc/znc/issues/979 is request to make it configurable.

Actually https://github.com/znc/znc/issues/980 lowered it and https://github.com/znc/znc/issues/979 is request to make it configurable. <!-- github-comment-id:132914558 -->
Author
Owner

Isn't this basically duplicate of https://github.com/znc/znc/issues/979?

Isn't this basically duplicate of https://github.com/znc/znc/issues/979? <!-- github-comment-id:138888713 -->
Sign in to join this conversation.
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: adam/znc#554