awslabs / aws-crt-nodejs

NodeJS bindings for the AWS Common Runtime.
Apache License 2.0
37 stars 24 forks source link

Fix Segfault on Electron Exit #501

Closed xiazhvera closed 8 months ago

xiazhvera commented 8 months ago

Issue #, if available:

Description of changes: As Electron would shutdown the node process on exit, and eventually causing "segfault" on threadsafe function operation. We now disable the node threadsafe functions on node process exit to prevent the segfault.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

xiazhvera commented 8 months ago

Though it is possible to put the rw lock on module data, I didn't find a good way to retrieve the module data when we do threadsafe function operations. One possible solution is to make the whole module data a global static, while I feel it was meaningless to do so... I will setup a separate task for running test suite in Electron.