Trac性能:DEBUG ticket_policy语句需要很长时间

时间:2017-11-06 21:37:40

标签: trac

编辑1:发布trac.ini作为答案。

我在运行Apache(WSGI)的Ubuntu 16.04上安装了相对较新的Trac(1.0.9)。目前的安装票数不到40张。在我使用权限(1.5.2b)安装TimingAndEstimationPlugin之前,它运行正常。

报告中出现了特殊问题。例如,当我单击All Tickets报告时,以下操作仅在两秒钟内完成。

2017-11-06 21:13:14,725 Trac[main] DEBUG: Dispatching <RequestWithSession "GET '/report/19'">
2017-11-06 21:13:14,734 Trac[session] DEBUG: Retrieving session for ID u'admin'
2017-11-06 21:13:15,170 Trac[main] DEBUG: Negotiated locale: None -> en_US
2017-11-06 21:13:15,497 Trac[api] WARNING: Unable to find repository '(default)' for synchronization
2017-11-06 21:13:15,499 Trac[ticket_policy] DEBUG: Internal: action:REPORT_VIEW, user:admin, resource:<Resource u'report:19'>, perm: <trac.perm.PermissionCache object at 0x7fab79c74b40>
2017-11-06 21:13:16,141 Trac[report] DEBUG: Report {19} with SQL "SELECT p.value AS __color__,
   id AS ticket, time AS created, summary, t.type AS type, owner, status, keywords, component, version, milestone,
   changetime AS _changetime, description AS _description,
   reporter AS _reporter
  FROM ticket t
  LEFT JOIN enum p ON p.name = t.priority AND p.type = 'priority'
  ORDER BY  ticket desc
"
2017-11-06 21:13:16,144 Trac[report] DEBUG: Request args: {'id': u'19'}
2017-11-06 21:13:16,145 Trac[report] DEBUG: Report {19} SQL (count): SELECT COUNT(*) FROM (
SELECT p.value AS __color__,
   id AS ticket, time AS created, summary, t.type AS type, owner, status, keywords, component, version, milestone,
   changetime AS _changetime, description AS _description,
   reporter AS _reporter
  FROM ticket t
  LEFT JOIN enum p ON p.name = t.priority AND p.type = 'priority'
  ORDER BY  ticket desc

) AS tab
2017-11-06 21:13:16,356 Trac[report] DEBUG: Report {19} SQL (col names): SELECT * FROM (
SELECT p.value AS __color__,
   id AS ticket, time AS created, summary, t.type AS type, owner, status, keywords, component, version, milestone,
   changetime AS _changetime, description AS _description,
   reporter AS _reporter
  FROM ticket t
  LEFT JOIN enum p ON p.name = t.priority AND p.type = 'priority'
  ORDER BY  ticket desc

) AS tab LIMIT 1
2017-11-06 21:13:16,463 Trac[report] DEBUG: [u'__color__', u'ticket', u'created', u'summary', u'type', u'owner', u'status', u'keywords', u'component', u'version', u'milestone', u'_changetime', u'_description', u'_reporter']  (^)
2017-11-06 21:13:16,464 Trac[report] DEBUG: Report {19} SQL (order + limit): SELECT p.value AS __color__,
   id AS ticket, time AS created, summary, t.type AS type, owner, status, keywords, component, version, milestone,
   changetime AS _changetime, description AS _description,
   reporter AS _reporter
  FROM ticket t
  LEFT JOIN enum p ON p.name = t.priority AND p.type = 'priority'
  ORDER BY  ticket desc

然后它开始在日志中打印以下语句,需要很长时间才能完成。

