-
Notifications
You must be signed in to change notification settings - Fork 42
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
Frequent disconnections at regular intervals #1565
Comments
Just adding to this that I also see disconnections (about 15 per hour) when I run |
I changed the loglevel to DEBUG for nwaku on the local docker image to see in the logs what is going on when I see a disconnect event:
|
This seems like to be a problem between version: '2.4'
services:
waku:
image: wakuorg/go-waku:latest
command: |
--store=true
--filter=true
--lightpush=true
--websocket-support=true
--websocket-port=8000
--nodekey=7b8d9a670aae6421500b7b3f933d0b5d08b51fcf0f0c2f14cba3a4737c83a228
--min-relay-peers-to-publish=0
ports:
- 8000:8000/tcp |
Hi @agazso At this point in time, js-waku targets the browser environment and is being optimized for light client protocols. Waku Relay in js-waku is considered highly experimental because of browser scalability reasons. For NodeJS, we recommend running nwaku alongside your NodeJS application and consuming its JSON RPC (REST API is wip). |
Just to clarify the Node.js application is running the exact same code of a lightweight chat protocol that runs in the browser and it only uses The same issue exist in browsers, but it's more difficult to experiment and reproduce testing long running processes in the browser to collect data for this issue, that's why I chose to illustrate it with a Node.js app. BTW It is very convenient that the same code can be shared and it would be more work to create and maintain a separate version that uses a different API. |
should be partially fixed with #1647 |
Yes we understand we are considering making js-waku officially support on NodeJS.. However, for now the focus is on delivering waku-org/pm#50 and in this context, keeping js-waku focused on the browser. |
I no longer observe this, so it seems the default keepalive ping solved this issue. |
This is a bug report
Problem
I have a Node.js application that is a long running process (think of a chat bot) connected to a single
nwaku
node. Sometimes it did not receive messages so I started investigating the issue by logging out disconnect and connect events. The disconnect event is whenlibp2p
generates the eventpeer:disconnect
and connect ispeer:connect
.I cannot reliably reproduce the issue. Sometimes it happens all the time, sometimes it happens rarely. It might be a clue is that often the disconnect happen at a multiplier of 30 seconds interval. So at the 2nd second or the 32nd second of the minute. I observed from the nwaku logs that it also prints out internal metrics at 30 seconds, maybe it is related. I included a log from my application to illustrate this.
Setting different
pingKeepAlive
values (e.g.3
,5
,15
etc.) does not seem to make a difference.Proposed Solutions
It would be good if waku did not disconnect at least when the quality of the connection is otherwise good. The problem with this is that basically I have to write a safe waku wrapper around waku to detect if there were a disconnect and after reconnection query the store for messages that I was subscribed to for the interval it was disconnected.
Another problem is that if I want to show the user if they are connected to the network or not and disable certain functionality which requires connectivity I cannot rely on detecting the connectivity this way because the user experience will be not great.
Maybe connecting to multiple nodes can improve the situation.
Notes
@waku/sdk version 0.0.18 (the latest working that I tried was 0.0.16)
Node.js v18.17.1 on Linux
Connected to
nwaku
0.19The text was updated successfully, but these errors were encountered: