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

pb-notify won't reconnect between network disturbances #1

Open
tsani opened this issue Feb 24, 2017 · 1 comment
Open

pb-notify won't reconnect between network disturbances #1

tsani opened this issue Feb 24, 2017 · 1 comment
Assignees
Labels

Comments

@tsani
Copy link
Owner

tsani commented Feb 24, 2017

If pb-notify is running during a network outage, then when the network comes back up, rather than crash or reconnect, it just becomes unresponsive. The process remains alive, but no more notifications are delivered.

@tsani tsani added the bug label Feb 24, 2017
@tsani tsani self-assigned this Feb 24, 2017
tsani added a commit that referenced this issue Apr 30, 2017
pb-notify now dispatches notifications when pushes are received.
See #2 although we still don't implement full notification mirroring.

This is done by watching the event stream for push-type tickles.
When one is received, the list of pushes since the last batch has been
processed is requested. Each is formatted appropriately is dispatched as a
libnotify notification.

Architecturally, this is done with a separate thread with an IORef holding the
timestamp of the last processed push. Initially, this variable is filled with
the timestamp of the latest push with activity in the account. This thread is
synchronized with the event-loop thread via a channel. When a tickle is
received on the event-loop thread, it sends a message over the chan notifying
the HTTP thread that the list of pushes needs to be updated.

The connectivity problems -- see #1 -- are partially resolved.
Connection to the websocket is wrapped with exception-handling code so that it
can be retried every five seconds. HTTP requests are also wrapped with retry
logic until they succeed. Waiting for messages on the event stream is wrapped
with a timeout of 35 seconds. (Since pushbullet sends a nop every 30 seconds.)
If the timeout is hit, then the event-loop dies and the websocket connection is
restarted.

There are still some connectivity problems though.
For instance, if the network is down and pb-notify is launched, then we get
repeated `getAddrInfo: name or service not found` errors, as we expect, but if
the network subsequently comes up, these errors continue rather than a
connection successfully being established.
I'm not sure why this is happening, but I suspect it has something to do with a
networking library being used under the hood, as I've noticed similar behaviour
in glirc2. Sometimes, doing a /reconnect on it doesn't work despite the network
being up! Similarly, I get repeated DNS resolution errors there as well when
the error occurs.
@tsani
Copy link
Owner Author

tsani commented Jun 15, 2017

I believe that this issue is broader than just tpb, as glirc2 appears affected by it too. It might have something to do with the Haskell RTS or the underlying network library incorrectly doing some kind of caching. The specific error that I get in glirc2 is a name or service not found.

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

1 participant