neilenns / node-deepstackai-trigger

Detects motion using Deepstack AI and calls registered triggers based on trigger rules.
MIT License
167 stars 28 forks source link

Error: listen EADDRINUSE: address already in use :::4242 #323

Closed neilenns closed 4 years ago

neilenns commented 4 years ago

Error: listen EADDRINUSE: address already in use :::4242 gets thrown when hot reloading due to changes in the settings file. One way to reproduce it is to add enableAnnotations then remove it.

Error: listen EADDRINUSE: address already in use :::4242 at Server.setupListenHandle [as _listen2] (net.js:1313:16) at listenInCluster (net.js:1361:12) at Server.listen (net.js:1447:7) at Function.listen (/workspace/dist/node_modules/express/lib/application.js:618:24) at Object.startApp (/workspace/src/WebServer.ts:26:18) at /workspace/src/main.ts:77:17 at step (/workspace/dist/src/main.js:56:23) at Object.next (/workspace/dist/src/main.js:37:53) at fulfilled (/workspace/dist/src/main.js:28:58) at processTicksAndRejections (internal/process/task_queues.js:97:5)

neilenns commented 4 years ago

This is WebServer.startApp(); which is weird because shutdown() stops the web server. Possibly a race condition not waiting for server.close(); to complete?