Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

node processes get orphaned #199

Open
Raynos opened this Issue · 5 comments

4 participants

@Raynos

When I start a server on a PORT in my tests and run it with testem sometimes this process gets orphaned.

This means that when I close testem and try to run the test again manually with npm test I get an EADDRINUSE error because the node process testem spawned is still running. Since testem was already closed this process has been orphaned and there is no way to kill it other then killall node or careful looking.

@airportyh
Owner

Yeah, I've seen this too. Problem is, it's up to the process that starts to server to clean up after itself. Testem sends a SIGTERM to the subprocess, but it's the responsibility of that process to handle SIGTERM and exit cleanly. Most test suites don't do this though because usually there is no need to. But for your case, since you are using something simple like tape, I'd try handling SIGTERM gracefully and see if that solves the problem.

@Raynos

@airportyh can't you just hard kill your child processes. Why not just ensure that they are not orphaned and have them automatically terminate when the parent process ends.

@airportyh
Owner

I'll play with it to get a good test case.

@wraithan

We had some students who are newer with node (and programming) running into this and it was rather confusing for them. We had to explain how to figure out the process id and kill it.

@airportyh
Owner

@wraithan I'd like to solve this. Could you give me more details on the scenario(s) that is causing this? Do a simple test was not enough to reproduce this for me.

@johanneswuerbach johanneswuerbach added the bug label
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.