Skip to content

Changing context causes clients to disconnect #393

@ottj

Description

@ottj

(I use the newest version with the changes of the fork from amandaJonesAway)

If I connect with an existing or new user they spawn in the immigration context. Upon exit the client gets disconnected:

`neohabitat-neohabitat-1 | - 2023/04/03 18:43:57.417 EVN cont (User.connectionDied:User.java:159) User 'user-testuser-7751387903278591649' connection died: TCP(2)

neohabitat-neohabitat-1 | debug: Elko port disconnected...
neohabitat-neohabitat-1 | debug: {Bridge being shutdown...}
neohabitat-neohabitat-1 | - 2023/04/03 18:43:57.441 EVN comm-cli : TCP(3) new connection from 172.18.0.4:32896
neohabitat-neohabitat-1 | debug: Server connection established on: 172.18.0.4:60228 (unknown)
neohabitat-neohabitat-1 | debug: Connecting: 172.18.0.4:1337 <-> 172.18.0.4:60228
neohabitat-neohabitat-1 | debug: Habitat client disconnected.
neohabitat-neohabitat-1 | debug: Client disconnected for Client 172.18.0.4:60228 (unknown), moving session to ASLEEP
neohabitat-neohabitat-1 | debug: Disconnecting Habiproxy connection on: 172.18.0.4:60228 (unknown)
neohabitat-neohabitat-1 | - 2023/04/03 18:43:57.456 EVN comm-cli : TCP(3) remote disconnect
neohabitat-neohabitat-1 | - 2023/04/03 18:43:57.459 EVN comm-cli : TCP(3) died: java.io.EOFException
neohabitat-neohabitat-1 | debug: Elko port disconnected...
neohabitat-neohabitat-1 | debug: {Bridge being shutdown...}
neohabitat-neohabitat-1 | warn: Error [ERR_STREAM_WRITE_AFTER_END]: write after end
neohabitat-neohabitat-1 | warn: Error [ERR_STREAM_WRITE_AFTER_END]: write after end
`

If I comment these 4 lines starting at 478 in Habitat2ElkoBridge and prevent any disconnect I can change contexts just fine:
` server.on('end', function() {

        Trace.debug('Elko port disconnected...');
        if (client) {
            Trace.debug("{Bridge being shutdown...}");
            // if (client.userName) {
            //     Users[client.userName].online = false;
            // }
            // client.end();
        }
    });

`
This is more of a hack than a proper fix, hence I did not create a PR. I was not able to trace the source problem yet.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions