Sunday, February 12, 2012

Re: Thread timeout

On Sun, 12 Feb 2012 18:30:41 -0300, Phyllipe Medeiros
<phyllipecesar@gmail.com> wrote:

>Then I have a view that calls Teste().start(), the message that I receive
>on error log is only "BEGIN".
>But if I do no use a thread, the "error log" will work correctly "Begin,
>PASSED SLEEP" and "OUT".
>I think it is something related to Apache2/Mod_wsgi or even permissions in
>my system, because if run it with sudo using runserver it will work
>perfectly.
>In my house it works perfectly too.

And what happens if, in your view, you replace

Teste().start()

with

t = Teste()
t.start()
t.join()

?

"runserver" is a continuously running Python program, as I recall
and your application essentially runs within it. Apache/mod_wsgi (based
on http://code.google.com/p/modwsgi/ ) apparently can be configured in
two modes. I suspect one of those modes is seeing the application
"shutting down" before it captures the output (Or... it receives the
"begin" output, and then nothing for a period of time, and may presume
the process is hung or has no further output). Using .join() would, at
the least, keep the main process from initiating shutdown until the
thread completes (this could be an alternative hypothesis -- the main
process starts shutdown, closing stdout /before/ waiting for the thread
to complete)
--
Wulfraed Dennis Lee Bieber AF6VN
wlfraed@ix.netcom.com HTTP://wlfraed.home.netcom.com/

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate