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

Test for zombie, memory, and pipe leaks #36

Open
richardsheridan opened this issue Mar 22, 2021 · 2 comments
Open

Test for zombie, memory, and pipe leaks #36

richardsheridan opened this issue Mar 22, 2021 · 2 comments

Comments

@richardsheridan
Copy link
Owner

I had originally assumed that multiprocessing was going to take care of all this for us, but in #34 @zgoda claims that hypercorn --debug -k trio somehow leads to a semaphore leak on each run_sync invocation. Since we are doing Readme Driven Development and claim "no leaks" we should develop the automated tests to show that there are no leaks in a suite of example usages and regression tests.

@richardsheridan
Copy link
Owner Author

We removed all semaphores in #33 so at least that's sorted.

@richardsheridan richardsheridan changed the title Test for zombie, semaphore, and pipe leaks. (and memory?) Test for zombie, memory, and pipe leaks Apr 8, 2021
@richardsheridan
Copy link
Owner Author

There is at least one situation where we have a pipe leak, which is whenever an ACK is not received on windows:

if sys.platform != "win32":
return
# Give a nice error on accidental recursive spawn instead of hanging
async def wait_for_ack():
try:
code = await self._receive_chan.receive()
assert code == tp_workers.ACK
except BaseException:
self.kill()
with trio.CancelScope(shield=True):
await self.wait() # noqa: TRIO102
raise
nursery.cancel_scope.cancel()
exitcode = None
async with trio.open_nursery() as nursery:
nursery.start_soon(wait_for_ack)
exitcode = await self.wait()
nursery.cancel_scope.cancel()
if exitcode is not None:
raise BrokenWorkerProcessError("Worker failed to start", self.proc)

I consider this an upstream bug (python/cpython#114720), but basically I would have caught this back in 2021 with these kind of tests.

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

No branches or pull requests

1 participant