Daemonizing and my plugin

View: New views
1 Messages — Rating Filter:   Alert me  

Daemonizing and my plugin

by Thomas Heller-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


(hope this isn't a duplicate, I tried to post via gmane now this goes
via google groups web interface)

I have a cherrypy application that, in addition to the
normal work, needs to respond to UDP broadcasts.

The UDP server is implemented in a SimplePlugin subclass.
The plugin's start() method starts a thread.

However, this doesn't work correctly when the application
is daemonized.  It looks like the thread is started before
the forking occurs.  Here's the logfile (the timestamps
are wrong because this is running on an embedded system
that has no hardware clock):

[01/Jan/1970:01:03:49] ENGINE Listening for SIGHUP.
[01/Jan/1970:01:03:49] ENGINE Listening for SIGTERM.
[01/Jan/1970:01:03:49] ENGINE Listening for SIGUSR1.
[01/Jan/1970:01:03:49] ENGINE Bus STARTING
[01/Jan/1970:01:03:49] ENGINE There are [<_MainThread(MainThread,
started 1073872192)>, <Thread(Thread-1, started daemon 1087337616)>]
active threads. Daemonizing now may cause strange failures.
[01/Jan/1970:01:03:49] ENGINE Forking once.
[01/Jan/1970:01:03:49] ENGINE Forking twice.
[01/Jan/1970:01:03:49] ENGINE Daemonized to PID: 844
[01/Jan/1970:01:03:49] ENGINE PID 844 written to '/var/run/
hvampd.pid'.
[01/Jan/1970:01:03:49] ENGINE Started monitor thread
'_TimeoutMonitor'.
[01/Jan/1970:01:03:49] ENGINE Serving on 0.0.0.0:8080
[01/Jan/1970:01:03:49] ENGINE Bus STARTED


Any ideas how this can be solved?

-- Thanks, Thomas

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