Unsolved 502 Bad Gateway when using Purge Topic


  • I have setup a new NodeBB instance over at https://community.lifehousefans.net running v1.18.6 and have been testing things out. I came across an issue when attempting to remove a test topic I created.

    I can delete the topic just fine but when I go to purge it, I receive a Bad Gateway error and then the websocket appears to lose connection for a couple of seconds. I made 3 attempts to purge the topic and on the third attempt it threw an error that the topic didn’t exist.

    Screenshot:
    2BF8A44A-B5FC-4C89-B3ED-3C96ED258095.png

    Nginx error.log:

    Attempt #1: Bad Gateway

    2021/12/13 14:38:22 [error] 1176819#1176819: *74924 upstream prematurely closed connection while reading response header from upstream, client: 172.58.217.152, server: community.lifehousefans.net, request: "DELETE /api/v3/topics/3 HTTP/1.1", upstream: "http://127.0.0.1:4567/api/v3/topics/3", host: "community.lifehousefans.net", referrer: "https://community.lifehousefans.net/topic/3/another-test/3"
    2021/12/13 14:38:24 [error] 1176819#1176819: *74926 connect() failed (111: Connection refused) while connecting to upstream, client: 172.58.217.152, server: community.lifehousefans.net, request: "GET /socket.io/?EIO=4&transport=polling&t=NsqElr1 HTTP/1.1", upstream: "http://127.0.0.1:4567/socket.io/?EIO=4&transport=polling&t=NsqElr1", host: "community.lifehousefans.net", referrer: "https://community.lifehousefans.net/topic/3/another-test/3"
    

    Attempt #2: Bad Gateway

    2021/12/13 14:38:46 [error] 1176819#1176819: *74939 upstream prematurely closed connection while reading response header from upstream, client: 172.58.217.152, server: community.lifehousefans.net, request: "DELETE /api/v3/topics/3 HTTP/1.1", upstream: "http://127.0.0.1:4567/api/v3/topics/3", host: "community.lifehousefans.net", referrer: "https://community.lifehousefans.net/topic/3/another-test/3"
    2021/12/13 14:38:48 [error] 1176819#1176819: *74941 connect() failed (111: Connection refused) while connecting to upstream, client: 172.58.217.152, server: community.lifehousefans.net, request: "GET /socket.io/?EIO=4&transport=polling&t=NsqErZq HTTP/1.1", upstream: "http://127.0.0.1:4567/socket.io/?EIO=4&transport=polling&t=NsqErZq", host: "community.lifehousefans.net", referrer: "https://community.lifehousefans.net/topic/3/another-test/3"
    

    Attempt #3: Topic not found

    2021/12/13 14:38:58 [error] 1176819#1176819: *74952 upstream prematurely closed connection while reading response header from upstream, client: 172.58.217.152, server: community.lifehousefans.net, request: "DELETE /api/v3/topics/3 HTTP/1.1", upstream: "http://127.0.0.1:4567/api/v3/topics/3", host: "community.lifehousefans.net", referrer: "https://community.lifehousefans.net/topic/3/another-test/3"
    2021/12/13 14:39:01 [error] 1176819#1176819: *74954 connect() failed (111: Connection refused) while connecting to upstream, client: 172.58.217.152, server: community.lifehousefans.net, request: "GET /socket.io/?EIO=4&transport=polling&t=NsqEui5 HTTP/1.1", upstream: "http://127.0.0.1:4567/socket.io/?EIO=4&transport=polling&t=NsqEui5", host: "community.lifehousefans.net", referrer: "https://community.lifehousefans.net/topic/3/another-test/3"
    
  • Global Moderator Plugin & Theme Dev

    What plugins are you running? Sounds like something is causing NodeBB to crash when you send a purge request. Check the logs for errors.


  • @pitaj Thanks for the suggestion. It looks like the crash is being caused by the mentions plugin:

    2021-12-13T14:38:46.360Z [4567/1818921] - error: uncaughtException: Cannot read properties of undefined (reading 'pid')
    TypeError: Cannot read properties of undefined (reading 'pid')
        at Object.Mentions.actionPostPurge [as method] (/sites/community.lifehousefans.net/node_modules/nodebb-plugin-mentions/library.js:174:37)
        at Object.fireActionHook [as action] (/sites/community.lifehousefans.net/src/plugins/hooks.js:184:18)
        at Hooks.fire (/sites/community.lifehousefans.net/src/plugins/hooks.js:105:49)
        at Object.wrapperCallback [as fire] (/sites/community.lifehousefans.net/src/promisify.js:46:11)
        at Posts.purge (/sites/community.lifehousefans.net/src/posts/delete.js:67:17)
        at processTicksAndRejections (node:internal/process/task_queues:96:5) {"date":"Mon Dec 13 2021 14:38:46 GMT+0000 (Greenwich Mean Time)","error":{},"exception":true,"os":{"loadavg":[0.09,0.1,0.04],"uptime":847643.33},"process":{"argv":["/home/seggleston/.nvm/versions/node/v16.13.1/bin/node","/sites/community.lifehousefans.net/app.js"],"cwd":"/sites/community.lifehousefans.net","execPath":"/home/seggleston/.nvm/versions/node/v16.13.1/bin/node","gid":1000,"memoryUsage":{"arrayBuffers":671422,"external":21003656,"heapTotal":139296768,"heapUsed":113802424,"rss":196395008},"pid":1818921,"uid":1000,"version":"v16.13.1"},"stack":"TypeError: Cannot read properties of undefined (reading 'pid')\n    at Object.Mentions.actionPostPurge [as method] (/sites/community.lifehousefans.net/node_modules/nodebb-plugin-mentions/library.js:174:37)\n    at Object.fireActionHook [as action] (/sites/community.lifehousefans.net/src/plugins/hooks.js:184:18)\n    at Hooks.fire (/sites/community.lifehousefans.net/src/plugins/hooks.js:105:49)\n    at Object.wrapperCallback [as fire] (/sites/community.lifehousefans.net/src/promisify.js:46:11)\n    at Posts.purge (/sites/community.lifehousefans.net/src/posts/delete.js:67:17)\n    at processTicksAndRejections (node:internal/process/task_queues:96:5)","trace":[{"column":37,"file":"/sites/community.lifehousefans.net/node_modules/nodebb-plugin-mentions/library.js","function":"Object.Mentions.actionPostPurge [as method]","line":174,"method":"actionPostPurge [as method]","native":false},{"column":18,"file":"/sites/community.lifehousefans.net/src/plugins/hooks.js","function":"Object.fireActionHook [as action]","line":184,"method":"fireActionHook [as action]","native":false},{"column":49,"file":"/sites/community.lifehousefans.net/src/plugins/hooks.js","function":"Hooks.fire","line":105,"method":"fire","native":false},{"column":11,"file":"/sites/community.lifehousefans.net/src/promisify.js","function":"Object.wrapperCallback [as fire]","line":46,"method":"wrapperCallback [as fire]","native":false},{"column":17,"file":"/sites/community.lifehousefans.net/src/posts/delete.js","function":"Posts.purge","line":67,"method":"purge","native":false},{"column":5,"file":"node:internal/process/task_queues","function":"processTicksAndRejections","line":96,"method":null,"native":false}]}
    2021-12-13T14:38:46.362Z [4567/1818921] - error: TypeError: Cannot read properties of undefined (reading 'pid')
        at Object.Mentions.actionPostPurge [as method] (/sites/community.lifehousefans.net/node_modules/nodebb-plugin-mentions/library.js:174:37)
        at Object.fireActionHook [as action] (/sites/community.lifehousefans.net/src/plugins/hooks.js:184:18)
        at Hooks.fire (/sites/community.lifehousefans.net/src/plugins/hooks.js:105:49)
        at Object.wrapperCallback [as fire] (/sites/community.lifehousefans.net/src/promisify.js:46:11)
        at Posts.purge (/sites/community.lifehousefans.net/src/posts/delete.js:67:17)
        at processTicksAndRejections (node:internal/process/task_queues:96:5)
    2021-12-13T14:38:46.364Z [4567/1818921] - info: [app] Shutdown (SIGTERM/SIGINT) Initialised.
    2021-12-13T14:38:46.369Z [4567/1818921] - info: [app] Web server closed to connections.
    2021-12-13T14:38:46.370Z [4567/1818921] - info: [app] Live analytics saved.
    2021-12-13T14:38:46.372Z [4567/1818921] - info: [app] Database connection closed.
    2021-12-13T14:38:46.372Z [4567/1818921] - info: [app] Shutdown complete.
    [cluster] Child Process (1818921) has exited (code: 1, signal: null)
    

    Edit: I’ll open a bug report on GitHub for this plugin.

  • NodeBB


Suggested Topics

| |