Skylar-Tech / node-red-contrib-matrix-chat

Matrix chat server support for Node-RED
GNU General Public License v3.0
31 stars 10 forks source link

Fatal error in , line 0 Check failed: has_pending_exception(). #94

Open wuast94 opened 10 months ago

wuast94 commented 10 months ago

I had opened an issue at nodered repo but its related to this node, i will just link it because all the information is in it.

https://github.com/node-red/node-red/issues/4304

skylord123 commented 10 months ago

I triaged this with @wuast94 and found that having "Global access to Matrix Client" turned on while also having Node-RED's context storage set to store in the filesystem it would cause this.

The reason is that with "Global access to Matrix Client" turned on we set the matrix client to a global variable so the user can do extra functionality that we haven't built into this module. If the context storage is set to persist it will save this object to the FS and try to restore it on next startup. The matrix-client REALLY does not like this and ends up crashing due to it (probably some of the references got dropped converting it to JSON for storage).

So the workaround for now is to either: 1) disable "Global access to Matrix Client" for the client 2) If you need "Global access to Matrix Client" then update your context configuration in Node-RED to no longer store context into the filesystem by default (you can add another context for FS storage instead)

I will need to get this module updated so you can select which context store to use in the future so that you don't have to have the default be memory storage. We will also need to update the docs (and add a note under "Global access to Matrix Client" option to describe this issue and how to avoid it).

skylord123 commented 6 months ago

The next release https://github.com/Skylar-Tech/node-red-contrib-matrix-chat/pull/96 will contain code that deletes the matrix object from global storage during shutdown. I'm hoping this is a solution to this issue but if not we will have to make the context storage configurable. This should help prevent the object getting persisted between NR deploys/restarts.