Edgewall Software
Modify

Opened 12 years ago

Closed 12 years ago

Last modified 12 years ago

#10826 closed defect (cantfix)

Unable to find repository '(default)' for synchronization

Reported by: benjamin.a.lau@… Owned by:
Priority: normal Milestone:
Component: version control Version: 1.0dev
Severity: normal Keywords: git needinfo
Cc: benjamin.a.lau@…, leho@…, glinders@… Branch:
Release Notes:
API Changes:
Internal Changes:

Description

So I recently deployed a Trac-1.0beta instance and configured it to use git. I have a large repository and so have been encountering some performance issues… but I thought that 3-4 minutes per action was a bit excessive. I enabled cached_repository and persistent_cache but it still seemed to require several minutes for each page in the source browser to load.

I started poking through the logs and noticed that each time I went to a page that interacted with the git module (source browser, pages with wiki links to the source browser, or the repository admin page) it would take several minutes to load and you'd get a chunk of log that looks like:

2012-08-28 03:50:41,246 Trac[api] WARNING: Unable to find repository '(default)' for synchronization
2012-08-28 03:50:41,247 Trac[session] DEBUG: Retrieving session for ID u'admin'
2012-08-28 03:50:41,248 Trac[api] DEBUG: action controllers for ticket workflow: ['ConfigurableTicketWorkflow']
2012-08-28 03:50:41,259 Trac[git_fs] INFO: detected GIT version 1.7.11.1
2012-08-28 03:50:41,260 Trac[PyGIT2] DEBUG: PyGIT.Storage instance 4334794832 constructed
2012-08-28 03:50:41,261 Trac[PyGIT2] DEBUG: requested weak PyGIT.Storage instance 4334794832 for '/Volumes/SSD/trac/git/server.git'
2012-08-28 03:50:41,261 Trac[git_fs] DEBUG: enabled CachedRepository for '/Volumes/SSD/trac/git/server.git'
2012-08-28 03:50:41,262 Trac[PyGIT2] DEBUG: triggered rebuild of commit tree db for 4334794832
2012-08-28 03:53:02,645 Trac[PyGIT2] DEBUG: rebuilt commit tree db for 4334794832 with 23079 entries (took 141382.5 ms)
2012-08-28 03:53:02,645 Trac[chrome] DEBUG: Prepare chrome data for request

That first line jumped out at me… so I tried creating an alias, "(default)" for my single repository, "server". And that seems to have solved the problem.

I'm guessing there's something funky going on in there that's causing the name to not be read.

Maybe there's a configuration error?

from my trac.ini:

[trac]
repository_dir =
repository_sync_per_request = (default)
repository_type = svn

[git]
cached_repository = true
git_bin = /opt/local/bin/git
persistent_cache = false
shortrev_len = 8
wikishortrev_len = 40

Here's a dump of the repository table in the sqlite db as well. This is after I added an alias for "server" as "(default)":

sqlite> select * from repository;
1|name|server
1|dir|/Volumes/SSD/trac/git/server.git
1|type|git
1|url|
1|description|
1|repository_dir|git:/Volumes/SSD/trac/git/server.git
1|youngest_rev|093090492c88e879327867ce040ae1160f0a209f
2|name|
2|dir|
2|alias|server

If you need any more information or want to point me where to look to try and fix this "the right way" I'd be more than happy to take a look.

Attachments (0)

Change History (13)

comment:1 by Remy Blank, 12 years ago

Keywords: needinfo added

Did you set up post-commit hooks on your repository, to call trac-admin $ENV changeset added as explained on TracRepositoryAdmin? With the default [trac] repository_sync_per_request setting, only the default repository is synchronized with each request, and setting up the alias enabled per-request synchronization on your repository.

You should either set up the post-commit hooks (preferred), or set [trac] repository_sync_per_request = server to enable per-request synchronization on that repository. Then you don't need the alias anymore.

comment:2 by benjamin.a.lau@…, 12 years ago

For the post-commit hook stuff to work, am I correct in assuming that Trac needs to be on the same server that's hosting my git repositories? (This is similar to how it needs to be set up with svn if I remember correct… it's been a while since I used Trac with a repository attached). At the moment I don't have things setup this way and I was trying to just use a static copy of the repository (copied to the server with trac using rsync once a day) until I can relocate it.

