Skip to content

Unable to parse terminationTime from TerminateProcess message #3

@j1mmie

Description

@j1mmie

I know this repo is rather old, just saving this issue here for posterity. I hope I can submit a PR for it some day.

I'm seeing this error on live servers in GameLift:

2023-05-03T18:57:05.064Z engine.io-client:socket socket receive: type "message", data "2["TerminateProcess","{\n  \"terminationTime\": \"1683140584\"\n}"]"
2023-05-03T18:57:05.065Z socket.io-parser decoded 2["TerminateProcess","{\n  \"terminationTime\": \"1683140584\"\n}"] as {"type":2,"nsp":"/","data":["TerminateProcess","{\n  \"terminationTime\": \"1683140584\"\n}"]}
2023-05-03T18:57:05.067Z socket.io-client:socket emitting event ["TerminateProcess","{\n  \"terminationTime\": \"1683140584\"\n}"]
2023-05-03T18:57:05.068Z ServerState ServerState got the terminateProcess signal.  rawTerminationTime : {
  "terminationTime": "1683140584"
}
2023-05-03 11:57:05.070 INFO  GameLift: Process is exiting with code 1. Calling GameLiftServerAPI.Destroy() 
2023-05-03 11:57:05.071 INFO  GameLift: Disposing of GameLift 
2023-05-03 11:57:05.074 INFO  /local/game/server/node_modules/@dplusic/gamelift-nodejs-serversdk/src/Server/ServerState.ts:308
        this.terminationTime = deserialized.terminationTime.mul(1000 * 10000)
                                                            ^
2023-05-03 11:57:05.077 INFO  TypeError: deserialized.terminationTime.mul is not a function
    at ServerState.<anonymous> (/local/game/server/node_modules/@dplusic/gamelift-nodejs-serversdk/src/Server/ServerState.ts:308:61)
    at step (/local/game/server/node_modules/@dplusic/gamelift-nodejs-serversdk/dist/lib/Server/ServerState.js:32:23)
    at Object.next (/local/game/server/node_modules/@dplusic/gamelift-nodejs-serversdk/dist/lib/Server/ServerState.js:13:53)
    at /local/game/server/node_modules/@dplusic/gamelift-nodejs-serversdk/dist/lib/Server/ServerState.js:7:71
    at new Promise (<anonymous>)
    at __awaiter (/local/game/server/node_modules/@dplusic/gamelift-nodejs-serversdk/dist/lib/Server/ServerState.js:3:12)
    at /local/game/server/node_modules/@dplusic/gamelift-nodejs-serversdk/src/Server/ServerState.ts:293:7
    at ServerState.OnTerminateProcess (/local/game/server/node_modules/@dplusic/gamelift-nodejs-serversdk/src/Server/ServerState.ts:312:7)
    at Socket.<anonymous> (/local/game/server/node_modules/@dplusic/gamelift-nodejs-serversdk/src/Server/Network.ts:61:20)
    at Socket.Emitter.emit (/local/game/server/node_modules/component-emitter/index.js:145:20)

It appears that terminationTime is assumed to be a Long at this point. I'm not sure what the value actually is, but there could be some additional checks / conversions to avoid this error

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