-
Notifications
You must be signed in to change notification settings - Fork 30.2k
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
Node not saving coverage when process is terminated using SIGINT/SIGTERM #35212
Comments
For reference the issue reported by me in c8 repository: bcoe/c8#189 |
@bnoordhuis I don't see how it's a duplicate at all. Here I'm talking about saving coverage data not cpu prof. If I attach an event listener to node process, coverage is dumped so there is no technical limitation to implement this behavior by default. A process can receive a signal multiple times and it can delay processing of a signal so there is plenty of time to write the files to the disk. |
I guess this isn't really a duplicate - even after we fix the same issue with |
@bcoe I know you are up to speed on the coverage front. |
I believe this used to work ™️. When/if we figure out an approach for Most importantly, let's make sure we add a regression test (could have sworn we had won, funny enough). |
I took a look and I think we'd need to just create a different watchdog for the profilers. I'll be refactoring the entire profiler connection class for #33807 and I'll look into how to throw a watchdog into the class |
Hi! Could someone explain me (or give me a link) how these signal handlers affect v8 coverage behaviour? I.e. I would understand if there was recommendation to call v8.takeCoverage() from SIGTERM handler. But how does this work with only process.exit() in SIGTERM handler ? |
@Dzenly Something like |
What steps will reproduce the bug?
When running this code
If I stop the process using SIGINT/SIGTERM before the timeout kicks in, coverage is not saved.
What is the expected behavior?
Node coverage should work in the same way as other coverage tools, saving the coverage before terminating the process even if no SIGINT handler is set.
What do you see instead?
No coverage is saved.
Additional information
I know that adding a SIGINT/SIGTERM handler can be used as a workaround but this is not how most applications terminate and has no added value.
The text was updated successfully, but these errors were encountered: