[Stackless] Monkeypatching

Andrew Francis andrewfr_ice at yahoo.com
Thu Dec 12 02:00:18 CET 2013


Hi Lars:

>It wasn't blocked on IO, the server got stuck in it's mainloop (or similar name). I don't know much about webservers, >WSGIservers etc, but what i also tried was putting a schedule() in this mainloop (which i think polls the socket). Is this >what you suggest? It seems to work well, apart from the occasional weird AttributeError, which i'll have to look into. >However others discouraged this approach, but i never quite understood why. 

Yes this is what I am suggesting.

However I have another idea for a general purpose solution. The only time you want a timeout in a select/poll/epoll is if you have 



On Wednesday, December 11, 2013 7:00 AM, lars van Gemerden <lars at rational-it.com> wrote:
 
Hi Andrew,

It wasn't blocked on IO, the server got stuck in it's mainloop (or similar name). I don't know much about webservers, WSGIservers etc, but what i also tried was putting a schedule() in this mainloop (which i think polls the socket). Is this what you suggest? It seems to work well, apart from the occasional weird AttributeError, which i'll have to look into. However others discouraged this approach, but i never quite understood why. 

Cheers, Lars



On Fri, Dec 6, 2013 at 7:40 PM, Andrew Francis <andrewfr_ice at yahoo.com> wrote:

Hi Lars:
>
>
>Message: 1
>Date: Thu, 5 Dec 2013 22:07:20
 +0100
>From: lars van Gemerden <lars at rational-it.com>
>To: The Stackless Python Mailing List <stackless at stackless.com>
>Subject: Re: [Stackless] monkeypatching
>Message-ID:
>    <CAP8kt8yLp1P46DeZfdBwkeTvWmbWFXbAra+MSxViXhuWXj0Fsw at mail.gmail.com>
>Content-Type: text/plain; charset="windows-1252"
>
>>(oh, i created a tasklet for the bottle microframework run() method, which
>>includes the mainn server loop()) ; I only called schedule() on
 each web
>>server request to be able to do anything outside the server mainloop.
>>However that had the
 effect that process steps where not executed as >long as the end user sent no requests (some processes do not have any >web component).
>
>
>
>I haven't had a chance to carefully look at your code. However from this description, it sounds like a thread/tasklet is blocked on I/O.  This will have the effect of blocking all tasklets in that thread. What you need to do is occasionally call a timeout from the underlying system call (for example, select()) and do a schedule() so other tasklets can run.
> 
>
>Cheers,
>Andrew
>
>
>P.S - Yahoo's new and improved mail interface is killing me!
>_______________________________________________
>Stackless mailing list
>Stackless at stackless.com
>http://www.stackless.com/mailman/listinfo/stackless
>


-- 
====================================
Lars van Gemerden
lars at rational-it.com
+31 6 26 88 55 39
==================================== 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.stackless.com/pipermail/stackless/attachments/20131211/730ededb/attachment-0001.html>


More information about the Stackless mailing list