smogon / pokemon-showdown

Pokémon battle simulator.
https://pokemonshowdown.com
MIT License
4.77k stars 2.79k forks source link

CRASH: ERROR: read ECONNRESET #8426

Closed derkaczda closed 3 years ago

derkaczda commented 3 years ago

I am working on a Pokemon battle agent and use the showdown server in a Docker setup and sometimes on server startup I get

showdown-server | RESTORE CHATROOM: lobby showdown-server | RESTORE CHATROOM: staff showdown-server | showdown-server | CRASH: Error: read ECONNRESET showdown-server | at Pipe.onStreamRead (node:internal/stream_base_commons:211:20) showdown-server | at Pipe.callbackTrampoline (node:internal/async_hooks:130:17) showdown-server | showdown-server | Worker 1 now listening on 0.0.0.0:8081 showdown-server | Test your server at http://localhost:8081

It seems like the server still starts but challenging a user does not work anymore. I cannot find the code location where this could happen because the error is not very helpful for me, does someone have a hint for me?

P.S.: this does not always happen but often enough to be a problem in my setup.

Zarel commented 3 years ago

ECONRESET means that a connection crashed. It can happen if you kill one of PS's processes for whatever reason, or if a process crashes (but for whatever reason didn't print a different error message before crashing).

It's possible that your Docker setup just doesn't allow as much RAM or process usage as PS needs?

derkaczda commented 3 years ago

Tried giving the Docker more resources but didn't help. I previously used an older commit where I didn't have this issue, let me try if I can narrow down where the problem appears the first time in the commit history.

AndrewYRevell commented 3 years ago

I get something similar and don't know where to pintpoint the issue. I am on an Ubuntu 20.04 machine and getting the same error on node js v14 and 16. Any help would be much appreciated!

node pokemon-showdown start --no-security

RESTORE CHATROOM: lobby RESTORE CHATROOM: staff Could not start REPL server "friends-10544": Your filesystem doesn't support Unix sockets (everything else will still work)

CRASH: Error: ENOENT: no such file or directory, scandir '/home/name/Documents/pokemon-showdown/logs/repl' at Object.readdirSync (node:fs:1390:3) at _class.start (/home/name/Documents/pokemon-showdown/lib/repl.ts:76:26) at Object. (/home/name/Documents/pokemon-showdown/server/index.ts:178:6) at Module._compile (node:internal/modules/cjs/loader:1101:14) at Module.m._compile (/home/name/Documents/pokemon-showdown/node_modules/ts-node/src/index.ts:1310:23) at Module._extensions..js (node:internal/modules/cjs/loader:1153:10) at Object.require.extensions. [as .ts] (/home/name/Documents/pokemon-showdown/node_modules/ts-node/src/index.ts:1313:12) at Module.load (node:internal/modules/cjs/loader:981:32) at Function.Module._load (node:internal/modules/cjs/loader:822:12) at Object. (/home/name/Documents/pokemon-showdown/pokemon-showdown:134:22)

Could not start REPL server "verifier": Your filesystem doesn't support Unix sockets (everything else will still work) Could not start REPL server "sim-10558": Your filesystem doesn't support Unix sockets (everything else will still work) Worker 1 now listening on 0.0.0.0:8000 Test your server at http://localhost:8000 Could not start REPL server "sockets-1-10572": Your filesystem doesn't support Unix sockets (everything else will still work) Could not start REPL server "chat-db": Your filesystem doesn't support Unix sockets (everything else will still work) Could not start REPL server "friends-10585": Your filesystem doesn't support Unix sockets (everything else will still work) Could not start REPL server "team-validator-10537": Your filesystem doesn't support Unix sockets (everything else will still work)

mia-pi-git commented 3 years ago

RESTORE CHATROOM: lobby RESTORE CHATROOM: staff Could not start REPL server "friends-10544": Your filesystem doesn't support Unix sockets (everything else will still work)

CRASH: Error: ENOENT: no such file or directory, scandir '/home/name/Documents/pokemon-showdown/logs/repl' at Object.readdirSync (node:fs:1390:3) at _class.start (/home/name/Documents/pokemon-showdown/lib/repl.ts:76:26) at Object. (/home/name/Documents/pokemon-showdown/server/index.ts:178:6) at Module._compile (node:internal/modules/cjs/loader:1101:14) at Module.m._compile (/home/name/Documents/pokemon-showdown/node_modules/ts-node/src/index.ts:1310:23) at Module._extensions..js (node:internal/modules/cjs/loader:1153:10) at Object.require.extensions. [as .ts] (/home/name/Documents/pokemon-showdown/node_modules/ts-node/src/index.ts:1313:12) at Module.load (node:internal/modules/cjs/loader:981:32) at Function.Module._load (node:internal/modules/cjs/loader:822:12) at Object. (/home/name/Documents/pokemon-showdown/pokemon-showdown:134:22)

