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

Handle SIGSEGV #28

Closed
Qix- opened this issue Aug 28, 2015 · 12 comments
Closed

Handle SIGSEGV #28

Qix- opened this issue Aug 28, 2015 · 12 comments
Labels
enhancement new functionality question

Comments

@Qix-
Copy link
Contributor

Qix- commented Aug 28, 2015

SIGSEGV occurs when a program performs a native memory operation that isn't valid (i.e. referencing/writing to a piece of unallocated memory).

This is important for native module programming, as if it segfaults it'd be nice to gracefully handle it as a test failure instead of terminating the offending process - especially when there are lots of tests.

However, there should be discussion on it as I believe it requires you use fork (thought not entirely sure). I'd have to do more research.

Not entirely sure this is relevant to windows, either (with windows, there isn't a great way to recover from an access violation) - you'd probably need to write a native module with /EHsc in the flags and wrap something in a try/catch statement (though that's considered icky and probably wouldn't work with V8).

@sindresorhus sindresorhus added enhancement new functionality question labels Aug 28, 2015
@sindresorhus
Copy link
Member

This will probably be easier when #1 is implemented. AVA will then run tests in separate sub-processes.

@Qix-
Copy link
Contributor Author

Qix- commented Sep 1, 2015

That'll prevent coverage tests from working.

@sindresorhus
Copy link
Member

No: https://github.com/bcoe/nyc

@Qix-
Copy link
Contributor Author

Qix- commented Sep 1, 2015

👍 Starred. Istanbul is what I use and it doesn't; figured that was a global thing.

@SamVerschueren
Copy link
Contributor

Should AVA already work with nyc? Trying it out right now but it reports no coverage at all which is quite odd.

@sindresorhus
Copy link
Member

We want AVA to work with it, but I haven't tested. Not a top priority right now as we're focusing on finishing the API and performance. Happy to receive some help debugging/PR/etc, though.

@sindresorhus
Copy link
Member

@Qix- We're now forking each test file. Any recommendation on how we should handle this?

@Qix-
Copy link
Contributor Author

Qix- commented Oct 31, 2015

No idea how signals work with threads. Id have to do some research.

@sindresorhus
Copy link
Member

@Qix- We're not using threads (there are no threads in JS), but subprocesses.

@Qix-
Copy link
Contributor Author

Qix- commented Nov 2, 2015

Well right. I'd assume each fork would have to register its own signals. I've never done that before, but I'm pretty sure it's analogous to how it works on the native level. And then there's windows...

@sindresorhus
Copy link
Member

fork in the Node.js sense is just a spawned Node.js process with an IPC channel. So it's just a normal child process with normal process signals. I think the best solution here is to just do nothing. If a test file has a SIGSEGV it will just fail the test file, not all the test files.

@Qix-
Copy link
Contributor Author

Qix- commented Nov 2, 2015

Fair enough. It's an edge case but maybe when the core is a little more stable in terms of the other forking issues that are open, perhaps we can reconsider this. 👍

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

No branches or pull requests

3 participants