Closed phpmooc closed 2 years ago
I see you closed the issue. But I have the same error and was wondering if you found a way to reconnect without an error?
But I have the same error
There are many reasons you might not be able to complete a connect to something that are not "the same error". What exactly do your logs say?
I first get a validity timeout that causes the connection drop, then I reconnect but get errno 115, and closed before established
2022-08-01T10:31:10.794 cpa: rops_handle_POLLOUT_ws: ocpp1.6: wsi->ws->tx_draining_ext 0 2022-08-01T10:31:10.795 cpa: _lws_change_pollfd: wsi 0x760007b8: fd 33 events 5 -> 1 2022-08-01T10:31:10.795 cpa: lws_handle_POLLOUT_event: 0x760007b8: non mux: wsistate 0x10000119, ops ws 2022-08-01T10:31:20.794 cpa: lws_validity_cb: wsi 0x760007b8: validity too old 2022-08-01T10:31:20.795 cpa: lws_close_free_wsi: 0x760007b8: caller: validity timeout 2022-08-01T10:31:20.795 cpa: __lws_close_free_wsi: real just_kill_connection: 0x760007b8 (sockfd 33) 2022-08-01T10:31:20.795 cpa: lwsi_set_state(0x760007b8, 0x10000020) 2022-08-01T10:31:20.795 cpa: lws_close_free_wsi_final: wsi 0x760007b8: fd 33 2022-08-01T10:31:20.796 cpa: lws_vhost_unbind_wsi: vh default: count_bound_wsi 0 2022-08-01T10:31:20.796 cpa: lws_free_wsi: 0x760007b8, remaining wsi 1, tsi fds count 1 2022-08-01T10:31:37.164 cpa: _realloc: size 496: client wsi 2022-08-01T10:31:37.165 cpa: lws_vhost_bind_wsi: vh default: wsi none/none, count_bound_wsi 1 2022-08-01T10:31:37.165 cpa: _realloc: size 192: client ws struct 2022-08-01T10:31:37.165 cpa: lws_role_transition: 0x760007b8: wsistate 0x10000200, ops h1 2022-08-01T10:31:37.165 cpa: lws_client_connect_via_info: role binding to h1 2022-08-01T10:31:37.165 cpa: lws_client_connect_via_info: protocol binding to ocpp1.6 2022-08-01T10:31:37.165 cpa: _realloc: size 4: user space 2022-08-01T10:31:37.165 cpa: lws_client_connect_via_info: wsi 0x760007b8: h1 ocpp1.6 entry 2022-08-01T10:31:37.165 cpa: _realloc: size 128: client stash 2022-08-01T10:31:37.165 cpa: lws_header_table_attach: wsi 0x760007b8: ah (nil) (tsi 0, count = 0) in 2022-08-01T10:31:37.165 cpa: _realloc: size 952: ah struct 2022-08-01T10:31:37.167 cpa: _realloc: size 4096: ah data 2022-08-01T10:31:37.168 cpa: _lws_create_ah: created ah 0x76001248 (size 4096): pool length 1 2022-08-01T10:31:37.168 cpa: lws_header_table_attach: did attach wsi 0x760007b8: ah 0x76001248: count 1 (on exit) 2022-08-01T10:31:37.168 cpa: lws_set_timeout: 0x760007b8: 10 secs, reason 25 2022-08-01T10:31:37.168 cpa: lws_http_client_connect_via_info2: 0x760007b8 (stash 0x76000d18) 2022-08-01T10:31:37.168 cpa: _realloc: size 19: strdup 2022-08-01T10:31:37.168 cpa: lwsi_set_state(0x760007b8, 0x10000201) 2022-08-01T10:31:37.168 cpa: lws_client_connect_2_dnsreq: 0x760007b8: lookup 192.168.255.254:80 2022-08-01T10:31:37.168 cpa: lws_getaddrinfo46: getaddrinfo '192.168.255.254' says 0 2022-08-01T10:31:37.168 cpa: lws_client_connect_3_connect: result 0x76003538 result->ai_next (nil) 2022-08-01T10:31:37.168 cpa: lws_client_connect_3_connect: 192.168.255.254 ipv4 192.168.255.254 2022-08-01T10:31:37.170 cpa: lws_client_connect_3_connect: 0x760007b8: WAITING_CONNECT 2022-08-01T10:31:37.171 cpa: lwsi_set_state(0x760007b8, 0x10000202) 2022-08-01T10:31:37.171 cpa: insert_wsi_socket_into_fds: 0x760007b8: tsi=0, sock=33, pos-in-fds=1 2022-08-01T10:31:37.171 cpa: _lws_change_pollfd: wsi 0x760007b8: fd 33 events 1 -> 1 2022-08-01T10:31:37.173 cpa: __lws_set_timeout: 0x760007b8: 20 secs, reason 2 2022-08-01T10:31:37.174 cpa: lws_client_connect_3_connect: connect says errno: 115 2022-08-01T10:31:37.174 cpa: _lws_change_pollfd: wsi 0x760007b8: fd 33 events 1 -> 5 2022-08-01T10:31:37.174 cpa: lws_client_connect_via_info: wsi 0x760007b8: adoption cb 19 to h1 ocpp1.6 2022-08-01T10:31:37.174 cpa: ocpp client: (re-)connecting to '192.168.255.254:80' 2022-08-01T10:31:57.174 cpa: wsi 0x760007b8: TIMEDOUT WAITING on 2 (did hdr 0, ah 0x76001248, wl 0) 2022-08-01T10:31:57.174 cpa: lws_close_free_wsi: 0x760007b8: caller: timeout 2022-08-01T10:31:57.174 cpa: lws_close_free_wsi: 0x760007b8: DROP_PROTOCOL ocpp1.6 2022-08-01T10:31:57.175 cpa: ocpp client: cannot connect to server: closed before established (connecting) 2022-08-01T10:31:57.175 cpa: lws_close_free_wsi: real just_kill_connection: 0x760007b8 (sockfd 33) 2022-08-01T10:31:57.175 cpa: lwsi_set_state(0x760007b8, 0x10000020) 2022-08-01T10:31:57.175 cpa: lws_close_free_wsi_final: wsi 0x760007b8: fd 33 2022-08-01T10:31:57.175 cpa: rops_destroy_role_h1: ah det due to close 2022-08-01T10:31:57.177 cpa: __lws_header_table_detach: wsi 0x760007b8: ah 0x76001248 (tsi=0, count = 1) 2022-08-01T10:31:57.177 cpa: lws_header_table_detach: wsi 0x760007b8: ah held 20s, role/state 0x10000000 0x20, 2022-08-01T10:31:57.178 cpa: lws_header_table_detach: nobody usable waiting 2022-08-01T10:31:57.178 cpa: _lws_destroy_ah: freed ah 0x76001248 : pool length 0 2022-08-01T10:31:57.178 cpa: lws_header_table_detach: wsi 0x760007b8: ah 0x76001248 (tsi=0, count = 0) 2022-08-01T10:31:57.178 cpa: lws_vhost_unbind_wsi: vh default: count_bound_wsi 0 2022-08-01T10:31:57.178 cpa: __lws_free_wsi: 0x760007b8, remaining wsi 1, tsi fds count 1 2022-08-01T10:32:14.204 cpa: _realloc: size 496: client wsi
115 is EINPROGRESS on Linux, it isn't an error, it just means it doesn't think it has connected yet but is trying.
It will wait until it hears an event to say that it is connected, failed, or times out waiting for the connection to happen.
And indeed 20s later he times out.
I would use tcpdump to watch what actually happens, from this information, it's compatible with the server just not responding to the connection the second time (perhaps for whatver reason that the first connection was not responsive).
Thank you, I will do that!
Use LWS (all sides are deployed locally) as the role of websocket client, when I try to connect to the remote websocket server, the debug terminal gives me detailed logs listed as below:
CLIENT_CONNECTION_ERROR: closed before established
, so what clues can be found in the log or what cause this to happen?lws_set_timeout
andlws_wsi_close
andlws_close_reason
, but all of them will cause my GUI app crash. so what is going on here?Tks a lot Sir.