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

http: Put exception in the queue in connection_lost #25

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

mschmitzer
Copy link

The client fiber may already be blocked on the queue (in getresponse)
when connection_lost is invoked.

The code in getresponse already handles getting an exception from the
queue.

@coveralls
Copy link

coveralls commented Aug 4, 2017

Coverage Status

Coverage decreased (-0.05%) to 90.193% when pulling 7ce4782 on solute:http-fix-connection-reuse-stall into 1d77ca4 on geertj:master.

@geertj
Copy link
Owner

geertj commented Aug 6, 2017

Thanks @MarcSchmitzer for the report!

I made the logic slightly more robust to also cover the situation where the connection is lost while reading a response body. Can you have a look at this branch: pr-25, and tell me if it solves your problem?

@mschmitzer
Copy link
Author

mschmitzer commented Aug 7, 2017

Hi,
I'm afraid pr-25 doesn't quite cut it for me, it brings back the hung fibers I originally set out to fix. I think the problem is that the _message property of the HttpProtocol instance is never cleared. When connection_lost is invoked on an instance that has already completed one request/response pair, self._message is never None, and so the self._queue.put is not executed.

Maybe clear self._message in on_message_complete?

EDIT: Adding a self._message = None in on_message_complete on top of the pr-25 branch seems to work.

The client fiber may already be blocked on the queue (in getresponse)
when connection_lost is invoked.

The code in getresponse already handles getting an exception from the
queue.
@mschmitzer mschmitzer force-pushed the http-fix-connection-reuse-stall branch from 7ce4782 to b48e14b Compare September 5, 2017 11:24
@mschmitzer
Copy link
Author

Any updates on this?

I've updated the branch with your variant of the "Put exception in queue" commit and another commit that drops the message object in message_complete to make the former effective.

Would be nice if you could merge and release this.

@coveralls
Copy link

coveralls commented Sep 5, 2017

Coverage Status

Coverage increased (+0.009%) to 90.247% when pulling b48e14b on solute:http-fix-connection-reuse-stall into 1d77ca4 on geertj:master.

2 similar comments
@coveralls
Copy link

Coverage Status

Coverage increased (+0.009%) to 90.247% when pulling b48e14b on solute:http-fix-connection-reuse-stall into 1d77ca4 on geertj:master.

@coveralls
Copy link

Coverage Status

Coverage increased (+0.009%) to 90.247% when pulling b48e14b on solute:http-fix-connection-reuse-stall into 1d77ca4 on geertj:master.

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.

3 participants