node-steam-user icon indicating copy to clipboard operation
node-steam-user copied to clipboard

Does not re-attempt to connect if it encounters a network error while connecting

Open nolddor opened this issue 10 months ago • 7 comments

Seems like steam-user does not re-attempt to connect if it encounters a network error while connecting anymore as also described in some comments at #507

Versions

node --version
v20.18.2

cat node_modules/steam-user/package.json | grep version
        "version": "5.2.0",

Screenshots and Error Logs

Here are the logs after this week maintenace reboot.

[2025-02-19 00:02:25] [DEBUG] [W1] WebSocket closed by remote with code 1006 and reason "Socket closed"                                                                                    
[2025-02-19 00:02:25] [DEBUG] [W1] Handling connection close                                                                                                                                                                                                                                                                                   
[2025-02-19 00:02:25] [DEBUG] Disconnecting without sending logoff                                                                                                                         
[2025-02-19 00:02:25] [DEBUG] [W1] We wanted to end connection, but it's not connected or connecting                                                                                       
[2025-02-19 00:02:25] [DEBUG] [EBO] Queueing exponential backoff "logOn" with timeout 1000                                                                                                
[2025-02-19 00:02:26] [DEBUG] API GET request to https://api.steampowered.com/ISteamDirectory/GetCMListForConnect/v0001/?format=vdf&cellid=40: 200                                         
[2025-02-19 00:02:26] [DEBUG] Randomly chose websockets server cmp2-mad1.steamserver.net:443 (load = 10, wtd_load = 6.640289306640625)                                                     
[2025-02-19 00:02:26] [DEBUG] [W2] Connecting to WebSocket CM cmp2-mad1.steamserver.net:443                                                                                                
[2025-02-19 00:02:27] [DEBUG] [W2] WS connection timed out                                                                                                                                 
[2025-02-19 00:02:27] [DEBUG] [WebAPI] Using cached value for API_GET_https://api.steampowered.com/ISteamDirectory/GetCMListForConnect/v0001/                                              
[2025-02-19 00:02:27] [DEBUG] Randomly chose websockets server cmp2-mad1.steamserver.net:27018 (load = 15, wtd_load = 6.37919998168945312)                                                 
[2025-02-19 00:02:27] [DEBUG] [W3] Connecting to WebSocket CM cmp2-mad1.steamserver.net:27018                                                                                              
[2025-02-19 00:02:29] [DEBUG] [W3] WS connection timed out                                                                                                                                 
[2025-02-19 00:02:29] [DEBUG] [WebAPI] Using cached value for API_GET_https://api.steampowered.com/ISteamDirectory/GetCMListForConnect/v0001/                                              
[2025-02-19 00:02:29] [DEBUG] Randomly chose websockets server cmp2-mad1.steamserver.net:443 (load = 10, wtd_load = 6.640289306640625)                                                     
[2025-02-19 00:02:29] [DEBUG] [W4] Connecting to WebSocket CM cmp2-mad1.steamserver.net:443                                                                                               
[2025-02-19 00:02:33] [DEBUG] [W4] WS connection timed out                                                                                                                                 
[2025-02-19 00:02:33] [DEBUG] [WebAPI] Using cached value for API_GET_https://api.steampowered.com/ISteamDirectory/GetCMListForConnect/v0001/                                              
[2025-02-19 00:02:33] [DEBUG] Randomly chose websockets server cmp2-mad1.steamserver.net:443 (load = 10, wtd_load = 6.640289306640625)                                                     
[2025-02-19 00:02:33] [DEBUG] [W5] Connecting to WebSocket CM cmp2-mad1.steamserver.net:443                                                                                                
[2025-02-19 00:02:41] [DEBUG] [W5] WS connection timed out                                                                                                                                 
[2025-02-19 00:02:41] [DEBUG] [WebAPI] Using cached value for API_GET_https://api.steampowered.com/ISteamDirectory/GetCMListForConnect/v0001/                                              
[2025-02-19 00:02:41] [DEBUG] Randomly chose websockets server cmp2-mad1.steamserver.net:443 (load = 10, wtd_load = 6.640289306640625)                                                     
[2025-02-19 00:02:41] [DEBUG] [W6] Connecting to WebSocket CM cmp2-mad1.steamserver.net:443
[2025-02-19 00:02:47] [DEBUG] [W6] WebSocket disconnected with error: Response code 502
[2025-02-19 00:02:47] [DEBUG] [W6] Handling connection close
[2025-02-19 00:02:48] [DEBUG] [WebAPI] Using cached value for API_GET_https://api.steampowered.com/ISteamDirectory/GetCMListForConnect/v0001/

