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

Send periodic PINGs to the server to detect ping timeout #63

Closed
ghost opened this issue Jul 25, 2015 · 4 comments
Closed

Send periodic PINGs to the server to detect ping timeout #63

ghost opened this issue Jul 25, 2015 · 4 comments
Assignees
Labels
Milestone

Comments

@ghost
Copy link

ghost commented Jul 25, 2015

If the bot disconnects uncleanly (e.g. ping timeout), it might not notice it, and if it isn't writing to the socket, chances are it will never notice it. As soon as it tries to write to the socket, it would get a "Broken pipe" error.

To avoid this issue, coffea should send periodic keepalive PINGs to the server. (The interval should be probably configurable.)

@ghost ghost changed the title Send keepalive PINGs to the server to detect unclean disconnection Send keepalive PINGs to the server to detect ping timeout / unclean disconnect Jul 25, 2015
@ghost ghost changed the title Send keepalive PINGs to the server to detect ping timeout / unclean disconnect Send periodic PINGs to the server to detect ping timeout Jul 25, 2015
@omnidan
Copy link
Member

omnidan commented Jul 30, 2015

@nyuszika7h could you post the crash logs, maybe a short reproduction log (including ircd information and what you did to produce the crash)? I haven't had problems with any ircds yet.

@melamity
Copy link
Contributor

I was going to work on this, then I realised we have a way of detecteting that we've disconnected: The socket closes/ends. Why it wouldn't close the socket when we're disconnected intrigues me. Can this be consistently reproduced?

@omnidan omnidan added the bug label Jul 30, 2015
@omnidan omnidan added this to the 0.4 milestone Jul 30, 2015
@ghost
Copy link
Author

ghost commented Jul 30, 2015

@omnidan There is no "crash log", as the bot simply stays running, unless something makes it write to the socket.

@michealharker This is not an issue with coffea in particular, it's just how TCP works. If the server doesn't send a TCP RST for whatever reason, the client won't know it's disconnected unless it tries to send data.

I can give you a way to reproduce it, though, as a few days ago I discovered that Undernet's ircd does not send any feedback at all on QUIT. So just connect the bot to irc.undernet.org and make it send a QUIT.

See also: http://tldp.org/HOWTO/TCP-Keepalive-HOWTO/overview.html

Note that the default configuration of the Linux kernel's keepalive is insufficient, as it will only disconnect after about 10 hours (I can't find the exact StackOverflow post now). So you need to do keepalive manually.

@omnidan
Copy link
Member

omnidan commented Feb 11, 2016

Closing this here for now. This should be considered in coffea-irc, though: caffeinery/coffea-irc#1

@omnidan omnidan closed this as completed Feb 11, 2016
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