2017-11-06 21:13:17,944 Trac[ticket_policy] DEBUG: Internal: action:TICKET_VIEW, user:admin, resource:<Resource u'ticket:35'>, perm: <trac.perm.PermissionCache object at 0x7fab79d55780>
2017-11-06 21:13:18,573 Trac[ticket_policy] DEBUG: Internal: RESULTS for TICKET_VIEW: None
2017-11-06 21:13:18,574 Trac[ticket_policy] DEBUG: Internal: action:EMAIL_VIEW, user:admin, resource:<Resource u'ticket:35'>, perm: <trac.perm.PermissionCache object at 0x7fab79d55780>
2017-11-06 21:13:19,202 Trac[ticket_policy] DEBUG: Internal: RESULTS for EMAIL_VIEW: None
2017-11-06 21:13:19,203 Trac[ticket_policy] DEBUG: Internal: action:TICKET_VIEW, user:admin, resource:<Resource u'ticket:34'>, perm: <trac.perm.PermissionCache object at 0x7fab79d55410>
2017-11-06 21:13:19,829 Trac[ticket_policy] DEBUG: Internal: RESULTS for TICKET_VIEW: None
2017-11-06 21:13:19,830 Trac[ticket_policy] DEBUG: Internal: action:EMAIL_VIEW, user:admin, resource:<Resource u'ticket:34'>, perm: <trac.perm.PermissionCache object at 0x7fab79d55410>
2017-11-06 21:13:20,455 Trac[ticket_policy] DEBUG: Internal: RESULTS for EMAIL_VIEW: None
2017-11-06 21:13:20,457 Trac[ticket_policy] DEBUG: Internal: action:TICKET_VIEW, user:admin, resource:<Resource u'ticket:33'>, perm: <trac.perm.PermissionCache object at 0x7fab79d55500>
2017-11-06 21:13:21,083 Trac[ticket_policy] DEBUG: Internal: RESULTS for TICKET_VIEW: None
2017-11-06 21:13:21,086 Trac[ticket_policy] DEBUG: Internal: action:EMAIL_VIEW, user:admin, resource:<Resource u'ticket:33'>, perm: <trac.perm.PermissionCache object at 0x7fab79d55500>
2017-11-06 21:13:21,715 Trac[ticket_policy] DEBUG: Internal: RESULTS for EMAIL_VIEW: None
2017-11-06 21:13:21,716 Trac[ticket_policy] DEBUG: Internal: action:TICKET_VIEW, user:admin, resource:<Resource u'ticket:32'>, perm: <trac.perm.PermissionCache object at 0x7fab79d55370>
2017-11-06 21:13:22,342 Trac[ticket_policy] DEBUG: Internal: RESULTS for TICKET_VIEW: None
2017-11-06 21:13:22,342 Trac[ticket_policy] DEBUG: Internal: action:EMAIL_VIEW, user:admin, resource:<Resource u'ticket:32'>, perm: <trac.perm.PermissionCache object at 0x7fab79d55370>
2017-11-06 21:13:22,971 Trac[ticket_policy] DEBUG: Internal: RESULTS for EMAIL_VIEW: None
2017-11-06 21:13:22,972 Trac[ticket_policy] DEBUG: Internal: action:TICKET_VIEW, user:admin, resource:<Resource u'ticket:31'>, perm: <trac.perm.PermissionCache object at 0x7fab79c4d280>
2017-11-06 21:13:23,602 Trac[ticket_policy] DEBUG: Internal: RESULTS for TICKET_VIEW: None
2017-11-06 21:13:23,603 Trac[ticket_policy] DEBUG: Internal: action:EMAIL_VIEW, user:admin, resource:<Resource u'ticket:31'>, perm: <trac.perm.PermissionCache object at 0x7fab79c4d280>
2017-11-06 21:13:24,233 Trac[ticket_policy] DEBUG: Internal: RESULTS for EMAIL_VIEW: None
2017-11-06 21:13:24,234 Trac[ticket_policy] DEBUG: Internal: action:TICKET_VIEW, user:admin, resource:<Resource u'ticket:30'>, perm: <trac.perm.PermissionCache object at 0x7fab79c4d4b0>
2017-11-06 21:13:24,860 Trac[ticket_policy] DEBUG: Internal: RESULTS for TICKET_VIEW: None
2017-11-06 21:13:24,861 Trac[ticket_policy] DEBUG: Internal: action:EMAIL_VIEW, user:admin, resource:<Resource u'ticket:30'>, perm: <trac.perm.PermissionCache object at 0x7fab79c4d4b0>
2017-11-06 21:13:25,489 Trac[ticket_policy] DEBUG: Internal: RESULTS for EMAIL_VIEW: None
2017-11-06 21:13:25,490 Trac[ticket_policy] DEBUG: Internal: action:TICKET_VIEW, user:admin, resource:<Resource u'ticket:29'>, perm: <trac.perm.PermissionCache object at 0x7fab79c4d9b0>
2017-11-06 21:13:26,119 Trac[ticket_policy] DEBUG: Internal: RESULTS for TICKET_VIEW: None
2017-11-06 21:13:26,121 Trac[ticket_policy] DEBUG: Internal: action:EMAIL_VIEW, user:admin, resource:<Resource u'ticket:29'>, perm: <trac.perm.PermissionCache object at 0x7fab79c4d9b0>
2017-11-06 21:13:26,748 Trac[ticket_policy] DEBUG: Internal: RESULTS for EMAIL_VIEW: None
2017-11-06 21:13:26,750 Trac[ticket_policy] DEBUG: Internal: action:TICKET_VIEW, user:admin, resource:<Resource u'ticket:28'>, perm: <trac.perm.PermissionCache object at 0x7fab79c4da50>
2017-11-06 21:13:27,381 Trac[ticket_policy] DEBUG: Internal: RESULTS for TICKET_VIEW: None
2017-11-06 21:13:27,381 Trac[ticket_policy] DEBUG: Internal: action:EMAIL_VIEW, user:admin, resource:<Resource u'ticket:28'>, perm: <trac.perm.PermissionCache object at 0x7fab79c4da50>
2017-11-06 21:13:28,008 Trac[ticket_policy] DEBUG: Internal: RESULTS for EMAIL_VIEW: None
2017-11-06 21:13:28,009 Trac[ticket_policy] DEBUG: Internal: action:TICKET_VIEW, user:admin, resource:<Resource u'ticket:27'>, perm: <trac.perm.PermissionCache object at 0x7fab79c02910>
2017-11-06 21:13:28,637 Trac[ticket_policy] DEBUG: Internal: RESULTS for TICKET_VIEW: None
2017-11-06 21:13:28,639 Trac[ticket_policy] DEBUG: Internal: action:EMAIL_VIEW, user:admin, resource:<Resource u'ticket:27'>, perm: <trac.perm.PermissionCache object at 0x7fab79c02910>
2017-11-06 21:13:29,269 Trac[ticket_policy] DEBUG: Internal: RESULTS for EMAIL_VIEW: None
2017-11-06 21:13:29,271 Trac[ticket_policy] DEBUG: Internal: action:TICKET_VIEW, user:admin, resource:<Resource u'ticket:26'>, perm: <trac.perm.PermissionCache object at 0x7fab79c02820>
2017-11-06 21:13:29,902 Trac[ticket_policy] DEBUG: Internal: RESULTS for TICKET_VIEW: None
2017-11-06 21:13:29,904 Trac[ticket_policy] DEBUG: Internal: action:EMAIL_VIEW, user:admin, resource:<Resource u'ticket:26'>, perm: <trac.perm.PermissionCache object at 0x7fab79c02820>
2017-11-06 21:13:30,533 Trac[ticket_policy] DEBUG: Internal: RESULTS for EMAIL_VIEW: None
2017-11-06 21:13:30,537 Trac[ticket_policy] DEBUG: Internal: action:TICKET_VIEW, user:admin, resource:<Resource u'ticket:25'>, perm: <trac.perm.PermissionCache object at 0x7fab79c02500>
2017-11-06 21:13:31,169 Trac[ticket_policy] DEBUG: Internal: RESULTS for TICKET_VIEW: None
2017-11-06 21:13:31,171 Trac[ticket_policy] DEBUG: Internal: action:EMAIL_VIEW, user:admin, resource:<Resource u'ticket:25'>, perm: <trac.perm.PermissionCache object at 0x7fab79c02500>
2017-11-06 21:13:31,802 Trac[ticket_policy] DEBUG: Internal: RESULTS for EMAIL_VIEW: None
2017-11-06 21:13:31,805 Trac[ticket_policy] DEBUG: Internal: action:TICKET_VIEW, user:admin, resource:<Resource u'ticket:24'>, perm: <trac.perm.PermissionCache object at 0x7fab79c02b90>
2017-11-06 21:13:32,438 Trac[ticket_policy] DEBUG: Internal: RESULTS for TICKET_VIEW: None
2017-11-06 21:13:32,440 Trac[ticket_policy] DEBUG: Internal: action:EMAIL_VIEW, user:admin, resource:<Resource u'ticket:24'>, perm: <trac.perm.PermissionCache object at 0x7fab79c02b90>
2017-11-06 21:13:33,072 Trac[ticket_policy] DEBUG: Internal: RESULTS for EMAIL_VIEW: None
2017-11-06 21:13:33,074 Trac[ticket_policy] DEBUG: Internal: action:TICKET_VIEW, user:admin, resource:<Resource u'ticket:23'>, perm: <trac.perm.PermissionCache object at 0x7fab79c02410>
2017-11-06 21:13:33,705 Trac[ticket_policy] DEBUG: Internal: RESULTS for TICKET_VIEW: None
2017-11-06 21:13:33,707 Trac[ticket_policy] DEBUG: Internal: action:EMAIL_VIEW, user:admin, resource:<Resource u'ticket:23'>, perm: <trac.perm.PermissionCache object at 0x7fab79c02410>
2017-11-06 21:13:34,339 Trac[ticket_policy] DEBUG: Internal: RESULTS for EMAIL_VIEW: None
2017-11-06 21:13:34,341 Trac[ticket_policy] DEBUG: Internal: action:TICKET_VIEW, user:admin, resource:<Resource u'ticket:22'>, perm: <trac.perm.PermissionCache object at 0x7fab79c02190>
2017-11-06 21:13:34,972 Trac[ticket_policy] DEBUG: Internal: RESULTS for TICKET_VIEW: None
2017-11-06 21:13:34,974 Trac[ticket_policy] DEBUG: Internal: action:EMAIL_VIEW, user:admin, resource:<Resource u'ticket:22'>, perm: <trac.perm.PermissionCache object at 0x7fab79c02190>
2017-11-06 21:13:35,606 Trac[ticket_policy] DEBUG: Internal: RESULTS for EMAIL_VIEW: None
2017-11-06 21:13:35,608 Trac[ticket_policy] DEBUG: Internal: action:TICKET_VIEW, user:admin, resource:<Resource u'ticket:21'>, perm: <trac.perm.PermissionCache object at 0x7fab79c02e60>
2017-11-06 21:13:36,240 Trac[ticket_policy] DEBUG: Internal: RESULTS for TICKET_VIEW: None
2017-11-06 21:13:36,241 Trac[ticket_policy] DEBUG: Internal: action:EMAIL_VIEW, user:admin, resource:<Resource u'ticket:21'>, perm: <trac.perm.PermissionCache object at 0x7fab79c02e60>
2017-11-06 21:13:36,869 Trac[ticket_policy] DEBUG: Internal: RESULTS for EMAIL_VIEW: None
2017-11-06 21:13:36,871 Trac[ticket_policy] DEBUG: Internal: action:TICKET_VIEW, user:admin, resource:<Resource u'ticket:20'>, perm: <trac.perm.PermissionCache object at 0x7fab79c028c0>
2017-11-06 21:13:37,499 Trac[ticket_policy] DEBUG: Internal: RESULTS for TICKET_VIEW: None
2017-11-06 21:13:37,501 Trac[ticket_policy] DEBUG: Internal: action:EMAIL_VIEW, user:admin, resource:<Resource u'ticket:20'>, perm: <trac.perm.PermissionCache object at 0x7fab79c028c0>
2017-11-06 21:13:38,139 Trac[ticket_policy] DEBUG: Internal: RESULTS for EMAIL_VIEW: None
2017-11-06 21:13:38,141 Trac[ticket_policy] DEBUG: Internal: action:TICKET_VIEW, user:admin, resource:<Resource u'ticket:19'>, perm: <trac.perm.PermissionCache object at 0x7fab79c02640>
2017-11-06 21:13:38,772 Trac[ticket_policy] DEBUG: Internal: RESULTS for TICKET_VIEW: None
2017-11-06 21:13:38,774 Trac[ticket_policy] DEBUG: Internal: action:EMAIL_VIEW, user:admin, resource:<Resource u'ticket:19'>, perm: <trac.perm.PermissionCache object at 0x7fab79c02640>
2017-11-06 21:13:39,403 Trac[ticket_policy] DEBUG: Internal: RESULTS for EMAIL_VIEW: None
2017-11-06 21:13:39,405 Trac[ticket_policy] DEBUG: Internal: action:TICKET_VIEW, user:admin, resource:<Resource u'ticket:18'>, perm: <trac.perm.PermissionCache object at 0x7fab79c02b40>
2017-11-06 21:13:40,037 Trac[ticket_policy] DEBUG: Internal: RESULTS for TICKET_VIEW: None
2017-11-06 21:13:40,038 Trac[ticket_policy] DEBUG: Internal: action:EMAIL_VIEW, user:admin, resource:<Resource u'ticket:18'>, perm: <trac.perm.PermissionCache object at 0x7fab79c02b40>
2017-11-06 21:13:40,667 Trac[ticket_policy] DEBUG: Internal: RESULTS for EMAIL_VIEW: None
2017-11-06 21:13:40,668 Trac[ticket_policy] DEBUG: Internal: action:TICKET_VIEW, user:admin, resource:<Resource u'ticket:17'>, perm: <trac.perm.PermissionCache object at 0x7fab79d108c0>
2017-11-06 21:13:41,297 Trac[ticket_policy] DEBUG: Internal: RESULTS for TICKET_VIEW: None
2017-11-06 21:13:41,298 Trac[ticket_policy] DEBUG: Internal: action:EMAIL_VIEW, user:admin, resource:<Resource u'ticket:17'>, perm: <trac.perm.PermissionCache object at 0x7fab79d108c0>
2017-11-06 21:13:41,924 Trac[ticket_policy] DEBUG: Internal: RESULTS for EMAIL_VIEW: None
2017-11-06 21:13:41,925 Trac[ticket_policy] DEBUG: Internal: action:TICKET_VIEW, user:admin, resource:<Resource u'ticket:16'>, perm: <trac.perm.PermissionCache object at 0x7fab79d10a50>
2017-11-06 21:13:42,551 Trac[ticket_policy] DEBUG: Internal: RESULTS for TICKET_VIEW: None
2017-11-06 21:13:42,552 Trac[ticket_policy] DEBUG: Internal: action:EMAIL_VIEW, user:admin, resource:<Resource u'ticket:16'>, perm: <trac.perm.PermissionCache object at 0x7fab79d10a50>
2017-11-06 21:13:43,179 Trac[ticket_policy] DEBUG: Internal: RESULTS for EMAIL_VIEW: None
2017-11-06 21:13:43,181 Trac[ticket_policy] DEBUG: Internal: action:TICKET_VIEW, user:admin, resource:<Resource u'ticket:15'>, perm: <trac.perm.PermissionCache object at 0x7fab79d10af0>
2017-11-06 21:13:43,811 Trac[ticket_policy] DEBUG: Internal: RESULTS for TICKET_VIEW: None
2017-11-06 21:13:43,813 Trac[ticket_policy] DEBUG: Internal: action:EMAIL_VIEW, user:admin, resource:<Resource u'ticket:15'>, perm: <trac.perm.PermissionCache object at 0x7fab79d10af0>
2017-11-06 21:13:44,445 Trac[ticket_policy] DEBUG: Internal: RESULTS for EMAIL_VIEW: None
2017-11-06 21:13:44,447 Trac[ticket_policy] DEBUG: Internal: action:TICKET_VIEW, user:admin, resource:<Resource u'ticket:14'>, perm: <trac.perm.PermissionCache object at 0x7fab79d102d0>
2017-11-06 21:13:45,083 Trac[ticket_policy] DEBUG: Internal: RESULTS for TICKET_VIEW: None
2017-11-06 21:13:45,085 Trac[ticket_policy] DEBUG: Internal: action:EMAIL_VIEW, user:admin, resource:<Resource u'ticket:14'>, perm: <trac.perm.PermissionCache object at 0x7fab79d102d0>
2017-11-06 21:13:45,716 Trac[ticket_policy] DEBUG: Internal: RESULTS for EMAIL_VIEW: None
2017-11-06 21:13:45,718 Trac[ticket_policy] DEBUG: Internal: action:TICKET_VIEW, user:admin, resource:<Resource u'ticket:13'>, perm: <trac.perm.PermissionCache object at 0x7fab79d10230>
2017-11-06 21:13:46,352 Trac[ticket_policy] DEBUG: Internal: RESULTS for TICKET_VIEW: None
2017-11-06 21:13:46,355 Trac[ticket_policy] DEBUG: Internal: action:EMAIL_VIEW, user:admin, resource:<Resource u'ticket:13'>, perm: <trac.perm.PermissionCache object at 0x7fab79d10230>
2017-11-06 21:13:46,986 Trac[ticket_policy] DEBUG: Internal: RESULTS for EMAIL_VIEW: None
2017-11-06 21:13:46,991 Trac[ticket_policy] DEBUG: Internal: action:TICKET_VIEW, user:admin, resource:<Resource u'ticket:12'>, perm: <trac.perm.PermissionCache object at 0x7fab79d100a0>
2017-11-06 21:13:47,623 Trac[ticket_policy] DEBUG: Internal: RESULTS for TICKET_VIEW: None
2017-11-06 21:13:47,624 Trac[ticket_policy] DEBUG: Internal: action:EMAIL_VIEW, user:admin, resource:<Resource u'ticket:12'>, perm: <trac.perm.PermissionCache object at 0x7fab79d100a0>
2017-11-06 21:13:48,254 Trac[ticket_policy] DEBUG: Internal: RESULTS for EMAIL_VIEW: None
2017-11-06 21:13:48,256 Trac[ticket_policy] DEBUG: Internal: action:TICKET_VIEW, user:admin, resource:<Resource u'ticket:11'>, perm: <trac.perm.PermissionCache object at 0x7fab79d10d70>
2017-11-06 21:13:48,885 Trac[ticket_policy] DEBUG: Internal: RESULTS for TICKET_VIEW: None
2017-11-06 21:13:48,887 Trac[ticket_policy] DEBUG: Internal: action:EMAIL_VIEW, user:admin, resource:<Resource u'ticket:11'>, perm: <trac.perm.PermissionCache object at 0x7fab79d10d70>
2017-11-06 21:13:49,517 Trac[ticket_policy] DEBUG: Internal: RESULTS for EMAIL_VIEW: None
2017-11-06 21:13:49,519 Trac[ticket_policy] DEBUG: Internal: action:TICKET_VIEW, user:admin, resource:<Resource u'ticket:10'>, perm: <trac.perm.PermissionCache object at 0x7fab79d10460>
2017-11-06 21:13:50,150 Trac[ticket_policy] DEBUG: Internal: RESULTS for TICKET_VIEW: None
2017-11-06 21:13:50,152 Trac[ticket_policy] DEBUG: Internal: action:EMAIL_VIEW, user:admin, resource:<Resource u'ticket:10'>, perm: <trac.perm.PermissionCache object at 0x7fab79d10460>
2017-11-06 21:13:50,783 Trac[ticket_policy] DEBUG: Internal: RESULTS for EMAIL_VIEW: None
2017-11-06 21:13:50,785 Trac[ticket_policy] DEBUG: Internal: action:TICKET_VIEW, user:admin, resource:<Resource u'ticket:9'>, perm: <trac.perm.PermissionCache object at 0x7fab79d10c30>
2017-11-06 21:13:51,417 Trac[ticket_policy] DEBUG: Internal: RESULTS for TICKET_VIEW: None
2017-11-06 21:13:51,422 Trac[ticket_policy] DEBUG: Internal: action:EMAIL_VIEW, user:admin, resource:<Resource u'ticket:9'>, perm: <trac.perm.PermissionCache object at 0x7fab79d10c30>
2017-11-06 21:13:52,053 Trac[ticket_policy] DEBUG: Internal: RESULTS for EMAIL_VIEW: None
2017-11-06 21:13:52,055 Trac[ticket_policy] DEBUG: Internal: action:TICKET_VIEW, user:admin, resource:<Resource u'ticket:8'>, perm: <trac.perm.PermissionCache object at 0x7fab79d101e0>
2017-11-06 21:13:52,684 Trac[ticket_policy] DEBUG: Internal: RESULTS for TICKET_VIEW: None
2017-11-06 21:13:52,687 Trac[ticket_policy] DEBUG: Internal: action:EMAIL_VIEW, user:admin, resource:<Resource u'ticket:8'>, perm: <trac.perm.PermissionCache object at 0x7fab79d101e0>
2017-11-06 21:13:53,317 Trac[ticket_policy] DEBUG: Internal: RESULTS for EMAIL_VIEW: None
2017-11-06 21:13:53,320 Trac[ticket_policy] DEBUG: Internal: action:TICKET_VIEW, user:admin, resource:<Resource u'ticket:7'>, perm: <trac.perm.PermissionCache object at 0x7fab79d10500>
2017-11-06 21:13:53,950 Trac[ticket_policy] DEBUG: Internal: RESULTS for TICKET_VIEW: None
2017-11-06 21:13:53,951 Trac[ticket_policy] DEBUG: Internal: action:EMAIL_VIEW, user:admin, resource:<Resource u'ticket:7'>, perm: <trac.perm.PermissionCache object at 0x7fab79d10500>
2017-11-06 21:13:54,581 Trac[ticket_policy] DEBUG: Internal: RESULTS for EMAIL_VIEW: None
2017-11-06 21:13:54,584 Trac[ticket_policy] DEBUG: Internal: action:TICKET_VIEW, user:admin, resource:<Resource u'ticket:6'>, perm: <trac.perm.PermissionCache object at 0x7fab79d10190>
2017-11-06 21:13:55,215 Trac[ticket_policy] DEBUG: Internal: RESULTS for TICKET_VIEW: None
2017-11-06 21:13:55,216 Trac[ticket_policy] DEBUG: Internal: action:EMAIL_VIEW, user:admin, resource:<Resource u'ticket:6'>, perm: <trac.perm.PermissionCache object at 0x7fab79d10190>
2017-11-06 21:13:55,847 Trac[ticket_policy] DEBUG: Internal: RESULTS for EMAIL_VIEW: None
2017-11-06 21:13:55,849 Trac[ticket_policy] DEBUG: Internal: action:TICKET_VIEW, user:admin, resource:<Resource u'ticket:5'>, perm: <trac.perm.PermissionCache object at 0x7fab79d10640>
2017-11-06 21:13:56,482 Trac[ticket_policy] DEBUG: Internal: RESULTS for TICKET_VIEW: None
2017-11-06 21:13:56,485 Trac[ticket_policy] DEBUG: Internal: action:EMAIL_VIEW, user:admin, resource:<Resource u'ticket:5'>, perm: <trac.perm.PermissionCache object at 0x7fab79d10640>
2017-11-06 21:13:57,117 Trac[ticket_policy] DEBUG: Internal: RESULTS for EMAIL_VIEW: None
2017-11-06 21:13:57,119 Trac[ticket_policy] DEBUG: Internal: action:TICKET_VIEW, user:admin, resource:<Resource u'ticket:4'>, perm: <trac.perm.PermissionCache object at 0x7fab7a0a3690>
2017-11-06 21:13:57,748 Trac[ticket_policy] DEBUG: Internal: RESULTS for TICKET_VIEW: None
2017-11-06 21:13:57,749 Trac[ticket_policy] DEBUG: Internal: action:EMAIL_VIEW, user:admin, resource:<Resource u'ticket:4'>, perm: <trac.perm.PermissionCache object at 0x7fab7a0a3690>
2017-11-06 21:13:58,378 Trac[ticket_policy] DEBUG: Internal: RESULTS for EMAIL_VIEW: None
2017-11-06 21:13:58,380 Trac[ticket_policy] DEBUG: Internal: action:TICKET_VIEW, user:admin, resource:<Resource u'ticket:3'>, perm: <trac.perm.PermissionCache object at 0x7fab7a07df00>
2017-11-06 21:13:59,009 Trac[ticket_policy] DEBUG: Internal: RESULTS for TICKET_VIEW: None
2017-11-06 21:13:59,010 Trac[ticket_policy] DEBUG: Internal: action:EMAIL_VIEW, user:admin, resource:<Resource u'ticket:3'>, perm: <trac.perm.PermissionCache object at 0x7fab7a07df00>
2017-11-06 21:13:59,639 Trac[ticket_policy] DEBUG: Internal: RESULTS for EMAIL_VIEW: None
2017-11-06 21:13:59,640 Trac[ticket_policy] DEBUG: Internal: action:TICKET_VIEW, user:admin, resource:<Resource u'ticket:2'>, perm: <trac.perm.PermissionCache object at 0x7fab7a07d4b0>
2017-11-06 21:14:00,268 Trac[ticket_policy] DEBUG: Internal: RESULTS for TICKET_VIEW: None
2017-11-06 21:14:00,269 Trac[ticket_policy] DEBUG: Internal: action:EMAIL_VIEW, user:admin, resource:<Resource u'ticket:2'>, perm: <trac.perm.PermissionCache object at 0x7fab7a07d4b0>
2017-11-06 21:14:00,896 Trac[ticket_policy] DEBUG: Internal: RESULTS for EMAIL_VIEW: None
2017-11-06 21:14:00,898 Trac[ticket_policy] DEBUG: Internal: action:TICKET_VIEW, user:admin, resource:<Resource u'ticket:1'>, perm: <trac.perm.PermissionCache object at 0x7fab79bb3e10>
2017-11-06 21:14:01,528 Trac[ticket_policy] DEBUG: Internal: RESULTS for TICKET_VIEW: None
2017-11-06 21:14:01,530 Trac[ticket_policy] DEBUG: Internal: action:EMAIL_VIEW, user:admin, resource:<Resource u'ticket:1'>, perm: <trac.perm.PermissionCache object at 0x7fab79bb3e10>
2017-11-06 21:14:02,161 Trac[ticket_policy] DEBUG: Internal: RESULTS for EMAIL_VIEW: None
2017-11-06 21:14:02,165 Trac[chrome] DEBUG: Prepare chrome data for request
2017-11-06 21:14:02,168 Trac[ticket_policy] DEBUG: Internal: action:REPORT_VIEW, user:admin, resource:None, perm: <trac.perm.PermissionCache object at 0x7fab79c74b90>
2017-11-06 21:14:02,170 Trac[ticket_policy] DEBUG: Internal: action:TIME_VIEW, user:admin, resource:None, perm: <trac.perm.PermissionCache object at 0x7fab79c74b90>
2017-11-06 21:14:02,172 Trac[ticket_policy] DEBUG: Internal: action:TRAC_ADMIN, user:admin, resource:<Resource u'admin:general/basics'>, perm: <trac.perm.PermissionCache object at 0x7fab79fc41e0>
2017-11-06 21:14:02,173 Trac[ticket_policy] DEBUG: Internal: action:TRAC_ADMIN, user:admin, resource:<Resource u'admin:general/logging'>, perm: <trac.perm.PermissionCache object at 0x7fab7a0e9b90>
2017-11-06 21:14:02,174 Trac[ticket_policy] DEBUG: Internal: action:PERMISSION_GRANT, user:admin, resource:<Resource u'admin:general/perm'>, perm: <trac.perm.PermissionCache object at 0x7fab79fa9870>
2017-11-06 21:14:02,175 Trac[ticket_policy] DEBUG: Internal: action:TRAC_ADMIN, user:admin, resource:<Resource u'admin:general/plugin'>, perm: <trac.perm.PermissionCache object at 0x7fab79c4ebe0>
2017-11-06 21:14:02,177 Trac[ticket_policy] DEBUG: Internal: action:TICKET_ADMIN, user:admin, resource:<Resource u'admin:ticket/components'>, perm: <trac.perm.PermissionCache object at 0x7fab79c4ee10>
2017-11-06 21:14:02,178 Trac[ticket_policy] DEBUG: Internal: action:MILESTONE_VIEW, user:admin, resource:<Resource u'admin:ticket/milestones'>, perm: <trac.perm.PermissionCache object at 0x7fab79c4ee10>
2017-11-06 21:14:02,179 Trac[ticket_policy] DEBUG: Internal: action:TICKET_ADMIN, user:admin, resource:<Resource u'admin:ticket/milestones'>, perm: <trac.perm.PermissionCache object at 0x7fab7a15b8c0>
2017-11-06 21:14:02,179 Trac[ticket_policy] DEBUG: Internal: action:TICKET_ADMIN, user:admin, resource:<Resource u'admin:ticket/versions'>, perm: <trac.perm.PermissionCache object at 0x7fab7a15b460>
2017-11-06 21:14:02,180 Trac[ticket_policy] DEBUG: Internal: action:TICKET_ADMIN, user:admin, resource:<Resource u'admin:ticket/priority'>, perm: <trac.perm.PermissionCache object at 0x7fab7a15b730>
2017-11-06 21:14:02,181 Trac[ticket_policy] DEBUG: Internal: action:TICKET_ADMIN, user:admin, resource:<Resource u'admin:ticket/resolution'>, perm: <trac.perm.PermissionCache object at 0x7fab79e868c0>
2017-11-06 21:14:02,182 Trac[ticket_policy] DEBUG: Internal: action:TICKET_ADMIN, user:admin, resource:<Resource u'admin:ticket/severity'>, perm: <trac.perm.PermissionCache object at 0x7fab79ddd8c0>
2017-11-06 21:14:02,183 Trac[ticket_policy] DEBUG: Internal: action:TICKET_ADMIN, user:admin, resource:<Resource u'admin:ticket/type'>, perm: <trac.perm.PermissionCache object at 0x7fab79dddb90>
2017-11-06 21:14:02,185 Trac[ticket_policy] DEBUG: Internal: action:SEARCH_VIEW, user:admin, resource:None, perm: <trac.perm.PermissionCache object at 0x7fab79c74b90>
2017-11-06 21:14:02,186 Trac[ticket_policy] DEBUG: Internal: action:TICKET_VIEW, user:admin, resource:None, perm: <trac.perm.PermissionCache object at 0x7fab79c74b90>
2017-11-06 21:14:02,187 Trac[ticket_policy] DEBUG: Internal: action:ROADMAP_VIEW, user:admin, resource:None, perm: <trac.perm.PermissionCache object at 0x7fab79c74b90>
2017-11-06 21:14:02,189 Trac[ticket_policy] DEBUG: Internal: action:TICKET_CREATE, user:admin, resource:None, perm: <trac.perm.PermissionCache object at 0x7fab79c74b90>
2017-11-06 21:14:02,190 Trac[ticket_policy] DEBUG: Internal: action:TIMELINE_VIEW, user:admin, resource:None, perm: <trac.perm.PermissionCache object at 0x7fab79c74b90>
2017-11-06 21:14:02,506 Trac[ticket_policy] DEBUG: Internal: action:WIKI_VIEW, user:admin, resource:<Resource u'wiki:WikiStart'>, perm: <trac.perm.PermissionCache object at 0x7fab7a0856e0>
2017-11-06 21:14:02,508 Trac[ticket_policy] DEBUG: Internal: action:WIKI_VIEW, user:admin, resource:<Resource u'wiki:TracGuide'>, perm: <trac.perm.PermissionCache object at 0x7fab7a040140>
2017-11-06 21:14:02,513 Trac[ticket_policy] DEBUG: Internal: action:REPORT_SQL_VIEW, user:admin, resource:<Resource u'report:19'>, perm: <trac.perm.PermissionCache object at 0x7fab79feffa0>
2017-11-06 21:14:02,618 Trac[ticket_policy] DEBUG: Internal: action:EMAIL_VIEW, user:admin, resource:None, perm: <trac.perm.PermissionCache object at 0x7fab79c74b90>
2017-11-06 21:14:02,720 Trac[blackmagic] DEBUG: IN BlackMagic
2017-11-06 21:14:02,721 Trac[blackmagic] DEBUG: Not a ticket returning
2017-11-06 21:14:02,721 Trac[tande_filters] DEBUG: TicketFormatFilter executing
2017-11-06 21:14:02,722 Trac[tande_filters] DEBUG: TicketFormatFilter not the correct template
2017-11-06 21:14:02,722 Trac[tande_filters] DEBUG: Not a query returning
2017-11-06 21:14:02,722 Trac[tande_filters] DEBUG: Not a timeline, returning
2017-11-06 21:14:02,723 Trac[reports_filter] DEBUG: ReportScreenFilter: About to begin filtering of billing reports without permissions
2017-11-06 21:14:02,789 Trac[reports_filter] DEBUG: ReportScreenFilter: helper: [('TEXT', u'{19} All tickets', ('/usr/lib/python2.7/dist-packages/trac/ticket/templates/report_view.html', 30, -1)), ('TEXT', u'\n        ', ('/usr/lib/python2.7/dist-packages/trac/ticket/templates/report_view.html', 30, 4))] {19} All tickets 19
2017-11-06 21:14:02,797 Trac[ticket_policy] DEBUG: Internal: action:REPORT_MODIFY, user:admin, resource:<Resource u'report:19'>, perm: <trac.perm.PermissionCache object at 0x7fab79b17be0>
2017-11-06 21:14:02,800 Trac[ticket_policy] DEBUG: Internal: action:REPORT_CREATE, user:admin, resource:<Resource u'report:19'>, perm: <trac.perm.PermissionCache object at 0x7fab79b17cd0>
2017-11-06 21:14:02,803 Trac[ticket_policy] DEBUG: Internal: action:REPORT_DELETE, user:admin, resource:<Resource u'report:19'>, perm: <trac.perm.PermissionCache object at 0x7fab79b17dc0>
2017-11-06 21:14:03,781 Trac[reports_filter] DEBUG: ReportScreenFilter: id:19, in bill: False   has perm:True

