Edgewall Software
Modify

Opened 12 years ago

Last modified 11 years ago

#10554 new defect

Cleanup when wsgi.run_once is set in trac.web.main.py

Reported by: kevin.loehmann@… Owned by:
Priority: normal Milestone: undecided
Component: web frontend Version: 0.12-stable
Severity: normal Keywords:
Cc: osimons Branch:
Release Notes:
API Changes:
Internal Changes:

Description

In trac.web.main.py line 482 says:

if env and not run_once:
    env.shutdown(threading._get_ident())
    ...

If I get this right, it performs cleanup / shutdown although the environment is to be cached.

In our test environment I used inverted the condition and trac works much faster (approx. -1 sec. ticket loading time) and had no negative side effects (mixed up sessions, increased thread count, increased memory usage etc.) till now.

This is what I did:

if env and run_once:
    env.shutdown(threading._get_ident())
    ...

Attachments (0)

Change History (2)

comment:1 by osimons, 12 years ago

Cc: osimons added

I think the general idea with run_once is that all will be cleared when the app exits its single run, so nothing in particular to worry about at intermediate stages.

For the env.shutdown() call the major tasks performed is thread-local cleaning of the db and repository pools - which sounds like a good idea to me. However, if this cleaning requires a full second for each request, then certainly the code should at least be reviewed to make sure we aren't too agressive when thread-cleaning.

Last edited 12 years ago by Christian Boos (previous) (diff)

comment:2 by Christian Boos, 11 years ago

Milestone: undecided

All the tickets for {20} from last year have probably been seen multiple times by now, yet are still to be triaged…

Modify Ticket

Change Properties
Set your email in Preferences
Action
as new The ticket will remain with no owner.
The ticket will be disowned.
as The resolution will be set. Next status will be 'closed'.
The owner will be changed from (none) to anonymous. Next status will be 'assigned'.

Add Comment


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