frandallfarmer / neohabitat

Repository for the NeoClassical Habitat Server Project
http://neohabitat.org
MIT License
229 stars 41 forks source link

Pushserver is killing connections #408

Closed kevzettler closed 1 year ago

kevzettler commented 1 year ago

from slack: https://neohabitat.slack.com/archives/C3RHF1V09/p1684344961516179

I mentioned this earlier, but I'll make it clearer: The Bridge holds a connection (game session) open to a client (C64-via-Qlink OR JSON test/bot) while making a short-term JSON connection to ELKO/Neohabitat. The Elko/Game server breaks the short-term connection whenever the user moves between regions. When the Pushserver/Habiproxy is in place it sits between the bridge and the game, relaying messages and pushing state changes to web pages that are subscribed to an avatar's actions. It is SUPPOSED to have the same connection semantics as the Elko/Game server, but for some reason is not acting reasonably during region transitions (elko does a break, expecting the bridge to remake a new short-term JSON connection.) When using the Telko.js script on the default port, it will connect to the bridge, acting as a legit client and having the bridge keep the game session open across region transitions. When using Telko.js on port 2018 (the push server) with node Telko.js -p 2018 -f randy,region the bridge-keeps-session-alive semantics don't apply. If a bot/script tries to change regions, the bot/script will be shutdown as soon as Elko approves the region change and hangs up the connection.

Can reproduce by changing regions in the C64 emulator or by running test script with node Telko.js -f randy,region

you'll see logs like:

neohabitat-neohabitat-1         | debug: Client disconnected for Client 192.168.96.4:38018 (Randy), moving session to ASLEEP
neohabitat-neohabitat-1         | debug: Disconnecting Habiproxy connection on: 192.168.96.4:38018 (Randy)
neohabitat-neohabitat-1         | debug: Elko port disconnected...
neohabitat-neohabitat-1         | debug: {Bridge being shutdown...}
kevzettler commented 1 year ago

Have confirmed the pushserver error is stemming from connections on this socket https://github.com/frandallfarmer/neohabitat/blob/86f061e9d96e631e13cb4cc7a4264e9342fbb45e/pushserver/habiproxy/session.js#L197

Bubbling up and killing the pushserver process.

kevzettler commented 1 year ago

The HabiProxy has 2 connections