synapseweb3 / forcerelay

Apache License 2.0
10 stars 8 forks source link

axon_event_monitor Error: Websocket closed unexpectedly #339

Closed Flouse closed 1 year ago

Flouse commented 1 year ago

Summary of Bug

Axon Websocket seems to be not working in ibc-test:

Logs

2023-09-27T10:18:07.286684Z ERROR ethers_providers::rpc::transports::ws::backend: Error response from WS err=WebSocket protocol error: Connection reset without closing handshake
2023-09-27T10:18:07.286964Z  INFO ethers_providers::rpc::transports::ws::manager: Reconnecting to backend remaining=4 url="ws://localhost:7023/"
2023-09-27T10:18:07.289618Z ERROR ethers_providers::rpc::transports::ws::manager: Error during reconnection err=IO error: Connection refused (os error 111)
Error: relayer error

Version

Steps to Reproduce

See https://github.com/synapseweb3/forcerelay/actions/runs/6337071119/job/17211386446#step:16:406 or https://github.com/synapseweb3/forcerelay/actions/runs/6309594521/job/17174052183#step:16:273

Acceptance Criteria

No relayer error or explain the error


For Admin Use

Flouse commented 1 year ago
2023-09-27T10:18:07.286964Z  INFO ethers_providers::rpc::transports::ws::manager: Reconnecting to backend remaining=4 url="ws://localhost:7023/"

@ashuralyk Do you know why the monitor was using port 7023? As I know, Axon's WebSocket port is 8010 by default.

ashuralyk commented 1 year ago
```js
2023-09-27T10:18:07.286964Z  INFO ethers_providers::rpc::transports::ws::manager: Reconnecting to backend remaining=4 url="ws://localhost:7023/"

@ashuralyk Do you know why the monitor was using port 7023? As I know, Axon's WebSocket port is 8010 by default.

As I know, WebSocket port is Https port plus 1, it's hard-coded in the test case @jjyr

Flouse commented 1 year ago

WebSocket port is Https port plus 1,

Why?

You can see that the default config of Axon is

[rpc]
http_listening_address = "0.0.0.0:8000"
ws_listening_address = "0.0.0.0:8010"

https://github.com/axonweb3/axon/blob/6fe5777e0b4a9b994dc84a56a00005745fd05085/devtools/chain/config.toml#L7-L9

jjyr commented 1 year ago

It is not related to Axon default ports.

In IBC test framework, the framework generate random ports for each protocol, except for ws, IBC framework using the same port for http and ws.

Unfortrunately, Axon do not support listening http and ws on the same port. So we make an adjustment to always use http + 1 as the ws port. This assumption only affects the tests.

I think we already discussed this issue in https://github.com/synapseweb3/forcerelay/pull/330/commits/c7e22e7cce5d3df53e10c3103f2e91f549561c2c

blckngm commented 1 year ago

Should be fixed in https://github.com/synapseweb3/forcerelay/pull/332