-
Notifications
You must be signed in to change notification settings - Fork 73
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
Conversation
(* 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] |
There was a problem hiding this comment.
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
615b67a
to
365cc94
Compare
@rgrinberg I switched the order as per your suggestion. I amended the original commit. |
+1. I actually thought |
@@ -50,4 +50,9 @@ let ssl_listen ~crt_file ~key_file rd wr = | |||
>>= fun app_rd -> |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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...
There was a problem hiding this comment.
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...
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