I'm stuck on an issue during testing and I was wondering if I could get some help nailing down the problem. I've created a project to recreate the error here:
https://github.com/maestroh/segfault_test
When running my tests, I continue to get a segmentation fault error when nodemon restarts. The only way I've been able to recreate the error is through the following steps.
Recreation Steps
1. Create a test using mocha
2. Add a jsdom setup on the before step
3. Require simple-mock. I've also tried sinon. I don't have to use anything in these packages. I only have to require them.
4. Add a gulp task to execute the mocha test
5. Add a gulp task for nodemon to restart on changes and re-run the tests
When the tests re-run, I receive the following segfault error
PID 7389 received SIGSEGV for address: 0x0
/home/nael/proj/segfault_test/node_modules/segfault-handler/build/Release/segfault-handler.node(+0x10e5)[0x7f02527b50e5]
/lib/x86_64-linux-gnu/libpthread.so.0(+0x10340)[0x7f0252d8d340]
/home/nael/proj/segfault_test/node_modules/jsdom/node_modules/contextify/build/Release/contextify.node(_ZN17ContextifyContext20GlobalPropertySetterEN2v85LocalINS0_6StringEEENS1_INS0_5ValueEEERKNS0_12AccessorInfoE+0x6e)[0x7f02505ad25e]
gulp(_ZN2v88internal8JSObject26SetPropertyWithInterceptorEPNS0_6StringEPNS0_6ObjectE18PropertyAttributesNS0_14StrictModeFlagE+0x232)[0x81be22]
gulp(_ZN2v88internal8JSObject20SetPropertyForResultEPNS0_12LookupResultEPNS0_6StringEPNS0_6ObjectE18PropertyAttributesNS0_14StrictModeFlagENS0_10JSReceiver14StoreFromKeyedE+0x38e)[0x81b5fe]
gulp(_ZN2v88internal8JSObject20SetPropertyForResultEPNS0_12LookupResultEPNS0_6StringEPNS0_6ObjectE18PropertyAttributesNS0_14StrictModeFlagENS0_10JSReceiver14StoreFromKeyedE+0x20a)[0x81b47a]
gulp(_ZN2v88internal10JSReceiver11SetPropertyEPNS0_6StringEPNS0_6ObjectE18PropertyAttributesNS0_14StrictModeFlagENS1_14StoreFromKeyedE+0x99)[0x81d329]
gulp(_ZN2v88internal7StoreIC5StoreENS0_16InlineCacheStateENS0_14StrictModeFlagENS0_6HandleINS0_6ObjectEEENS4_INS0_6StringEEES6_+0x390)[0x7af920]
gulp(_ZN2v88internal12StoreIC_MissENS0_9ArgumentsEPNS0_7IsolateE+0x126)[0x7afe86]
[0x1ff8f9706362]
I only get the segfault when requiring sinon or simple-mock. Anyone know how to further diagnose the problem? I'm thinking there is a problem with how I'm setting up and tearing down jsdom, but I can't find anyone else that's had the problem. One other thought is that I'm running in a virtual machine. I'm wondering if the contextify build isn't getting created correctly which results in the segfault.
Thanks for the help.