Comment 1 for bug 943452

Revision history for this message
Jonathan Lange (jml) wrote :

I don't think so. If you change the harness so that it doesn't shut down when it gets a response, you'll see that only one request is ever sent to it. I think the problem is that we are shutting down the service too early.

From #twisted.web on 2012-01-12:

jml: When is Resource.render() called?
exarkun: When a Resource is found to service a request
jml: is the request fully received by that point?
exarkun: Yes
jml: OK, thanks.
jml: I have a Resource locally that waits for one request and then shuts down the web server. However, the other end is reporting a connection refused after sending the request. I can't figure out what this second attempted connection is all about.
exarkun: favicon? :)
exarkun: You may also be shutting down the reactor such that the response is never sent, and some kind of retry logic in the client is kicking in.
jml: exarkun: ooh, that last one might be it.
jml: exarkun: is there an event I can hook into to ensure the response has been sent?
exarkun: :(
exarkun: not as far as I know
jml: exarkun: how vexing.
jml: I'm currently starting the shutdown on notifyFinish
exarkun: Yea, you'd sorta expect that to be good enough.
jml: I'll try a callLater to verify that this is indeed what's happening.
jml: reactor.callLater(0, ...) to the rescue :(