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

closing fd's is sometimes helpful #167

Closed
wants to merge 1 commit into from
Closed

Conversation

rgrinberg
Copy link
Member

We don't have connection pooling for the client anyway so at least don't
be so buggy and close fd's after every request.

We don't have connection pooling for the client anyway so at least don't
be so buggy and close fd's after every request.
@@ -155,6 +155,10 @@ module Client = struct
| `Ok res ->
(* Build a response pipe for the body *)
let rd = pipe_of_body (Response.read_body_chunk res) ic oc in
don't_wait_for (
Copy link
Member

Choose a reason for hiding this comment

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

why not wait for these to close? It should be pretty fast, and anything else seems race-prone if the close isn't the right thing to do for some reason.

Copy link
Member Author

Choose a reason for hiding this comment

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

Because we don't how long it will take the pipe to finish reading. For example, what if we have some huge body and the pipe will stall with push back until the client has read something.

Copy link
Member

Choose a reason for hiding this comment

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

Oh of course -- sorry, I missed the vital Pipe.closed >>= on my first read. In my defence, it's because I'm busy hacking on the Conduit patches to let a release be cut ;-)

Copy link
Member Author

Choose a reason for hiding this comment

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

NP ^_^. Are we having a release shortly after?

Copy link
Member

Choose a reason for hiding this comment

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

Yep! I never intended for trunk to accumulate patches this long. Conduit is necessary for Mirage HTTP(S) requests to work though, so lots of combinations to test (and a DNS resolver needs to be hooked in too, which is ongoing in mirage/ocaml-dns)

@rgrinberg
Copy link
Member Author

This makes @pdonadeo's example work longer than I care to test it at this time.

@rgrinberg
Copy link
Member Author

@avsm is it possible to merge this along with #163 ?

A minor release with these bug fixes would be very welcome too.

@avsm
Copy link
Member

avsm commented Sep 8, 2014

merged in 1bf96f8

@avsm avsm closed this Sep 8, 2014
mseri added a commit to mseri/ocaml-cohttp that referenced this pull request Jun 16, 2022
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.

None yet

2 participants