^ At this point DEBUG logs are stuck and no more traces were emitted.

nolddor avatar Feb 18 '25 23:02 nolddor

Noticed this yesterday as well. Can't remember what version I had but I believe it was before 5.0.9. I had tried upgrading to 5.2 and it happened again last night. Found these threads, tried version 5.0.9 and enabled debugging, it just happened again. It is now 10min after the last 'Request timed out' and have not seen anything new yet. (5.0.9 fixes the on error, but the reconnecting is something else.). I can restart and connect fine, the problem is if there is an issue it just goes offline and won't reconnect.

node v18.19.0 and [email protected]

[Feb 20 2025 13:21:43] - DEBUG: [W1#21] Handled message: ClientClanState [Feb 20 2025 13:27:43] - DEBUG: [W1] WebSocket disconnected with error: Ping timeout [Feb 20 2025 13:27:43] - DEBUG: [W1] Handling connection close [Feb 20 2025 13:27:43] - DEBUG: Disconnecting without sending logoff [Feb 20 2025 13:27:43] - DEBUG: [W1] We wanted to end connection, but it's not connected or connecting [Feb 20 2025 13:27:49] - DEBUG: GetCMListForConnect error: Request timed out [Feb 20 2025 13:27:55] - DEBUG: GetCMListForConnect error: Request timed out [Feb 20 2025 13:28:01] - DEBUG: GetCMListForConnect error: Request timed out [Feb 20 2025 13:28:07] - DEBUG: GetCMListForConnect error: Request timed out [Feb 20 2025 13:28:13] - DEBUG: GetCMListForConnect error: Request timed out [Feb 20 2025 13:28:19] - DEBUG: GetCMListForConnect error: Request timed out [Feb 20 2025 13:28:25] - DEBUG: GetCMListForConnect error: Request timed out [Feb 20 2025 13:28:31] - DEBUG: GetCMListForConnect error: Request timed out [Feb 20 2025 13:28:37] - DEBUG: GetCMListForConnect error: Request timed out [Feb 20 2025 13:28:43] - DEBUG: GetCMListForConnect error: Request timed out error occurred: Error: Request timed out

hamilton5 avatar Feb 20 '25 18:02 hamilton5

Hello @DoctorMcKay did you find the time to check on this? Do you require extra info from my side?

nolddor avatar Feb 25 '25 21:02 nolddor

Not had an issue since (of course) even after today's maint it's still online. I could see in the debug logs it losing connection and reconnecting.

hamilton5 avatar Feb 26 '25 02:02 hamilton5

I had upgrading to 5.2.0,same problem happened,use 5.0.10,it works.but how to fix it, i don`t know

hrjoyce1990 avatar Mar 11 '25 07:03 hrjoyce1990

Yeah, same story here.

{"level":30,"time":1743134386988,"pid":35,"hostname":"b4d423fccd64","name":"Express","message":"Api method invoked","request":{"path":"/getMarketListings","body":{}}}
{"level":30,"time":1743134386988,"pid":35,"hostname":"b4d423fccd64","name":"SteamCommunityHealth","message":"Executing api request","requestId":414,"url":"https://steamcommunity.com/market/mylistings?count=100"}
GOT RESPONSE FROM STEAM: {"statusCode":200,"headers":{"server":"nginx","content-type":"application/json; charset=utf-8","x-frame-options":"DENY","expires":"Mon, 26 Jul 1997 05:00:00 GMT","cache-control":"no-cache","content-encoding":"gzip","vary":"Accept-Encoding","content-length":"421","date":"Fri, 28 Mar 2025 03:59:47 GMT","connection":"keep-alive"}}
{"level":30,"time":1743134387438,"pid":35,"hostname":"b4d423fccd64","name":"SteamCommunityHealth","message":"Api request succeeded","requestId":414}
{"level":30,"time":1743134400743,"pid":35,"hostname":"b4d423fccd64","name":"SteamClient","msg":"[W1] WebSocket closed by remote with code 1006 and reason \"Socket closed\""}
{"level":30,"time":1743134400744,"pid":35,"hostname":"b4d423fccd64","name":"SteamClient","msg":"[W1] Handling connection close"}
{"level":30,"time":1743134400747,"pid":35,"hostname":"b4d423fccd64","name":"SteamClient","msg":"Disconnecting without sending logoff"}
{"level":30,"time":1743134400747,"pid":35,"hostname":"b4d423fccd64","name":"SteamClient","msg":"[W1] We wanted to end connection, but it's not connected or connecting"}
{"level":30,"time":1743134400747,"pid":35,"hostname":"b4d423fccd64","name":"SteamClient","msg":"[EBO] Queueing exponential backoff \"logOn\" with timeout 1000"}
{"level":30,"time":1743134401816,"pid":35,"hostname":"b4d423fccd64","name":"SteamClient","msg":"API GET request to https://api.steampowered.com/ISteamDirectory/GetCMListForConnect/v0001/?format=vdf&cellid=90: 200"}
{"level":30,"time":1743134401854,"pid":35,"hostname":"b4d423fccd64","name":"SteamClient","msg":"Randomly chose websockets server cmp1-fra2.steamserver.net:27024 (load = 10, wtd_load = 4.51238775253295898)"}
{"level":30,"time":1743134401855,"pid":35,"hostname":"b4d423fccd64","name":"SteamClient","msg":"[W2] Connecting to WebSocket CM cmp1-fra2.steamserver.net:27024"}
{"level":30,"time":1743134401890,"pid":35,"hostname":"b4d423fccd64","name":"SteamClient","msg":"[W2] WebSocket disconnected with error: connect ECONNREFUSED 155.133.229.4:27024"}
{"level":30,"time":1743134401890,"pid":35,"hostname":"b4d423fccd64","name":"SteamClient","msg":"[W2] Handling connection close"}
{"level":30,"time":1743134402891,"pid":35,"hostname":"b4d423fccd64","name":"SteamClient","msg":"[WebAPI] Using cached value for API_GET_https://api.steampowered.com/ISteamDirectory/GetCMListForConnect/v0001/"}{"level":30,"time":1743134405921,"pid":35,"hostname":"b4d423fccd64","name":"Express","message":"Api method invoked","request":{"path":"/getInventory","body":{}}}
{"level":30,"time":1743134405921,"pid":35,"hostname":"b4d423fccd64","name":"SteamClient","msg":"Dropping outgoing message 151 because we're not logged on."}

Albeit I am planning to hook into the debug message that steam-user/SteamClient emits to debug about Dropping outgoing message 151 because we're not logged on

That should be enough for me to raise a flag and force a hard restart, steam library doesn't seem to be stable enough anyway without external restarts and monitoring

But I presume here the debug doesn't come directly from steam-user itself, it's rather me trying to poke the steam APIs periodically and it somehow detecting that the session is gone

Noobgam avatar Mar 28 '25 07:03 Noobgam

I've looked at this several times but I've yet to be able to reproduce it. If anyone has any pointers on how to reproduce this, it would help a lot.

DoctorMcKay avatar Sep 25 '25 20:09 DoctorMcKay

All I can say is it seems random. I didn't have problems for months and months, now the last two maintenances it's got stuck. I get something more like the last debug log posted with the ECONNREFUSED. It doesn't keep retrying must give up after some time? I'll clip my next debug log if/when it happens and edit my message.

2weeks later, last night:

[Oct 06 2025 21:07:41] - DEBUG: [W3] WebSocket disconnected with error: Ping timeout
[Oct 06 2025 21:07:41] - DEBUG: [W3] Handling connection close
[Oct 06 2025 21:07:41] - DEBUG: Disconnecting without sending logoff
[Oct 06 2025 21:07:41] - DEBUG: [W3] We wanted to end connection, but it's not connected or connecting
[Oct 06 2025 21:07:41] - DEBUG: [EBO] Queueing exponential backoff "logOn" with timeout 1000
[Oct 06 2025 21:07:43] - DEBUG: API GET request to https://api.steampowered.com/ISteamDirectory/GetCMListForConnect/v0001/?format=vdf&cellid=50: 200
[Oct 06 2025 21:07:43] - DEBUG: Randomly chose websockets server cmp1-atl3.steamserver.net:27018 (load = 26, wtd_load = 25.8077007979154587)
[Oct 06 2025 21:07:43] - DEBUG: [W4] Connecting to WebSocket CM cmp1-atl3.steamserver.net:27018
[Oct 06 2025 21:07:44] - DEBUG: [W4] WS connection timed out
[Oct 06 2025 21:07:44] - DEBUG: [WebAPI] Using cached value for API_GET_https://api.steampowered.com/ISteamDirectory/GetCMListForConnect/v0001/
[Oct 06 2025 21:07:44] - DEBUG: Randomly chose websockets server cmp2-atl3.steamserver.net:27018 (load = 27, wtd_load = 25.4020159244537354)
[Oct 06 2025 21:07:44] - DEBUG: [W5] Connecting to WebSocket CM cmp2-atl3.steamserver.net:27018
[Oct 06 2025 21:07:46] - DEBUG: [W5] WS connection timed out
[Oct 06 2025 21:07:46] - DEBUG: [WebAPI] Using cached value for API_GET_https://api.steampowered.com/ISteamDirectory/GetCMListForConnect/v0001/
[Oct 06 2025 21:07:46] - DEBUG: Randomly chose websockets server cmp1-atl3.steamserver.net:27018 (load = 26, wtd_load = 25.8077007979154587)
[Oct 06 2025 21:07:46] - DEBUG: [W6] Connecting to WebSocket CM cmp1-atl3.steamserver.net:27018
[Oct 06 2025 21:07:50] - DEBUG: [W6] WS connection timed out
[Oct 06 2025 21:07:50] - DEBUG: [WebAPI] Using cached value for API_GET_https://api.steampowered.com/ISteamDirectory/GetCMListForConnect/v0001/
[Oct 06 2025 21:07:50] - DEBUG: Randomly chose websockets server cmp1-atl3.steamserver.net:27018 (load = 26, wtd_load = 25.8077007979154587)
[Oct 06 2025 21:07:50] - DEBUG: [W7] Connecting to WebSocket CM cmp1-atl3.steamserver.net:27018
[Oct 06 2025 21:07:56] - DEBUG: [W7] WebSocket disconnected with error: Response code 502
[Oct 06 2025 21:07:56] - DEBUG: [W7] Handling connection close
[Oct 06 2025 21:07:57] - DEBUG: [WebAPI] Using cached value for API_GET_https://api.steampowered.com/ISteamDirectory/GetCMListForConnect/v0001/

Yesterdays maint it failed to reconnect again, and this morning about a half hour ago it disconnected (NoConnection (3)) and has not reconnected automatically. I re-ran logOn and it was back up. I tried increasing max retries in 09-logon.js and the max timeout delay in websocket.js but that did not change anything.

[Nov 05 2025 07:20:54] - DEBUG: [W1#60] Handled message: ClientClanState
[Nov 05 2025 07:30:00] - DEBUG: [W1] WebSocket closed by remote with code 1006 and reason "Socket closed"
[Nov 05 2025 07:30:00] - DEBUG: [W1] Handling connection close
[Nov 05 2025 07:30:00] - DEBUG: Disconnecting without sending logoff
[Nov 05 2025 07:30:00] - DEBUG: [W1] We wanted to end connection, but it's not connected or connecting
[Nov 05 2025 07:30:00] - DEBUG: [EBO] Queueing exponential backoff "logOn" with timeout 1000
[Nov 05 2025 07:30:01] - DEBUG: API GET request to https://api.steampowered.com/ISteamDirectory/GetCMListForConnect/v0001/?format=vdf&cellid=50: 200
[Nov 05 2025 07:30:01] - DEBUG: Randomly chose websockets server cmp2-atl3.steamserver.net:27018 (load = 15, wtd_load = 10.6649665832519531)
[Nov 05 2025 07:30:01] - DEBUG: [W2] Connecting to WebSocket CM cmp2-atl3.steamserver.net:27018
[Nov 05 2025 07:30:01] - DEBUG: [W2] WebSocket disconnected with error: connect ECONNREFUSED 162.254.199.184:27018
[Nov 05 2025 07:30:01] - DEBUG: [W2] Handling connection close
[Nov 05 2025 07:30:02] - DEBUG: [WebAPI] Using cached value for API_GET_https://api.steampowered.com/ISteamDirectory/GetCMListForConnect/v0001/

hamilton5 avatar Sep 26 '25 15:09 hamilton5