Old/Bad Category CID somehow stuck in nodeBB cache. How to clear?



  • Thank you for this amazing platform. I ran into an unusual issue where I have a category CID coming back from the cache and I have no reference to it anywhere within any of the collections on the mongo database.

    I have attemtped to trace this back to the cache library and tried to perform a cache reset also. I have also re-build all assets with ./nodebb build. Where can I clear this bogus cid. Its crashing the entire server and I need to clear it.

    For now I just added a temporary filter on the cids array to manually remove it and this is temporarily fixing my problem and allowing nodebb server to start and operate fine.

    Before I do any more review of the codebase, I was wondering if I am just missing something.

    So for example the cids will come back as:

    [ '1', '2', '3', '4' ]
    

    '4' is bad cid. It is non-existant and must be removed from cache. This '4' does not exist in database and causes nodebb to crash.

    I cannot clear '4' cid from cache.

    So my temporary fix is to do

    .filter(cid => cid !== '4') // This is fixing for now.
    

    https://github.com/NodeBB/NodeBB/blob/master/src/categories/index.js#L87

    Categories.getAllCidsFromSet = function (key, callback) {
    	const cids = cache.get(key);
            // ...
    })
    

    Any advice I greatly appreciate!


  • Admin

    Redis or mongodb?



  • It was mongo, i was able to resolve it by re-creating the category.


  • Admin

    If you can reliably reproduce the issue, it would be nice to find the root cause, did you delete category 4 and it started crashing?


  • Admin

    @jzbg said in Old/Bad Category CID somehow stuck in nodeBB cache. How to clear?:

    Its crashing the entire server and I need to clear it.

    Please post the crash stack trace as well.



  • I already re-installed onto a new server. I was only testing .. If I do reproduce I will make sure to provide stacktrace. I do appreciate you looking into this. I will make sure in the future that I can provide more details.


Log in to reply
 

Suggested Topics

  • 1
  • 26
  • 20
  • 47
  • 8
| |