Edgewall Software
Modify

Opened 16 years ago

Closed 16 years ago

#7049 closed defect (fixed)

tracd: --daemonize and --auto-reload don't cohabitate happily

Reported by: bschmer@… Owned by: remy.blank@…
Priority: normal Milestone: 0.11.1
Component: web frontend/tracd Version:
Severity: normal Keywords: patch
Cc: remy.blank@… Branch:
Release Notes:
API Changes:
Internal Changes:

Description (last modified by Emmanuel Blot)

When using —daemonize and —auto-reload at the same time the background daemon process exits neatly without any explanation. Having done some digging around, it seems that the root of the problem is in _restart_with_reloader() at utils/autoreload.py line 55. When os.spawnve is called, it uses the full sys.argv which includes the —daemonize argument. My fix for this is:

eng:util qa$ diff -c autoreload.py autoreload.py.save

*** autoreload.py	Tue Mar 25 16:52:18 2008
--- autoreload.py.save	Tue Mar 25 16:14:51 2008
***************
*** 55,63 ****
  def _restart_with_reloader():
      while True:
          args = [sys.executable] + sys.argv
-         if args.count('--daemonize'):
- 	    # Stop the insanity
- 	    args.remove('--daemonize')
          if sys.platform == 'win32':
              args = ['"%s"' % arg for arg in args]
          new_environ = os.environ.copy()
--- 55,60 ----

eng:util qa$

With the logic for removing these arguments being:

  • The main program already daemonized, so it doesn't need to be done again
  • Things started working more like what I expected after making the change

Attachments (1)

no-auto-reload-deamonize.patch (1.2 KB ) - added by Remy Blank <remy.blank@…> 16 years ago.
Patch against 0.11-stable [7363] disallowing —auto-reload with —deamonize

Download all attachments as: .zip

Change History (7)

comment:1 by Emmanuel Blot, 16 years ago

Description: modified (diff)

in reply to:  description comment:2 by Emmanuel Blot, 16 years ago

Replying to bschmer@yahoo.com:

When using —daemonize and —auto-reload at the same time the background daemon process exits neatly without any explanation.

See ticket:4531:6

comment:3 by Christian Boos, 16 years ago

Milestone: 0.11.1

Things started working more like what I expected after making the change

But what did you expect, precisely? To me, --auto-reload is only meant to be used while developing Trac or plugins, and --daemonize when you use it for "production". Do you have an use case where they would be useful at the same time?

Also pay attention to the fact that --auto-reload has a not so insignificant performance cost, as there will be a process continuously monitoring for source code changes.

So I think we should rather bark when those two options are used together.

(minor nit-pick: please also have a look about how to create nice patches: TracDev/SubmittingPatches)

by Remy Blank <remy.blank@…>, 16 years ago

Patch against 0.11-stable [7363] disallowing —auto-reload with —deamonize

comment:4 by Remy Blank <remy.blank@…>, 16 years ago

Cc: remy.blank@… added
Keywords: patch added

comment:5 by Christian Boos, 16 years ago

Milestone: 0.11.20.11.1
Owner: changed from Jonas Borgström to remy.blank@…
Type: enhancementdefect

I'm OK with the patch. Does anyone has a valid use case for using --daemonize and --auto-reload at the same time? If nobody speaks up, I'll commit the patch for 0.11.1.

comment:6 by Christian Boos, 16 years ago

Resolution: fixed
Status: newclosed

Patch applied in r7380.

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain remy.blank@….
The resolution will be deleted. Next status will be 'reopened'.
to The owner will be changed from remy.blank@… to the specified user.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.