You should not start threads within actions because they are already
running into threads created by the web sever. The web server monitors
the threads and kills them on timeout.

Moreover you are used the db object in the thread. That is not thread
safe. Every thread should have its own db connection. Web2py handles
this for you (every action runs in its own thread and has its own db)
but you break it if you make your own threads.

On Oct 16, 3:22 pm, Harshad <hash0...@gmail.com> wrote:
> class Worker(threading.Thread):
>     def run(self):
>         print self.name, "running..."
>         while True:
>             if db(db.temperature).isempty():
>                 print "empty"
>             else:
>                 print "not empty"
>             time.sleep(1)
>
> Running the above code causes the application to seg fault. Any ideas?

Reply via email to