Solved Forum down after restart

  • NodeBB Admin

  • @baris thanks. I removed NodeJS and reinstalled it using 14.x version. NodeBB now looks like it starts using the daemon (according to the logs, although if I try nodebb stop it tells me NodeBB is already stopped), and I get 502 bad gateway - but nothing has changed in terms of overall directory structure and nginx config.

    So it looks like whilst the original odd message has cleared, it's not starting

    My other NodeBB site works fine

  • @phenomlab could you try deleting your log file and starting with ./nodebb slog again?

  • @pitaj doesn't seem to do anything other than this

    Starting NodeBB with logging output
    Hit Ctrl-C to exit
    The NodeBB process will continue to run in the background
    Use "./nodebb stop" to stop the NodeBB server
    tail: cannot open './logs/output.log' for reading: No such file or directory
    tail: './logs/output.log' has appeared;  following new file

  • At this point, I'm totally stumped. The only other option I have available is to create a new instance and attach the current database to that to see if this resolves the issue or not.

    Failing that, I'm at a total loss here.

  • @PitaJ @baris I've been looking into this more, and but when I start NodeBB I get this message

    2021-09-26T19:52:22.547Z [4567/349055] - info: Enabling 'trust proxy'
    2021-09-26T19:52:22.550Z [4567/349055] - error: NodeBB address in use, exiting...
    Error: listen EADDRINUSE: address already in use
        at Server.setupListenHandle [as _listen2] (net.js:1320:16)
        at listenInCluster (net.js:1368:12)
        at doListen (net.js:1505:7)
        at processTicksAndRejections (internal/process/task_queues.js:83:21)
    2021-09-26T19:52:22.552Z [4567/349055] - error: uncaughtException: listen EADDRINUSE: address already in use
    Error: listen EADDRINUSE: address already in use
    3 restarts in 10 seconds, most likely an error on startup. Halting.

    The problem is, the port isn't actively being used anywhere. I have another NodeBB instance running on 4568, but that's it.

    Any thoughts ?


  • @phenomlab I don't know what to tell you. It's not lying about the address being in use.

    Does it work if you run node app? If not, it's definitely a rogue process left running on that port.

  • @pitaj thanks. Found the rogue process, and now I'm stuck with this.

    [email protected]:~/nodebb$ ./nodebb start && ./nodebb log
    Starting NodeBB
      "./nodebb stop" to stop the NodeBB server
      "./nodebb log" to view server output
      "./nodebb help" for more commands
    Hit Ctrl-C to exit
        at processTicksAndRejections (internal/process/task_queues.js:83:21)
    2021-09-26T20:43:20.339Z [4567/2900] - info: [app] Shutdown (SIGTERM/SIGINT) Initialised.
    2021-09-26T20:43:20.340Z [4567/2900] - error: Error [ERR_SERVER_NOT_RUNNING]: Server is not running.
        at Server.close (net.js:1608:12)
        at Object.onceWrapper (events.js:519:28)
        at Server.emit (events.js:412:35)
        at emitCloseNT (net.js:1661:8)
        at processTicksAndRejections (internal/process/task_queues.js:81:21)
    2021-09-26T20:43:20.346Z [4567/2893] - info: [reputation-rules] settings loaded
    3 restarts in 10 seconds, most likely an error on startup. Halting.

    So it looks like the process spawns and then immediately crashes. Trouble is I don't know where. It even does this with all plugins disabled.

  • @pitaj said in Forum down after restart:

    Does it work if you run node app?


    [email protected]:~/nodebb$ node app
    2021-09-26T21:37:41.594Z [4567/5912] - info: NodeBB v1.18.3 Copyright (C) 2013-2021 NodeBB Inc.
    2021-09-26T21:37:41.596Z [4567/5912] - info: This program comes with ABSOLUTELY NO WARRANTY.
    2021-09-26T21:37:41.596Z [4567/5912] - info: This is free software, and you are welcome to redistribute it under certain conditions.
    2021-09-26T21:37:41.596Z [4567/5912] - info: 
    2021-09-26T21:37:41.597Z [4567/5912] - info: Initializing NodeBB v1.18.3
    2021-09-26T21:37:43.378Z [4567/5912] - info: [] Restricting access to origin:*
    2021-09-26T21:37:43.808Z [4567/5912] - warn: [plugins/load] The following plugins may not be compatible with your version of NodeBB. This may cause unintended behaviour or crashing. In the event of an unresponsive NodeBB caused by this plugin, run `./nodebb reset -p PLUGINNAME` to disable it.
      * nodebb-plugin-emoji
    2021-09-26T21:37:43.931Z [4567/5912] - info: [plugins/spam-be-gone] Settings loaded
    2021-09-26T21:37:43.943Z [4567/5912] - info: [reputation-rules] settings loaded
    2021-09-26T21:37:43.971Z [4567/5912] - info: [api] Adding 1 route(s) to `api/v3/plugins`
    2021-09-26T21:37:43.999Z [4567/5912] - info: [router] Routes added
    2021-09-26T21:37:44.007Z [4567/5912] - info: NodeBB Ready
    2021-09-26T21:37:44.009Z [4567/5912] - info: Enabling 'trust proxy'
    2021-09-26T21:37:44.013Z [4567/5912] - info: NodeBB is now listening on:

  • Does it still work with daemon:false or does that no longer help?

  • @pitaj that works fine

    The only issue of course is that when performing a restart from the ACP I have to kill the process and restart it manually

  • @phenomlab it must be something to do with the daemon stuff.

    Can you try adding console.logs through there to try and find where the script stops executing for you?

  • @pitaj I found this discussion from a while ago and it seems to be my exact issue. Sadly, there never was a fix provided

  • Interestingly, ./nodebb slog works (but doesn't survive a rebuild and restart) fine, but I still need to leave this running as it isn't a daemon

  • @phenomlab ./nodebb slog just runs ./nodebb start then shows the log with tail. Nothing fancy. When you quit the command, you're just exiting tail, NodeBB isn't stopped.

    The "production" equivalent of ./nodebb dev is node app. There are many ways you can set it up to run as a daemon. For instance, setting up a systemd service.

  • Community Rep

    This post is deleted!

  • @phenomlab Yo mon! Ye' be having just way too much fun!

    @pitaj said in Forum down after restart:

    There are many ways you can set it up to run as a daemon. For instance, setting up a systemd service.

    Which is probably the way to go if you're using a systemd based distro 😉

    Rock on! 🎸 🐕

  • @pitaj @gotwf thanks guys. Much appreciated. I'll go down this route - probably using systemd to create a service.

  • @PitaJ interestingly, after starting NodeBB using ./NodeBB slog, if I then execute ./NodeBB stop I get

    NodeBB is already stopped.

    So think it's correct to say that as far as the daemon is concerned, it's not running even though it actually is.

  • @phenomlab glad that'll work for you.

    Would you mind participating in some more debug for this down the line? There's an alternative package for starting the daemon that I'm wondering might work for you.

Suggested Topics

| | | |