claabs / epicgames-freegames-node

Automatically login and find available free games the Epic Games Store. Sends you a prepopulated checkout link so you can complete the checkout after logging in. Supports multiple accounts, login sessions, and scheduled runs.
https://hub.docker.com/r/charlocharlie/epicgames-freegames
MIT License
1.39k stars 93 forks source link

ERROR: listen EADDRINUSE: address already in use :::3000 #356

Closed sam1310 closed 9 months ago

sam1310 commented 1 year ago

I didn't get a notification for today's free game, and noticed the following error in the docker log:

[2023-06-30 00:00:02.710 +1000] ERROR: listen EADDRINUSE: address already in use :::3000
    err: {
      "type": "Error",
      "message": "listen EADDRINUSE: address already in use :::3000",
      "stack":
          Error: listen EADDRINUSE: address already in use :::3000
              at Server.setupListenHandle [as _listen2] (node:net:1740:16)
              at listenInCluster (node:net:1788:12)
              at Server.listen (node:net:1876:7)
              at createServer (/usr/app/src/common/server.ts:31:19)
              at main (/usr/app/src/index.ts:75:38)
              at processTicksAndRejections (node:internal/process/task_queues:95:5)
      "code": "EADDRINUSE",
      "errno": -98,
      "syscall": "listen",
      "address": "::",
      "port": 3000
    }

No other container is using this port, and restarting the container fixed it.

claabs commented 1 year ago

I've been thinking over this and I can't come up with a solid reason that this would happen. My guess is that a previous run was still going when a second scheduled one started, but the container uses file locks to prevent that from happening.

If this happens to anyone again, I'd like more log context to understand what happened before the error.