You are awesome Niphlod. I restructured the process a bit so that page 
running the process does not have a form and just call 
session.forget(response) before starting it and it works great now. I can 
run it multiple times in the same browser and they all return the correct 
values independently when completed. 

Thanks!




On Sunday, September 21, 2014 4:03:27 PM UTC-5, Niphlod wrote:
>
>
>
> On Sunday, September 21, 2014 4:05:02 PM UTC+2, pn wrote:
>>
>> Did you test in a production environment (example behind an apache/other 
>> server calling web2py via wsgi as described in the deployment recipes 
>> chapter) or just using the built-in web2py server on your dev machine?
>>
>> The difference is that apache will certainly be able to handle multiple 
>> simultaneous requests, even long running ones until it runs out of 
>> allocated resources. Not sure if the built-in rocket server can do that or 
>> if it only handles one request at a time.
>>
> no, no, no, no. Never spawn external processes from a web request for the 
> following reasons:
> - every serious webserver has something called "timeout" that reaps 
> processes and threads that are stale for a while. Usually the limit is 60 
> seconds. Be aware that every "good-behaving" request should return in less 
> than half a second.
> - managing external processes within a web app is a PITA 
>
> @douglas: what you're experiencing comes from the fact that the default 
> session storage is serial, not parallel. that's because if you do something 
> like 
>
> def testpage():
>       session.somevar += 1
>       ....
>       return dict()
>
> there could be race conditions among several "parallel" requests. The way 
> to turn this behaviour "off" is to avoid using session (make sure you don't 
> have forms in the page, because they require a sesson to be there) and use 
> session.forget(). You can read about it on the book.
>
> Anyway, if you need *n* parallel jobs to run, the best thing is to use 
> the Scheduler with *n* active processes, and leave the webserver just 
> queuing and reading the results (the simplest thing would be to poll 
> periodically for results)
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to