从请求到显示结果的时间几乎需要分钟。这非常令人沮丧,使得Trac几乎无法使用。我想这可能与缓存或其他东西有关。如果您需要我的安装中的更多信息,请通知我。提前致谢。

2 个答案:

答案 0 :(得分:0)

# -*- coding: utf-8 -*-

[attachment]
max_size = 10485760
max_zip_size = 10485760
render_unsafe_content = disabled

[browser]
color_scale = enabled
downloadable_paths = /trunk,/branches/*,/tags/*
hide_properties = svk:merge
intermediate_color = 
intermediate_point = 
newest_color = (255, 136, 136)
oldest_color = (136, 136, 255)
oneliner_properties = trac:summary
render_unsafe_content = disabled
wiki_properties = trac:description

[changeset]
max_diff_bytes = 10000000
max_diff_files = 0
wiki_format_messages = enabled

[components]
timingandestimationplugin.stopwatch.ticketstopwatch = disabled
trac.db.mysql_backend.mysqlconnector = disabled
trac.db.sqlite_backend.sqliteconnector = disabled
trac.versioncontrol.admin.repositoryadminpanel = disabled
trac.versioncontrol.admin.versioncontroladmin = disabled
trac.versioncontrol.web_ui.main.versioncontrolui = disabled
trachtmlnotification.* = enabled
tracopt.versioncontrol.git.* = disabled
tracopt.versioncontrol.svn.* = disabled

[field settings]
billable.permission = TIME_VIEW:hide, TIME_RECORD:disable
estimatedhours.permission = TIME_RECORD:disable
fields = billable, totalhours, hours, estimatedhours, internal
hours.permission = TIME_VIEW:remove, TIME_RECORD:disable
internal.permission = TIME_RECORD:hide

[gitweb-repositories]
projects_base = 
projects_list = 
projects_url = 
sync_per_request = 

[header_logo]
alt = (please configure the [header_logo] section in trac.ini)
height = -1
link = 
src = site/cropped-logo-1.png
width = -1

[inherit]
htdocs_dir = 
plugins_dir = 
templates_dir = 

[logging]
log_file = trac.log
log_level = DEBUG
log_type = file

[mainnav]
browser.order = 4.0
newticket.order = 6.0
roadmap.order = 3.0
search.order = 7.0
tickets.order = 5.0
timeline.order = 2.0
wiki.order = 1.0

[metanav]
about.order = 5.0
help.order = 4.0
login.order = 1.0
logout.order = 2.0
prefs.order = 3.0

[milestone]
stats_provider = DefaultTicketGroupStatsProvider

[mimeviewer]
max_preview_size = 262144
mime_map = text/x-dylan:dylan,text/x-idl:ice,text/x-ada:ads:adb
mime_map_patterns = text/plain:README|INSTALL|COPYING.*
pygments_default_style = trac
pygments_modes = 
tab_width = 8
treat_as_binary = application/octet-stream,application/pdf,application/postscript,application/msword,application/rtf

[notification]
admit_domains = 
ambiguous_char_width = single
batch_subject_template = $prefix Batch modify: $tickets_descr
email_sender = HtmlNotificationSmtpEmailSender
ignore_domains = 
mime_encoding = none
smtp_always_bcc = 
smtp_always_cc = 
smtp_default_domain = removed
smtp_enabled = enabled
smtp_from = removed
smtp_from_author = disabled
smtp_from_name = removed
smtp_password = removed
smtp_port = 25
smtp_replyto = removed
smtp_server = removed
smtp_subject_prefix = __default__
smtp_user = removed
ticket_subject_template = $prefix #$ticket.id: $summary
use_public_cc = disabled
use_short_addr = disabled
use_tls = disabled

[notification-subscriber]
always_notify_cc = CarbonCopySubscriber
always_notify_owner = TicketOwnerSubscriber
always_notify_previous_updater = TicketPreviousUpdatersSubscriber
always_notify_updater = TicketUpdaterSubscriber

[project]
admin = 
admin_trac_url = .
descr = removed
footer = removed
icon = site/cropped-Logo-32x32.png
name = removed
url = 

[query]
default_anonymous_query = status!=closed&cc~=$USER
default_query = status!=closed&owner=$USER
items_per_page = 100
ticketlink_query = ?status=!closed

[report]
items_per_page = 100
items_per_page_rss = 0

[revisionlog]
default_log_limit = 100
graph_colors = #cc0,#0c0,#0cc,#00c,#c0c,#c00

[roadmap]
stats_provider = DefaultTicketGroupStatsProvider

[search]
min_query_length = 3

[slack]
channel = #trac
fields = type,component,resolution
username = Trac-Bot
webhook = removed

[svn]
authz_file = 
authz_module_name = 

[ticket]
default_cc = 
default_component = 
default_description = 
default_keywords = 
default_milestone = 
default_owner = < default >
default_priority = major
default_resolution = resolved
default_severity = 
default_summary = 
default_type = defect
default_version = 
max_comment_size = 262144
max_description_size = 262144
max_summary_size = 262144
preserve_newlines = default
restrict_owner = disabled
workflow = ConfigurableTicketWorkflow

[ticket-custom]
billable = checkbox
billable.label = Billable?
billable.order = 3
billable.value = 1
branch_prefix = text
branch_prefix.label = Branch Prefix
estimatedhours = text
estimatedhours.label = Estimated Number of Hours
estimatedhours.order = 1
estimatedhours.value = 0
hours = text
hours.label = Add Hours to Ticket
hours.order = 2
hours.value = 0
internal = checkbox
internal.label = Internal?
internal.order = 5
internal.value = 0
totalhours = text
totalhours.label = Total Hours
totalhours.order = 4
totalhours.value = 0

[ticket-workflow]
accept = new,assigned,accepted,reopened -> accepted
accept.operations = set_owner_to_self
accept.permissions = TICKET_MODIFY
create = <none> -> new
create.default = 1
create_and_assign = <none> -> assigned
create_and_assign.label = assign
create_and_assign.operations = may_set_owner
create_and_assign.permissions = TICKET_MODIFY
leave = * -> *
leave.default = 1
leave.operations = leave_status
reassign = new,assigned,accepted,reopened -> assigned
reassign.operations = set_owner
reassign.permissions = TICKET_MODIFY
reopen = closed -> reopened
reopen.operations = del_resolution
reopen.permissions = TICKET_CREATE
resolve = new,assigned,accepted,reopened -> closed
resolve.operations = set_resolution
resolve.permissions = TICKET_MODIFY

[timeline]
abbreviated_messages = enabled
changeset_collapse_events = disabled
changeset_long_messages = disabled
changeset_show_files = 0
default_daysback = 30
max_daysback = 90
newticket_formatter = oneliner
ticket_show_details = disabled

[trac]
auth_cookie_lifetime = 0
auth_cookie_path = 
auto_preview_timeout = 2.0
auto_reload = disabled
backup_dir = db
base_url = removed
check_auth_ip = disabled
database = removed
debug_sql = disabled
default_charset = utf-8
default_date_format = 
default_dateinfo_format = relative
default_handler = WikiModule
default_language = 
default_timezone = 
genshi_cache_size = 128
htdocs_location = 
ignore_auth_case = disabled
jquery_location = 
jquery_ui_location = 
jquery_ui_theme_location = 
mysqldump_path = mysqldump
never_obfuscate_mailto = disabled
permission_policies = InternalTicketsPolicy,DefaultPermissionPolicy,LegacyAttachmentPolicy
permission_store = DefaultPermissionStore
pg_dump_path = pg_dump
resizable_textareas = enabled
secure_cookies = disabled
show_email_addresses = disabled
show_ip_addresses = disabled
timeout = 20
use_base_url_for_redirect = disabled
use_chunked_encoding = disabled
use_xsendfile = disabled
wiki_toolbars = enabled
xsendfile_header = X-Sendfile

[versioncontrol]
allowed_repository_dir_prefixes = 
default_repository_type = git

[wiki]
ignore_missing_pages = disabled
max_size = 262144
render_unsafe_content = disabled
safe_schemes = cvs,file,ftp,git,irc,http,https,news,sftp,smb,ssh,svn,svn+ssh
split_page_names = disabled

答案 1 :(得分:0)

我们需要关注如下所示的线对:

2017-11-18 06:19:43,502 Trac[ticket_policy] DEBUG: Internal: action:TICKET_VIEW, user:user2, resource:<Resource u'ticket:4'>, perm: <trac.perm.PermissionCache object at 0x110b7a960>
2017-11-18 06:19:43,504 Trac[ticket_policy] DEBUG: Internal: RESULTS for TICKET_VIEW: None

这些是由我的Trac测试实例输出的。请注意,经过的时间是2毫秒,而在您的情况下,它超过500毫秒。这些行是从ticket_policy.py记录的。我猜测时间花在check_ticket_access上,但我认为没有理由放慢速度。

我们可以通过设置[trac] debug_sql = enabled来获取更多日志记录信息。您应该能够获得与单个故障单上的权限检查相关联的查询的输出,如下所示:

2017-11-18 06:25:32,671 Trac[ticket_policy] DEBUG: Internal: action:TICKET_VIEW, user:user2, resource:<Resource u'ticket:4'>, perm: <trac.perm.PermissionCache object at 0x110ea6eb0>
2017-11-18 06:25:32,673 Trac[util] DEBUG: SQL: SELECT summary,reporter,owner,description,type,status,priority,milestone,component,version,resolution,keywords,cc,time,changetime FROM ticket WHERE id=%s
2017-11-18 06:25:32,674 Trac[util] DEBUG: args: (4,)
2017-11-18 06:25:32,674 Trac[util] DEBUG: prefetch: 1 rows
2017-11-18 06:25:32,674 Trac[util] DEBUG: SQL:
                SELECT name, value FROM ticket_custom WHERE ticket=%s

2017-11-18 06:25:32,675 Trac[util] DEBUG: args: (4,)
2017-11-18 06:25:32,675 Trac[util] DEBUG: prefetch: 4 rows
2017-11-18 06:25:32,675 Trac[ticket_policy] DEBUG: Internal: RESULTS for TICKET_VIEW: None

请为单个故障单发布类似的输出,而不是发布所有调试输出。看看时间花在哪里会很有趣,我们只需看InternalTicketsPolicy处理单张票。

请通过编辑帖子将输出添加到原始问题的末尾,而不是发布作为问题的答案(尽管我现在看到由于限制而在第一种情况下是必要的问题的长度)。

还请提及您正在使用的数据库。