Could not start REPL server "verifier": Your filesystem doesn't support Unix sockets (everything else will still work) Could not start REPL server "sim-10558": Your filesystem doesn't support Unix sockets (everything else will still work) Worker 1 now listening on 0.0.0.0:8000 Test your server at http://localhost:8000 Could not start REPL server "sockets-1-10572": Your filesystem doesn't support Unix sockets (everything else will still work) Could not start REPL server "chat-db": Your filesystem doesn't support Unix sockets (everything else will still work) Could not start REPL server "friends-10585": Your filesystem doesn't support Unix sockets (everything else will still work) Could not start REPL server "team-validator-10537": Your filesystem doesn't support Unix sockets (everything else will still work)

Set Config.repl to false to fix most of these.

AndrewYRevell commented 3 years ago

Wow thanks for the quick reply!

I do apologize, where do I set config.repl = False? Is it in the config/config.js file? I have tried adding config.repl = False or repl = False and it does not work. Not sure I am even understanding where to set it.

Thanks again! Currently I cannot start any battles locally and hope this solves it!

KrisXV commented 3 years ago

exports.repl = false;

AndrewYRevell commented 3 years ago

Great thanks to the both of you! I still get similar errors it seems. Here are screenshots below

image

image

image

AndrewYRevell commented 3 years ago

Anybody can help with this? It seems not to be a exports.repl = false; issue

Zarel commented 3 years ago

Is this the error fixed by 66a0497a8bbd5f3c?

Zarel commented 3 years ago

@mia-pi-git why does PS crash if the filesystem doesn't support Unix sockets? It's supposed to fall back

mia-pi-git commented 3 years ago

@mia-pi-git why does PS crash if the filesystem doesn't support Unix sockets? It's supposed to fall back

From what I can actually tell, this wasn't caused by lack of support, this crash was caused because the logs/ dir did not exist. Hence, in the setup function I had it create the directory. We can nuke the commit now that logs/ is back, I just made that commit as a stopgap while I wasn't sure if the logs/ removal was intentional or not.

Zarel commented 3 years ago

Okay, I'm going to close this under the assumption that 66a0497a8bbd5 fixes it.

(Feel free to reopen/comment if it's still an issue.)

Parnassius commented 2 years ago

Hi, I have the same error with a newly cloned instance, using node16 on linux:

``` > ./pokemon-showdown RESTORE CHATROOM: lobby RESTORE CHATROOM: staff CRASH: Error: read ECONNRESET at Pipe.onStreamRead (node:internal/stream_base_commons:220:20) at Pipe.callbackTrampoline (node:internal/async_hooks:130:17) Worker 1 now listening on 0.0.0.0:8000 Test your server at http://localhost:8000 ```

The crash seems to originate from the cleanup section of Repl.start: if I add a simple console.log(file); before that line it prints friends-<pid> just before crashing. That file didn't exist before starting pokemon showdown, so it seems that a friends-* socket is being created before the main app one.

glacialcascade commented 2 years ago

I have the same issue as Parnassius, node 18.2.0 on Manjaro kernel 5.15.41:

RESTORE CHATROOM: lobby
RESTORE CHATROOM: staff

CRASH: Error: read ECONNRESET
    at Pipe.onStreamRead (node:internal/stream_base_commons:217:20)
    at Pipe.callbackTrampoline (node:internal/async_hooks:130:17)

CRASH: Error: read ECONNRESET
    at Pipe.onStreamRead (node:internal/stream_base_commons:217:20)
    at Pipe.callbackTrampoline (node:internal/async_hooks:130:17)

CRASH: Error: read ECONNRESET
    at Pipe.onStreamRead (node:internal/stream_base_commons:217:20)
    at Pipe.callbackTrampoline (node:internal/async_hooks:130:17)

Worker 1 now listening on 0.0.0.0:8000
Test your server at http://localhost:8000
glacialcascade commented 2 years ago

logs/errors.txt has several instances of that in addition to some instances of

Error [ERR_IPC_DISCONNECTED]: IPC channel is already disconnected
    at new NodeError (node:internal/errors:377:5)
    at ChildProcess.disconnect (node:internal/child_process:890:26)
    at QueryProcessWrapper.destroy (/home/user/git/pokemon-showdown/lib/process-manager.ts:204:16)
    at QueryProcessWrapper.release (/home/user/git/pokemon-showdown/lib/process-manager.ts:190:9)
    at SQLDatabaseManager.releaseCrashed (/home/user/git/pokemon-showdown/lib/process-manager.ts:458:16)
    at ChildProcess.<anonymous> (/home/user/git/pokemon-showdown/lib/process-manager.ts:515:47)
    at ChildProcess.emit (node:events:527:28)
    at ChildProcess.emit (node:domain:475:12)
    at finish (node:internal/child_process:920:14)
    at processTicksAndRejections (node:internal/process/task_queues:77:11)