Opened 5 years ago

Closed 2 years ago

Last modified 2 years ago

#9984 closed defect (fixed)

trac-admin script hangs when TracDeveloperPlugin is enabled

Reported by: anonymous Owned by: Jun Omae
Priority: normal Component: TracDeveloperPlugin
Severity: normal Keywords:
Cc: Ryan J Ollos Trac Release: 0.12


Then the TracDeveloperPlugin is enabled, the trac-admin script does not exit after it is done. This only happens for trac-admin subcommands that load the plugin, like e.g. trac-admin deploy.

I guess this is because of the thread started by the plugin.

Attachments (0)

Change History (13)

comment:1 Changed 5 years ago by Ryan J Ollos

Cc: Ryan J Ollos added; anonymous removed

comment:2 Changed 5 years ago by Ryan J Ollos

Owner: changed from Alec Thomas to Olemis Lang

comment:3 Changed 3 years ago by Olemis Lang

Owner: changed from Olemis Lang to anonymous
Status: newassigned

comment:4 in reply to:  3 Changed 3 years ago by Ryan J Ollos

Replying to olemis:

  • Owner changed from olemis to anonymous

I've noticed this a few times when you've accepted tickets - if you accept a ticket without logging in, it will be assigned to anonymous. Just fyi. See also #7397 and #11455.

I'll see if we can modify the workflow to avoid this scenario.

comment:5 Changed 3 years ago by Olemis Lang

I can't reproduce this issue running Trac=1.0 . May I close this ticket with resolution=worksforme ?

@rjollos : I typed my user name in author box . So ... maybe this is an issue ?

I'm honestly not keen to login to web sites unless they offer open auth mechanisms e.g. OpenId

comment:6 Changed 3 years ago by Ryan J Ollos

I replied to your comment in comment:2:ticket:11457.

comment:7 Changed 3 years ago by Jun Omae

Owner: changed from anonymous to Olemis Lang

comment:8 in reply to:  5 Changed 2 years ago by Ryan J Ollos

Replying to olemis:

I can't reproduce this issue running Trac=1.0.

Reproduced with Trac trunk (trac:r14100) and TracDeveloperPlugin r14629 using trac-admin deploy. Here is the DEBUG level console output before the hang:

Copying resources from:
Creating scripts.
14:36:15 Trac[__init__] DEBUG: templates=/Users/rjollos/Documents/Workspace/trac-dev/tracdeveloperplugin/trunk/tracdeveloper/dozer/templates

comment:9 Changed 2 years ago by Jun Omae

Reproduced with Trac 1.0.6. I consider that issue must be reproduced with all versions of Trac.

When constructing Dozer component in tracdeveloper/dozer/, the component creates a non-daemon thread. As the result, the python interpreter waits termination of the thread.

  • tracdeveloperplugin/trunk/tracdeveloper/dozer/

    diff --git a/tracdeveloperplugin/trunk/tracdeveloper/dozer/ b/tracdeveloperplugin/trunk/tracdeveloper/dozer/
    index aa1f247..0d9249c 100644
    a b class Dozer(Component): 
    7171        self.history = {}
    7272        self.samples = 0
    7373        self.runthread = threading.Thread(target=self.start)
     74        self.runthread.setDaemon(True)
    7475        self.runthread.start()
    7677    # IRequestHandler methods

Another suggestion is removing ITemplateProvider implementation from the Dozer component (or moving it to another component).

Last edited 2 years ago by Ryan J Ollos (previous) (diff)

comment:10 Changed 2 years ago by Ryan J Ollos

Thank you for the suggestion and patch. How does the following look?

  • tracdeveloper/dozer/

    77from StringIO import StringIO
    88from types import FrameType, ModuleType
    10 from pkg_resources import resource_filename
    1211# import Image
    1312# import ImageDraw
    1514from trac.core import *
    1615from trac.web.api import IRequestHandler, HTTPNotFound, HTTPForbidden
    17 from import ITemplateProvider, add_stylesheet, add_script
     16from import add_stylesheet, add_script
    1918from genshi.core import Markup
    2019from genshi.builder import tag
    2221# from paste import fileapp
    2322# from paste import urlparser
    24 # from pkg_resources import resource_filename
    2523# from webob import Request, Response
    2624# from webob import exc
    6563    period = 5
    6664    maxhistory = 300
    68     implements(IRequestHandler, ITemplateProvider)
     66    implements(IRequestHandler)
    7068    def __init__(self):
    7169        self.history = {}
    7270        self.samples = 0
    7371        self.runthread = threading.Thread(target=self.start)
     72        self.runthread.setDaemon(True)
    7473        self.runthread.start()
    7675    # IRequestHandler methods
    9392        add_stylesheet(req, 'dozer/main.css')
    9493        return method(req)
    96     # ITemplateProvider methods
    97     def get_htdocs_dirs(self):
    98         yield 'dozer', resource_filename(__name__, 'htdocs')
    100     def get_templates_dirs(self):
    101         self.log.debug('templates=%s', resource_filename(__name__, 'templates'))
    102         yield resource_filename(__name__, 'templates')
    10495    # Internal methods
    10596    def start(self):
    10697        self.running = True
  • tracdeveloper/

    4444    def get_templates_dirs(self):
    4545        from pkg_resources import resource_filename
    46         return [resource_filename(__name__, 'templates')]
     46        return [resource_filename('tracdeveloper', 'templates'),
     47                resource_filename('tracdeveloper.dozer', 'templates')]
    4849    def get_htdocs_dirs(self):
    4950        from pkg_resources import resource_filename
    50         return [('developer', resource_filename(__name__, 'htdocs'))]
     51        return [('developer', resource_filename('tracdeveloper', 'htdocs')),
     52                ('dozer', resource_filename('tracdeveloper.dozer', 'htdocs'))]
    5254    # IPreferencePanelProvider methods
    5355    def get_preference_panels(self, req):

comment:11 Changed 2 years ago by Jun Omae

Looks good to me!

comment:12 Changed 2 years ago by Ryan J Ollos

Resolution: fixed
Status: assignedclosed

In 14644:

0.3.0dev: Fix trac-admin script hanging. Fixes #9984.

  • Dozer thread runs in daemon mode.
  • ITemplateProvider moved from dozer to main.

Thanks to Jun Omae for the patch.

comment:13 Changed 2 years ago by Ryan J Ollos

Owner: changed from Olemis Lang to Jun Omae

Modify Ticket

Change Properties
Set your email in Preferences
as closed The owner will remain Jun Omae.
The resolution will be deleted. Next status will be 'reopened'.

Add Comment

E-mail address and name can be saved in the Preferences.

Note: See TracTickets for help on using tickets.