kvirc / KVIrc

The KVIrc IRC Client
http://www.kvirc.net/
GNU General Public License v2.0
235 stars 76 forks source link

Disconnection to Twitch is not detected. #2310

Closed craftwar closed 6 years ago

craftwar commented 6 years ago

Expected behavior

Kvirc knows disconnection and reconnects automatically.

Actual behavior

I need send anything to twitch or Kvirc never knows.

Steps to reproduce the issue

  1. Connect to Twitch and login
  2. Power down xDSL modem or anything to get a new ip.

System information

KVIrc 4.9.2 'Aria'

Runtime Info: System name: Windows Release : 6.1.7601 System version: Windows 7 Ultimate (x64) Service Pack 1 (Build 7601) Architecture: AMD64 Family 16 Model 4 Stepping 3 Qt version: 5.8.0 Qt theme: windowsvista

Build Info: Build date: 2017-09-11 03:05:06 UTC Sources date: 20170910 Revision number: git-7193-g100f7dad5 System name: Windows-6.3.9600 CPU name: AMD64 Build command: C:/Program Files (x86)/CMake/bin/cmake.exe Build flags: MANDIR=share/man CMAKE_INSTALL_PREFIX=C:/projects/kvirc/build/release Threads=Win32 Compiler name: C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/bin/amd64/cl.exe Compiler flags: /DWIN32 /D_WINDOWS /W3 /GR /EHsc Qt version: 5.8.0 Features: IRC, IPv6, Crypt, SSL, IPC, Transparency, Perl, Python, Enchant, Qt5, KVS

Heufneutje commented 6 years ago

That sounds like more of a Twitch issue than a KVIrc issue. Keep in mind that Twitch does not comply to most of the RFC1459 standards.

LeRaldo commented 6 years ago

I used to experience this on all networks, not just twitch, until I enabled the Lag Meter (boolUseLagMeterEngine). Since enabling the lag meter, I don't experience this on any networks, including twitch. I'm on 4.9.2 git-7124-gd3d9de816, Windows 10 Home.

ctrlaltca commented 6 years ago

I think KVIrc doesn't really have the ability to understand when the internet connectivity fails. Disconnects are typically caused by:

I suppose the lag meter is forcing CTCP PINGs to go out (reads and writes on the connection socket), and this is causing the operating system to detect the connection drop and inform KVIrc.

wodim commented 6 years ago

KVIrc can usually detect when the connection is dropped. For that to happen I've seen one usually just has to send something. boolUseLagMeterEngine is on by default and so is boolEnableAwayListUpdates so this should not be a problem since KVIrc spends all day sending stuff. What I don't know, is if the OS doesn't know the connection is down until KVIrc sends something through the socket, or if the OS knows but KVIrc is not aware of some signal that is being sent.

Also, I believe the lag checker module (which is only enabled if boolUseLagMeterEngine is on) does nothing no matter what the current lag is. It should disconnect you over a certain threshold (sent a server PING with no response in X seconds, etc).

If there is no way of detecting if the socket has been dropped without sending something then boolUseLagMeterEngine should not be... disableable? I don't understand why server PINGs can be disabled, when they are a vital part of the protocol.

Pan7 commented 6 years ago

Only have this problem with ssl connections and enabling the lagometer seems to fix it. Its like the PONG message gets dropped.

CyberShadow commented 6 years ago

There are definitely some problems with how KVIrc handles timeouts.

If you suspend your computer and restore it after an hour, KVIrc should immediately assume that all connections have timed out and attempt to reestablish them. Ideally we would use a timer that tracks wall time (i.e. it is not paused when the PC is suspended), but is monotonic (in the sense that it is not affected by timezone / DST changes or NTP adjustments).

CyberShadow commented 6 years ago

Apparently, this is "by design":

https://github.com/kvirc/KVIrc/blob/166f0f5534f90b14abd5b1fde1905ce926e149cc/doc/FAQ#L507-L526

This seems like a very strange decision. IRC clients definitely need to send their own PINGs, or use something like TCP keep-alive.

wodim commented 6 years ago

KVIrc sends PINGs by default as long as the boolUseLagMeterEngine is kept on.

craftwar commented 6 years ago

I enable lagmeter and KVirc works fine.

AndrioCelos commented 6 years ago

Note that the IRC PING command is different from a CTCP PING command. IRC PING is client-to-server, server-to-client or server-to-server, and CTCP is client-to-client-through-one-or-more-servers. Also, some clients don't respond to CTCP PINGs.

CyberShadow commented 6 years ago

Even with the lag meter enabled, KVIrc is still very slow at detecting disconnects after a suspend or a change in network configurations (e.g. Ethernet<->Wi-Fi).