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

Fix for leaked pipes #54

Merged
merged 1 commit into from
Apr 17, 2015
Merged

Conversation

trevorsummerssmith
Copy link

NB I am not familiar with this codebase so not totally clear if this
is the correct fix for this issue

Fixes #53 for me

(* Close the pipes we created for ssl when we're done! *)
don't_wait_for (
Pipe.closed net_to_ssl >>= fun () ->
Deferred.all_ignore [Reader.close app_rd; Writer.close app_wr]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We usually specify the order in cases like this. So let's close the writer first.

NB I am not familiar with this codebase so not totally clear if this
is the correct fix for this issue
@trevorsummerssmith
Copy link
Author

@rgrinberg I switched the order as per your suggestion. I amended the original commit.

@rgrinberg
Copy link
Member

+1. I actually thought all_ignore left the order unspecified but it's left to right. I.e. basically sequence_.

@@ -50,4 +50,9 @@ let ssl_listen ~crt_file ~key_file rd wr =
>>= fun app_rd ->
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not being that familiar with the code of conduit I'm wondering if it's possible for net_to_ssl to be closed before your cleanup call is made. E.g. after the app_rd is created but before app_wr. Admittedly, that's a little contrived.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rgrinberg I don't know either. I am eager to hear from a core committer about this.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As the core committer, I'm not much more help -- the Async_ssl interface is terribly documented. Am reading the source code now...

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've tried your patch for 10 minutes with a curl running against cohttp lib_test/test_net_async_server.native, and there's no observable memory leak from a lot of https:// connections with this patch. So merging this...

@avsm avsm merged commit 365cc94 into mirage:master Apr 17, 2015
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

Successfully merging this pull request may close these issues.

Conduit_async_ssl. ssl_listen Leaks Pipes
3 participants