Skip to content
This repository has been archived by the owner on Jul 24, 2024. It is now read-only.

node process hangs on unrelated error when using custom importers #1048

Open
mattfysh opened this issue Aug 2, 2015 · 4 comments
Open

node process hangs on unrelated error when using custom importers #1048

mattfysh opened this issue Aug 2, 2015 · 4 comments

Comments

@mattfysh
Copy link

mattfysh commented Aug 2, 2015

The error when thrown doesn't cause the node process to exit
SSCCE:

var opts = {data: '@import "x"', importer: function() {}};
require('node-sass').render(opts, function() {});
throw new Error();

We were able to work around this using renderSync but our builds are a little slower. Any ideas what could be causing this, or if there's a better workaround available? thanks.

@mattfysh
Copy link
Author

mattfysh commented Aug 3, 2015

Found a way to continue using render (and keep build performance) using an uncaughtException listener:

var opts = {data: '@import "x"', importer: function() {}};
require('node-sass').render(opts, function() {});
process.on('uncaughtException', function(e) {
    console.error(e.stack);
    process.kill(process.pid, 'SIGINT');
});
throw new Error('test msg');

Not the cleanest solution... are there any plans to fix this behavior for node-sass? I noticed #857 about the process hanging with the UV_THREADPOOL_SIZE the only solution given for now.. thanks

@xzyfer
Copy link
Contributor

xzyfer commented Aug 4, 2015

Thanks for this @mattfysh. This is not related to #857. We should catch this error and return a useful error message.

@saper
Copy link
Member

saper commented Aug 12, 2015

Yes, we schedule an event and wait on the lock the event handler returns.
The problems is it never returns, because it never gets called - the event loop gets stopped before it could happen.

@saper saper added this to the bridge.rewrite milestone Aug 12, 2015
@saper
Copy link
Member

saper commented Aug 12, 2015

So, during the next rewrite of the binding code this will be taken into account. For now there is no easy solution (except for process.kill). Sorry for that!

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

No branches or pull requests

3 participants