[web2py] Re: Page hangs when calling subprocess.check_call from within web2py

2015-03-24 Thread Toby
Good idea to look through uwsgi.log. 

The problem was harakiri on a process after 60 seconds. There was an entry 
in the log along the lines of HARAKIRI ON WORKER 4 (pid: 2557, try: 1). 
To fix, I increased  harakiri to 120 in /etc/uwsgi/web2py.xml. 

That created a new problem which showed up in uwsgi.log as SIGPIPE: 
writing to a closed pipe/socket/fd (probably the client disconnected) on 
request . Turns out this is because by default nginx waits a max of 60 
seconds for uwsgi to respond to a request. The fix was to add a line to 
/etc/nginx/sites-available/web2py saying uwsgi_read_timeout 120;

Helpful reading for anyone else who comes across this same problem:
http://stackoverflow.com/questions/24133315/fixing-broken-pipe-error-in-uwsgi-with-python

Thanks again for having pointed me in the right direction.

Toby

-- 
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.


[web2py] Re: Page hangs when calling subprocess.check_call from within web2py

2015-03-24 Thread Toby


On Tuesday, March 24, 2015 at 8:07:45 PM UTC, Niphlod wrote:

 seems the right job for the scheduler :-P



Yeah, maybe you're right. 

Basically my program generates a large image for a user which takes about 1 
min. I want to show please wait on the web-page while it's generating, 
then show the download link when it's ready. Could I do that if I used the 
scheduler? How would I make the scheduler talk to the controller function, 
to show the download link when it's ready? Would I need to use javascript 
to poll a url periodically to check whether the task is finished?


-- 
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.


[web2py] Re: Page hangs when calling subprocess.check_call from within web2py

2015-03-24 Thread Niphlod


On Tuesday, March 24, 2015 at 9:34:41 PM UTC+1, Toby wrote:



 On Tuesday, March 24, 2015 at 8:07:45 PM UTC, Niphlod wrote:

 seems the right job for the scheduler :-P



 Yeah, maybe you're right. 

 Basically my program generates a large image for a user which takes about 
 1 min. I want to show please wait on the web-page while it's generating, 
 then show the download link when it's ready. Could I do that if I used the 
 scheduler? How would I make the scheduler talk to the controller function, 
 to show the download link when it's ready? Would I need to use javascript 
 to poll a url periodically to check whether the task is finished?


yep. 

-- 
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.


[web2py] Re: Page hangs when calling subprocess.check_call from within web2py

2015-03-24 Thread Niphlod
seems the right job for the scheduler :-P

On Tuesday, March 24, 2015 at 6:10:15 PM UTC+1, Toby wrote:

 Good idea to look through uwsgi.log. 

 The problem was harakiri on a process after 60 seconds. There was an entry 
 in the log along the lines of HARAKIRI ON WORKER 4 (pid: 2557, try: 1). 
 To fix, I increased  harakiri to 120 in /etc/uwsgi/web2py.xml. 

 That created a new problem which showed up in uwsgi.log as SIGPIPE: 
 writing to a closed pipe/socket/fd (probably the client disconnected) on 
 request . Turns out this is because by default nginx waits a max of 60 
 seconds for uwsgi to respond to a request. The fix was to add a line to 
 /etc/nginx/sites-available/web2py saying uwsgi_read_timeout 120;

 Helpful reading for anyone else who comes across this same problem:

 http://stackoverflow.com/questions/24133315/fixing-broken-pipe-error-in-uwsgi-with-python

 Thanks again for having pointed me in the right direction.

 Toby



-- 
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.


Re: [web2py] Re: Page hangs when calling subprocess.check_call from within web2py

2015-03-19 Thread Michele Comitini
what are you using between nginx and web2py? uwsgi?
if that's the case check the uwsgi logs for clues

mic

2015-03-19 19:12 GMT+01:00 Dave S snidely@gmail.com:



 On Thursday, March 19, 2015 at 5:17:21 AM UTC-7, Toby wrote:

 Hi,

 I'm having issues using subprocess.call from within a module file in
 web2py.



 [...]

 The funny thing is that if I use an imagemagick command that's faster to
 run (e.g. a lower resolution image) then it works fine. It's only once the
 command is so long that it takes about 5 seconds or more that it starts
 failing when called from within web2py.


 Any advice on what's going wrong and what to do? I tried using os.system
 instead but it doesn't work either. I'm running web2py 2.9.5 with nginx on
 ubuntu 13. It's crossed my mind that nginx might be shutting down the
 subprocess when it runs too long, but I don't know how to check that.


 That is my (naive) thought.  Does nginx have log files?

 /dps


 --
 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.


-- 
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.


[web2py] Re: Page hangs when calling subprocess.check_call from within web2py

2015-03-19 Thread Dave S


On Thursday, March 19, 2015 at 5:17:21 AM UTC-7, Toby wrote:

 Hi, 

 I'm having issues using subprocess.call from within a module file in 
 web2py.

 

 [...] 

The funny thing is that if I use an imagemagick command that's faster to 
 run (e.g. a lower resolution image) then it works fine. It's only once the 
 command is so long that it takes about 5 seconds or more that it starts 
 failing when called from within web2py.


 Any advice on what's going wrong and what to do? I tried using os.system 
 instead but it doesn't work either. I'm running web2py 2.9.5 with nginx on 
 ubuntu 13. It's crossed my mind that nginx might be shutting down the 
 subprocess when it runs too long, but I don't know how to check that.


That is my (naive) thought.  Does nginx have log files?

/dps
 

-- 
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.