If I set the repository_sync_per_request to nothing… will that completely disable that behavior?

For the moment I'm just trying to have some archival information about the repository linked from wiki pages using the source browser… and I'm not concerned about it being up to date with every commit (that'll come next week. ;-)

comment:3 by benjamin.a.lau@…, 12 years ago

Hmm… that doesn't seem to have worked the way I expected. No matter what I do it seems to want to update the repository on every page view. Am I encountering some sort of bug?

comment:4 by Remy Blank, 12 years ago

Setting [trac] repository_sync_per_request = will disable per-request syncing, in which case you must call trac-admin $ENV changeset added.

An alternative, if you are running rsync once a day, is to call trac-admin $ENV repository sync /path/to/repo right after the copy. This should synchronize Trac's state about the repository.

comment:5 by benjamin.a.lau@…, 12 years ago

Some more information…

When I run this same setup using tracd I don't have this problem. The caching seems to work and every time I access the source browser it has the same instance id.

18:41:00 Trac[PyGIT] DEBUG: requested PyGIT.Storage instance 4429488208 for '/trac/server.git'

But when I host under Apache and mod_wsgi every time it tries to access something it seems to have a new instance id.

2012-08-28 21:40:22,056 Trac[main] DEBUG: Dispatching <Request "GET '/browser/server'">
2012-08-28 21:40:22,059 Trac[session] DEBUG: Retrieving session for ID u'ben'
2012-08-28 21:40:22,060 Trac[api] DEBUG: action controllers for ticket workflow: ['ConfigurableTicketWorkflow']
2012-08-28 21:40:22,102 Trac[git_fs] INFO: detected GIT version 1.7.11.1
2012-08-28 21:40:22,103 Trac[PyGIT] DEBUG: PyGIT.Storage instance 4438441552 constructed
2012-08-28 21:40:22,103 Trac[PyGIT] DEBUG: requested PyGIT.Storage instance 4438441552 for '/Volumes/SSD/trac/git/server.git'
2012-08-28 21:40:22,103 Trac[git_fs] DEBUG: enabled CachedRepository for '/Volumes/SSD/trac/git/server.git'
2012-08-28 21:40:22,104 Trac[PyGIT] DEBUG: triggered rebuild of commit tree db for 4438441552
2012-08-28 21:42:44,472 Trac[PyGIT] DEBUG: rebuilt commit tree db for 4438441552 with 23079 entries (took 142367.2 ms)
--
2012-08-28 22:16:05,019 Trac[main] DEBUG: Dispatching <Request "GET '/browser/server/database'">
2012-08-28 22:16:05,022 Trac[session] DEBUG: Retrieving session for ID u'ben'
2012-08-28 22:16:05,023 Trac[api] DEBUG: action controllers for ticket workflow: ['ConfigurableTicketWorkflow']
2012-08-28 22:16:05,130 Trac[git_fs] INFO: detected GIT version 1.7.11.1
2012-08-28 22:16:05,131 Trac[PyGIT] DEBUG: PyGIT.Storage instance 4434264336 constructed
2012-08-28 22:16:05,131 Trac[PyGIT] DEBUG: requested PyGIT.Storage instance 4434264336 for '/Volumes/SSD/trac/git/server.git'
2012-08-28 22:16:05,132 Trac[git_fs] DEBUG: enabled CachedRepository for '/Volumes/SSD/trac/git/server.git'
2012-08-28 22:16:05,133 Trac[PyGIT] DEBUG: triggered rebuild of commit tree db for 4434264336
2012-08-28 22:18:23,761 Trac[PyGIT] DEBUG: rebuilt commit tree db for 4434264336 with 23079 entries (took 138627.8 ms)
--
2012-08-28 22:43:01,068 Trac[main] DEBUG: Dispatching <Request "GET '/browser/server'">
2012-08-28 22:43:01,071 Trac[session] DEBUG: Retrieving session for ID u'ben'
2012-08-28 22:43:01,072 Trac[api] DEBUG: action controllers for ticket workflow: ['ConfigurableTicketWorkflow']
2012-08-28 22:43:01,145 Trac[git_fs] INFO: detected GIT version 1.7.11.1
2012-08-28 22:43:01,146 Trac[PyGIT] DEBUG: PyGIT.Storage instance 4434265104 constructed
2012-08-28 22:43:01,146 Trac[PyGIT] DEBUG: requested PyGIT.Storage instance 4434265104 for '/Volumes/SSD/trac/git/server.git'
2012-08-28 22:43:01,146 Trac[git_fs] DEBUG: enabled CachedRepository for '/Volumes/SSD/trac/git/server.git'
2012-08-28 22:43:01,147 Trac[PyGIT] DEBUG: triggered rebuild of commit tree db for 4434265104
2012-08-28 22:45:19,215 Trac[PyGIT] DEBUG: rebuilt commit tree db for 4434265104 with 23079 entries (took 138067.2 ms)
--
2012-08-28 22:54:44,050 Trac[main] DEBUG: Dispatching <Request "GET '/browser/server/voldemort'">
2012-08-28 22:54:44,052 Trac[session] DEBUG: Retrieving session for ID u'ben'
2012-08-28 22:54:44,053 Trac[api] DEBUG: action controllers for ticket workflow: ['ConfigurableTicketWorkflow']
2012-08-28 22:54:44,098 Trac[git_fs] INFO: detected GIT version 1.7.11.1
2012-08-28 22:54:44,100 Trac[PyGIT] DEBUG: PyGIT.Storage instance 4438092624 constructed
2012-08-28 22:54:44,100 Trac[PyGIT] DEBUG: requested PyGIT.Storage instance 4438092624 for '/Volumes/SSD/trac/git/server.git'
2012-08-28 22:54:44,100 Trac[git_fs] DEBUG: enabled CachedRepository for '/Volumes/SSD/trac/git/server.git'
2012-08-28 22:54:44,101 Trac[PyGIT] DEBUG: triggered rebuild of commit tree db for 4438092624
2012-08-28 22:57:02,053 Trac[PyGIT] DEBUG: rebuilt commit tree db for 4438092624 with 23079 entries (took 137951.6 ms)
--
2012-08-28 22:57:38,860 Trac[main] DEBUG: Dispatching <Request "GET '/browser/server'">
2012-08-28 22:57:38,863 Trac[session] DEBUG: Retrieving session for ID u'ben'
2012-08-28 22:57:38,864 Trac[PyGIT] DEBUG: requested PyGIT.Storage instance 4437687760 for '/Volumes/SSD/trac/git/server.git'
2012-08-28 22:57:38,864 Trac[git_fs] DEBUG: enabled CachedRepository for '/Volumes/SSD/trac/git/server.git'
2012-08-28 22:57:39,466 Trac[chrome] DEBUG: Prepare chrome data for request
2012-08-28 22:57:52,417 Trac[main] DEBUG: Dispatching <Request "GET '/browser/server/amazon-sandbox'">
2012-08-28 22:57:52,420 Trac[session] DEBUG: Retrieving session for ID u'ben'
2012-08-28 22:57:52,421 Trac[api] DEBUG: action controllers for ticket workflow: ['ConfigurableTicketWorkflow']
2012-08-28 22:57:52,432 Trac[git_fs] INFO: detected GIT version 1.7.11.1
2012-08-28 22:57:52,433 Trac[PyGIT] DEBUG: PyGIT.Storage instance 4437012880 constructed
2012-08-28 22:57:52,433 Trac[PyGIT] DEBUG: requested PyGIT.Storage instance 4437012880 for '/Volumes/SSD/trac/git/server.git'
2012-08-28 22:57:52,434 Trac[git_fs] DEBUG: enabled CachedRepository for '/Volumes/SSD/trac/git/server.git'
2012-08-28 22:57:52,435 Trac[PyGIT] DEBUG: triggered rebuild of commit tree db for 4437012880
2012-08-28 22:58:26,436 Trac[main] DEBUG: Dispatching <Request "GET '/chrome/common/expander_normal_hover.png'">
--
2012-08-28 23:02:28,131 Trac[main] DEBUG: Dispatching <Request "GET '/browser/server'">
2012-08-28 23:02:28,134 Trac[session] DEBUG: Retrieving session for ID u'ben'
2012-08-28 23:02:28,135 Trac[api] DEBUG: action controllers for ticket workflow: ['ConfigurableTicketWorkflow']
2012-08-28 23:02:28,171 Trac[git_fs] INFO: detected GIT version 1.7.11.1
2012-08-28 23:02:28,172 Trac[PyGIT] DEBUG: PyGIT.Storage instance 4434264464 constructed
2012-08-28 23:02:28,172 Trac[PyGIT] DEBUG: requested PyGIT.Storage instance 4434264464 for '/Volumes/SSD/trac/git/server.git'
2012-08-28 23:02:28,172 Trac[git_fs] DEBUG: enabled CachedRepository for '/Volumes/SSD/trac/git/server.git'
2012-08-28 23:02:28,173 Trac[PyGIT] DEBUG: triggered rebuild of commit tree db for 4434264464
2012-08-28 23:04:46,265 Trac[PyGIT] DEBUG: rebuilt commit tree db for 4434264464 with 23079 entries (took 138091.4 ms)

It's very strange. So even with "repository_sync_per_request =" it still seems to be syncing every request. I'm going to try setting things up using a proxy to tracd and see if I have similar issues… I guess I could run with tracd directly as well.

comment:6 by Christian Boos, 12 years ago

See TracLogging#LogFormat, and add the PID ($(process)d) to the output. I suppose that due to your mod_wsgi configuration, each of the above request ended up in a different process, the commit tree "db" being an in-memory cache only.

comment:7 by lkraav <leho@…>, 12 years ago

Cc: leho@… added

comment:8 by tuzhilov@…, 12 years ago

I have the same problem. My GIT repository is synced every time I refresh the page, although repository_sync_per_request is set to null. I use mod_wsgi, but the same thing happens with tracd. PID is persistent on every request. DEBUG: requested PyGIT.Storage instance is always different, however with persistent_cache = true it keeps its value, but repository isn't going to refresh in trac even with trac-admin repository resync *. If anybody can help I'd appreciate that.

comment:9 by Geert Linders <glinders@…>, 12 years ago

I have the same problem since we switched to Trac 1.0.

At our company we have around 30 Trac repositories, most of them linked to one or more Mercurial repositories. The ones that have a "(Default)" repository are fine, the ones that don't have a Mercurial repository at all or have multiple Mercurial repositories with different names have the same problem as described above.

It seems as if Trac expects a "(Default)" repository to be present.

comment:10 by Geert Linders <glinders@…>, 12 years ago

Cc: glinders@… added

in reply to:  6 comment:11 by Christian Boos, 12 years ago

Resolution: cantfix
Status: newclosed

Replying to cboos:

See TracLogging#LogFormat, and add the PID ($(process)d) to the output. I suppose that due to your mod_wsgi configuration, each of the above request ended up in a different process, the commit tree "db" being an in-memory cache only.

No feedback on this, closing.

in reply to:  9 comment:12 by Christian Boos, 12 years ago

Replying to Geert Linders <glinders@…>:

I have the same problem since we switched to Trac 1.0.

At our company we have around 30 Trac repositories, most of them linked to one or more Mercurial repositories. The ones that have a "(Default)" repository are fine, the ones that don't have a Mercurial repository at all or have multiple Mercurial repositories with different names have the same problem as described above.

It seems as if Trac expects a "(Default)" repository to be present.

Well, Mercurial repositories aren't cached, to start with.

in reply to:  8 comment:13 by Christian Boos, 12 years ago

Replying to tuzhilov@…:

[…] DEBUG: requested PyGIT.Storage instance is always different, however with persistent_cache = true it keeps its value, but repository isn't going to refresh in trac even with trac-admin repository resync *. If anybody can help I'd appreciate that.

This sounds like #11164.

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The ticket will remain with no owner.
The resolution will be deleted. Next status will be 'reopened'.
to The owner will be changed from (none) 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.