Opened 13 years ago
Last modified 12 years ago
#10554 new defect
Cleanup when wsgi.run_once is set in trac.web.main.py
Reported by: | 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:2 by , 12 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…
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.