On 2-2-2015 10:54, yacinechaou...@yahoo.com wrote:
> I wrote a little script that acts like a proxy, you just give it a URL and it 
> will
> fetch the content and display it back to you.
> 
> For some reason, this proxy blocks sometimes and refuses to serve any new 
> queries.
> The script still runs, but it seems like it's stuck somewhere.
> 
> When I strace it to see what it's doing, I find it hanging on this 
> instruction : 
> root@backup[10.10.10.21] ~/SCRIPTS/INFOMANIAK # strace -fp 6918 Process 6918 
> attached
> - interrupt to quit recvfrom(6, ^CProcess 6918 detached 
> root@backup[10.10.10.21]
> ~/SCRIPTS/INFOMANIAK #
> 
> I read in the SimpleHTTPServer source code that one can inherit from the
> SocketServer.TrheadingMixIn mixin to enable a threaded server to handle 
> multiple
> requests at a time instead of just one (thinking maybe that's what was 
> blocking it).
> However, it seems like it has nothing to do with my problem. What I need to 
> do is not
> only handle multiple requests at a time, but more importantly to make the 
> request
> handler non-blocking.

Why? If you have multiple threads serving some requests at the same time, 
doesn't that
already achieve your goal? In other words, have you tried what you describe 
above?
(make sure you close the connection correctly or you'll be hogging a thread 
which may
eventually make the server non responsive)

Irmen
-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to