Error: listen EADDRINUSE 0.0.0.0:4800 Looks like your connection to NodeBB was lost, please wait while we try to reconnect.

Solved Technical Support
  • Hi. I got the problem, that my NodeBB forum always tries to reconnect.
    I get the following message:

    Looks like your connection to NodeBB was lost, please wait while we try to reconnect.

    OS: ‪Ubuntu 16.04.3 LTS‬
    Node version: 8.6.0
    NodeJS version: 8.60
    MongoDB version: v3.2.17
    Apache version: 2.4.18 (Ubuntu)

    My config.json for Nodebb:

    {
    "url": "http://localhost:4800",
    "secret": "XXXXXXXXXXXXXXXXX",
    "database": "mongo",
    "port": 4800,
    "mongo": {
    "host": "127.0.0.1",
    "port": "27017",
    "username": "nodebb",
    "password": "XXXXXXXXXXXXXXXXX",
    "database": "nodebb"
    }
    }

    My Apache2 CUSTOM.conf file (proxy to the NodeBB application), looks like this:

    ProxyPass / http://localhost:4800/

    The failing request:
    https://mywebsite.com/socket.io/?EIO=3&transport=polling&t=LxYcD5G

    I could not find out which other application may uses this port. I tried the default port 4567 as well, same error.

    How can I fix this or which information is needed to figure out what the problem actually is ?

    Error log (./nodebb dev):

    • 3/10 16:11:32 [1757] - verbose: * using configuration stored in: /root/nodebb/config.json
      3/10 16:11:32 [1757] - info: Initializing NodeBB v1.6.0 http://localhost:4800
      3/10 16:11:32 [1757] - verbose: * using mongo store at 127.0.0.1:27017
      3/10 16:11:32 [1757] - verbose: * using themes stored in: /root/nodebb/node_modules
      3/10 16:11:32 [1757] - verbose: [minifier] utilizing a maximum of 3 additional threads
      3/10 16:11:32 [1757] - verbose: Checking dependencies for outdated modules
      3/10 16:11:33 [1757] - verbose: [notifications.init] Registering jobs.
      3/10 16:11:33 [1757] - verbose: [user/jobs] (Re-)starting user jobs...
      3/10 16:11:33 [1757] - verbose: [user/jobs] Starting job (digest.daily)
      3/10 16:11:33 [1757] - verbose: [user/jobs] Starting job (digest.weekly)
      3/10 16:11:33 [1757] - verbose: [user/jobs] Starting job (digest.monthly)
      3/10 16:11:33 [1757] - verbose: [user/jobs] Starting job (reset.clean)
      3/10 16:11:33 [1757] - verbose: [user/jobs] 4 jobs started
      3/10 16:11:33 [1757] - info: [themes] Using theme nodebb-theme-persona
      3/10 16:11:33 [1757] - verbose: [plugins] Initializing plugins system
      3/10 16:11:33 [1757] - verbose: [plugins] Loaded plugin: nodebb-plugin-composer-default
      3/10 16:11:33 [1757] - verbose: [plugins] Loaded plugin: nodebb-theme-persona
      3/10 16:11:33 [1757] - verbose: [plugins] Loaded plugin: nodebb-plugin-markdown
      3/10 16:11:33 [1757] - verbose: [plugins] Loaded plugin: nodebb-plugin-mentions
      3/10 16:11:33 [1757] - verbose: [plugins] Loaded plugin: nodebb-widget-essentials
      3/10 16:11:33 [1757] - verbose: [plugins] Loaded plugin: nodebb-rewards-essentials
      3/10 16:11:33 [1757] - verbose: [plugins] Found 3 sound file(s) for plugin nodebb-plugin-soundpack-default
      3/10 16:11:33 [1757] - verbose: [plugins] Loaded plugin: nodebb-plugin-soundpack-default
      3/10 16:11:33 [1757] - verbose: [plugins] Loaded plugin: nodebb-plugin-emoji-extended
      3/10 16:11:33 [1757] - verbose: [plugins] Loaded plugin: nodebb-plugin-emoji-one
      3/10 16:11:33 [1757] - info: [plugins] Plugins OK
      3/10 16:11:33 [1757] - verbose: [hotswap] Router with id plugins replaced successfully
      3/10 16:11:33 [1757] - verbose: [plugins] All plugins reloaded and rerouted
      3/10 16:11:33 [1757] - verbose: [hotswap] Router with id auth replaced successfully
      3/10 16:11:33 [1757] - info: Routes added
      3/10 16:11:33 [1757] - verbose: [meta/blacklist] Loading 0 blacklist rules
      3/10 16:11:33 [1757] - info: NodeBB Ready
      3/10 16:11:33 [1757] - info: Enabling 'trust proxy'
      3/10 16:11:33 [1757] - error: Error: listen EADDRINUSE 0.0.0.0:4800
      at Object._errnoException (util.js:1019:11)
      at _exceptionWithHostPort (util.js:1041:20)
      at Server.setupListenHandle [as _listen2] (net.js:1344:14)
      at listenInCluster (net.js:1385:12)
      at doListen (net.js:1494:7)
      at _combinedTickCallback (internal/process/next_tick.js:141:11)
      at process._tickCallback (internal/process/next_tick.js:180:9)
      3/10 16:11:33 [1757] - error: NodeBB address in use, exiting...
      [cluster] Child Process (1757) has exited (code: 1, signal: null)
      [cluster] Spinning up another process...
      3/10 16:11:33 [1770] - verbose: * using configuration stored in: /root/nodebb/config.json
      3/10 16:11:33 [1770] - info: Initializing NodeBB v1.6.0 http://localhost:4800
      3/10 16:11:33 [1770] - verbose: * using mongo store at 127.0.0.1:27017
      3/10 16:11:33 [1770] - verbose: * using themes stored in: /root/nodebb/node_modules
      3/10 16:11:34 [1770] - verbose: [minifier] utilizing a maximum of 3 additional threads
      3/10 16:11:34 [1770] - verbose: Checking dependencies for outdated modules
      3/10 16:11:34 [1770] - verbose: [notifications.init] Registering jobs.
      3/10 16:11:34 [1770] - verbose: [user/jobs] (Re-)starting user jobs...
      3/10 16:11:34 [1770] - verbose: [user/jobs] Starting job (digest.daily)
      3/10 16:11:34 [1770] - verbose: [user/jobs] Starting job (digest.weekly)
      3/10 16:11:34 [1770] - verbose: [user/jobs] Starting job (digest.monthly)
      3/10 16:11:34 [1770] - verbose: [user/jobs] Starting job (reset.clean)
      3/10 16:11:34 [1770] - verbose: [user/jobs] 4 jobs started
      3/10 16:11:34 [1770] - info: [themes] Using theme nodebb-theme-persona
      3/10 16:11:34 [1770] - verbose: [plugins] Initializing plugins system
      3/10 16:11:34 [1770] - verbose: [plugins] Loaded plugin: nodebb-plugin-composer-default
      3/10 16:11:34 [1770] - verbose: [plugins] Loaded plugin: nodebb-theme-persona
      3/10 16:11:34 [1770] - verbose: [plugins] Loaded plugin: nodebb-plugin-markdown
      3/10 16:11:34 [1770] - verbose: [plugins] Loaded plugin: nodebb-plugin-mentions
      3/10 16:11:34 [1770] - verbose: [plugins] Loaded plugin: nodebb-widget-essentials
      3/10 16:11:34 [1770] - verbose: [plugins] Loaded plugin: nodebb-rewards-essentials
      3/10 16:11:34 [1770] - verbose: [plugins] Found 3 sound file(s) for plugin nodebb-plugin-soundpack-default
      3/10 16:11:34 [1770] - verbose: [plugins] Loaded plugin: nodebb-plugin-soundpack-default
      3/10 16:11:35 [1770] - verbose: [plugins] Loaded plugin: nodebb-plugin-emoji-extended
      3/10 16:11:35 [1770] - verbose: [plugins] Loaded plugin: nodebb-plugin-emoji-one
      3/10 16:11:35 [1770] - info: [plugins] Plugins OK
      3/10 16:11:35 [1770] - verbose: [hotswap] Router with id plugins replaced successfully
      3/10 16:11:35 [1770] - verbose: [plugins] All plugins reloaded and rerouted
      3/10 16:11:35 [1770] - verbose: [hotswap] Router with id auth replaced successfully
      3/10 16:11:35 [1770] - info: Routes added
      3/10 16:11:35 [1770] - verbose: [meta/blacklist] Loading 0 blacklist rules
      3/10 16:11:35 [1770] - info: NodeBB Ready
      3/10 16:11:35 [1770] - info: Enabling 'trust proxy'
      3/10 16:11:35 [1770] - error: Error: listen EADDRINUSE 0.0.0.0:4800
      at Object._errnoException (util.js:1019:11)
      at _exceptionWithHostPort (util.js:1041:20)
      at Server.setupListenHandle [as _listen2] (net.js:1344:14)
      at listenInCluster (net.js:1385:12)
      at doListen (net.js:1494:7)
      at _combinedTickCallback (internal/process/next_tick.js:141:11)
      at process._tickCallback (internal/process/next_tick.js:180:9)
      3/10 16:11:35 [1770] - error: NodeBB address in use, exiting...
      [cluster] Child Process (1770) has exited (code: 1, signal: null)
      [cluster] Spinning up another process...
      3/10 16:11:35 [1783] - verbose: * using configuration stored in: /root/nodebb/config.json
      3/10 16:11:35 [1783] - info: Initializing NodeBB v1.6.0 http://localhost:4800
      3/10 16:11:35 [1783] - verbose: * using mongo store at 127.0.0.1:27017
      3/10 16:11:35 [1783] - verbose: * using themes stored in: /root/nodebb/node_modules
      3/10 16:11:36 [1783] - verbose: [minifier] utilizing a maximum of 3 additional threads
      3/10 16:11:36 [1783] - verbose: Checking dependencies for outdated modules
      3/10 16:11:36 [1783] - verbose: [notifications.init] Registering jobs.
      3/10 16:11:36 [1783] - verbose: [user/jobs] (Re-)starting user jobs...
      3/10 16:11:36 [1783] - verbose: [user/jobs] Starting job (digest.daily)
      3/10 16:11:36 [1783] - verbose: [user/jobs] Starting job (digest.weekly)
      3/10 16:11:36 [1783] - verbose: [user/jobs] Starting job (digest.monthly)
      3/10 16:11:36 [1783] - verbose: [user/jobs] Starting job (reset.clean)
      3/10 16:11:36 [1783] - verbose: [user/jobs] 4 jobs started
      3/10 16:11:36 [1783] - info: [themes] Using theme nodebb-theme-persona
      3/10 16:11:36 [1783] - verbose: [plugins] Initializing plugins system
      3/10 16:11:36 [1783] - verbose: [plugins] Loaded plugin: nodebb-plugin-composer-default
      3/10 16:11:36 [1783] - verbose: [plugins] Loaded plugin: nodebb-theme-persona
      3/10 16:11:36 [1783] - verbose: [plugins] Loaded plugin: nodebb-plugin-markdown
      3/10 16:11:36 [1783] - verbose: [plugins] Loaded plugin: nodebb-plugin-mentions
      3/10 16:11:36 [1783] - verbose: [plugins] Loaded plugin: nodebb-widget-essentials
      3/10 16:11:36 [1783] - verbose: [plugins] Loaded plugin: nodebb-rewards-essentials
      3/10 16:11:36 [1783] - verbose: [plugins] Found 3 sound file(s) for plugin nodebb-plugin-soundpack-default
      3/10 16:11:36 [1783] - verbose: [plugins] Loaded plugin: nodebb-plugin-soundpack-default
      3/10 16:11:36 [1783] - verbose: [plugins] Loaded plugin: nodebb-plugin-emoji-extended
      3/10 16:11:36 [1783] - verbose: [plugins] Loaded plugin: nodebb-plugin-emoji-one
      3/10 16:11:36 [1783] - info: [plugins] Plugins OK
      3/10 16:11:36 [1783] - verbose: [hotswap] Router with id plugins replaced successfully
      3/10 16:11:36 [1783] - verbose: [plugins] All plugins reloaded and rerouted
      3/10 16:11:36 [1783] - verbose: [hotswap] Router with id auth replaced successfully
      3/10 16:11:36 [1783] - info: Routes added
      3/10 16:11:36 [1783] - verbose: [meta/blacklist] Loading 0 blacklist rules
      3/10 16:11:36 [1783] - info: NodeBB Ready
      3/10 16:11:36 [1783] - info: Enabling 'trust proxy'
      3/10 16:11:36 [1783] - error: Error: listen EADDRINUSE 0.0.0.0:4800
      at Object._errnoException (util.js:1019:11)
      at _exceptionWithHostPort (util.js:1041:20)
      at Server.setupListenHandle [as _listen2] (net.js:1344:14)
      at listenInCluster (net.js:1385:12)
      at doListen (net.js:1494:7)
      at _combinedTickCallback (internal/process/next_tick.js:141:11)
      at process._tickCallback (internal/process/next_tick.js:180:9)
      3/10 16:11:36 [1783] - error: NodeBB address in use, exiting...
      [cluster] Child Process (1783) has exited (code: 1, signal: null)
      [cluster] Spinning up another process...
      3/10 16:11:37 [1798] - verbose: * using configuration stored in: /root/nodebb/config.json
      3/10 16:11:37 [1798] - info: Initializing NodeBB v1.6.0 http://localhost:4800
      3/10 16:11:37 [1798] - verbose: * using mongo store at 127.0.0.1:27017
      3/10 16:11:37 [1798] - verbose: * using themes stored in: /root/nodebb/node_modules
      3/10 16:11:38 [1798] - verbose: [minifier] utilizing a maximum of 3 additional threads
      3/10 16:11:38 [1798] - verbose: Checking dependencies for outdated modules
      3/10 16:11:38 [1798] - verbose: [notifications.init] Registering jobs.
      3/10 16:11:38 [1798] - verbose: [user/jobs] (Re-)starting user jobs...
      3/10 16:11:38 [1798] - verbose: [user/jobs] Starting job (digest.daily)
      3/10 16:11:38 [1798] - verbose: [user/jobs] Starting job (digest.weekly)
      3/10 16:11:38 [1798] - verbose: [user/jobs] Starting job (digest.monthly)
      3/10 16:11:38 [1798] - verbose: [user/jobs] Starting job (reset.clean)
      3/10 16:11:38 [1798] - verbose: [user/jobs] 4 jobs started
      3/10 16:11:38 [1798] - info: [themes] Using theme nodebb-theme-persona
      3/10 16:11:38 [1798] - verbose: [plugins] Initializing plugins system
      3/10 16:11:38 [1798] - verbose: [plugins] Loaded plugin: nodebb-plugin-composer-default
      3/10 16:11:38 [1798] - verbose: [plugins] Loaded plugin: nodebb-theme-persona
      3/10 16:11:38 [1798] - verbose: [plugins] Loaded plugin: nodebb-plugin-markdown
      3/10 16:11:38 [1798] - verbose: [plugins] Loaded plugin: nodebb-plugin-mentions
      3/10 16:11:38 [1798] - verbose: [plugins] Loaded plugin: nodebb-widget-essentials
      3/10 16:11:38 [1798] - verbose: [plugins] Loaded plugin: nodebb-rewards-essentials
      3/10 16:11:38 [1798] - verbose: [plugins] Found 3 sound file(s) for plugin nodebb-plugin-soundpack-default
      3/10 16:11:38 [1798] - verbose: [plugins] Loaded plugin: nodebb-plugin-soundpack-default
      3/10 16:11:38 [1798] - verbose: [plugins] Loaded plugin: nodebb-plugin-emoji-extended
      3/10 16:11:38 [1798] - verbose: [plugins] Loaded plugin: nodebb-plugin-emoji-one
      3/10 16:11:38 [1798] - info: [plugins] Plugins OK
      3/10 16:11:38 [1798] - verbose: [hotswap] Router with id plugins replaced successfully
      3/10 16:11:38 [1798] - verbose: [plugins] All plugins reloaded and rerouted
      3/10 16:11:38 [1798] - verbose: [hotswap] Router with id auth replaced successfully
      3/10 16:11:38 [1798] - info: Routes added
      3/10 16:11:38 [1798] - verbose: [meta/blacklist] Loading 0 blacklist rules
      3/10 16:11:38 [1798] - info: NodeBB Ready
      3/10 16:11:38 [1798] - info: Enabling 'trust proxy'
      3/10 16:11:38 [1798] - error: Error: listen EADDRINUSE 0.0.0.0:4800
      at Object._errnoException (util.js:1019:11)
      at _exceptionWithHostPort (util.js:1041:20)
      at Server.setupListenHandle [as _listen2] (net.js:1344:14)
      at listenInCluster (net.js:1385:12)
      at doListen (net.js:1494:7)
      at _combinedTickCallback (internal/process/next_tick.js:141:11)
      at process._tickCallback (internal/process/next_tick.js:180:9)
      3/10 16:11:38 [1798] - error: NodeBB address in use, exiting...
      3 restarts in 10 seconds, most likely an error on startup. Halting.
  • The relevant information is right there

    error: NodeBB address in use, exiting...

    Search "kill process on port"

  • @pitaj said in Error: listen EADDRINUSE 0.0.0.0:4800 Looks like your connection to NodeBB was lost, please wait while we try to reconnect.:

    The relevant information is right there

    error: NodeBB address in use, exiting...

    Search "kill process on port"

    Thank you, I will try that.

  • @PitaJ that did not work but I found out why I've had the error.
    The error EADDRINUSE 0.0.0.0:4800 occured because I had a nodebb instance running and used ./nodebb dev.

    If I only run ./nodebb dev then it works perfectly, but with ./nodebb start I always get the
    the problem:
    Looks like your connection to NodeBB was lost, please wait while we try to reconnect.

    Any other idea?

  • @Verso If you run ./nodebb start, you have to run ./nodebb stop to stop NodeBB, otherwise starting it again will result in the EADDRINUSE error, even with ./nodebb dev.

    Sometimes you can start NodeBB and it might lose the pointer to the running process, meaning you'll have to use a tool like ps to find the process and kill it.

    Run ps aux | grep node, and kill all of the NodeBB related processes like loader.js and app.js, then run ./nodebb start, and you should be set.

  • Hi @julian I tried that - still get the error. I restarted the Virtual Server several times, killed all processes - no success.

    Is it possible that Apache causes this error?
    I use proxypass to redirect the requests to the NodeBB Application

  • @julian @PitaJ

    I tried it again and found out that ./nodebb dev runs perfectly and without the " Looks like your connection to NodeBB was lost, please wait while we try to reconnect." error:

    ./nodebb stop

    lsof -i tcp:THEPORTIUSE

    kill -9 PROCESSID

    lsof -i tcp:THEPORTIUSE

    ./nodebb dev

    But it does not work if I want to run it normally by using /.nodebb start

    How to get it fixed ? 😞

    alt text

  • @verso make sure that the URL value in config.json is set to the URL at which your access the site in your browser

  • @pitaj damn.. that fixed my problem. I didn't know that one has to write the 1:1 url you call in your browser as the config.json url setting..

    So instead of:

    {
    "url": "http://localhost:4800",
    "secret": "XXXXXXXXXXXXXXXXX",
    "database": "mongo",
    "port": 4800,
    "mongo": {
    "host": "127.0.0.1",
    "port": "27017",
    "username": "nodebb",
    "password": "XXXXXXXXXXXXXXXXX",
    "database": "nodebb"
    }
    }

    I wrote:

    {
    "url": "http://MYWEBSITE.COM",
    "secret": "XXXXXXXXXXXXXXXXX",
    "database": "mongo",
    "port": 4800,
    "mongo": {
    "host": "127.0.0.1",
    "port": "27017",
    "username": "nodebb",
    "password": "XXXXXXXXXXXXXXXXX",
    "database": "nodebb"
    }
    }

    if you use https, of course the url has to be https://...
    1:1 as if you would call it in your browser. thank you very much!


Suggested Topics