Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Segfault for C++ binding with Go library while cleaning up #2695

Open
tdewolff opened this issue Jul 12, 2022 · 0 comments
Open

Segfault for C++ binding with Go library while cleaning up #2695

tdewolff opened this issue Jul 12, 2022 · 0 comments

Comments

@tdewolff
Copy link

tdewolff commented Jul 12, 2022

This may be a long shot but we're out of ideas. we have a Go library with JS bindings, see https://github.com/tdewolff/minify/tree/master/bindings/js which builds a Go library (using MingW) to a C archive, then we use that together with the C file to build the NAPI binary. I use GitHub actions to build on each platform, see https://github.com/tdewolff/minify/blob/master/.github/workflows/nodejs.yml.

For some reason, executing https://github.com/tdewolff/minify/blob/master/bindings/js/test/worker.js gives a segfault right at the end (see https://github.com/tdewolff/minify/runs/7293049169?check_suite_focus=true#step:6:74) which happens while running await worker.terminate(). Is there a way to debug this segfault? It is likely a race condition since it doesn't always happen. Something probably to do with the Go garbage collector, even though turning it off doesn't fix the problem.

How can I debug this segfault? The segfault-handler package doesn't seem to support ES6 import syntax, but converting the worker.js above to a CommonJS format doesn't usually cause a segfault and if it does the handler doesn't catch it.

PS: segfault happens on Ubuntu/Arch, but not on MacOS. For Windows I run into another problem

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant