Defect #7002

mysql timeout when first browsing a large git repository

Added by Chunlin Zhang about 9 years ago. Updated almost 9 years ago.

Status:ClosedStart date:2010-11-30
Priority:NormalDue date:
Assignee:-% Done:

0%

Category:SCM
Target version:-
Resolution: Affected version:

Description

This repository has 100000+ files,when firstly browsing it,the browser wait long time and show err:
'''
Internal error
An error occurred on the page you were trying to access.
If you continue to experience problems please contact your redMine administrator for assistance.
Back
'''

And the redmine log err:
'''
Processing RepositoriesController#show (for 10.125.25.55 at 2010-11-29 13:49:16) [GET]
Parameters: {"action"=>"show", "id"=>"android1", "controller"=>"repositories"}

ActiveRecord::StatementInvalid (Mysql::Error: Lock wait timeout exceeded; try restarting transaction: INSERT INTO `changesets` (`committed_on`, `comments`, `commit_date`, `scmid`, `user_id`, `revision`, `repository_id`, `committer`) VALUES('2010-11-25 14:27:10', 'init', '2010-11-25 14:27:10', '6c8534b1713a29cfcc2fdaa7faee604a81fdbbce', 16, '6c8534b1713a29cfcc2fdaa7faee604a81fdbbce', 9, 'zhang <>')):
lib/redmine/scm/adapters/abstract_adapter.rb:298:in `save'
lib/redmine/scm/adapters/abstract_adapter.rb:289:in `save'
app/models/repository/git.rb:65:in `fetch_changesets'
app/models/repository/git.rb:65:in `each'
app/models/repository/git.rb:65:in `fetch_changesets'
app/controllers/repositories_controller.rb:77:in `show'

Rendering D:/webserver/Redmine/public/500.html (500 Internal Server Error)
'''


Related issues

Related to Redmine - Defect #1931: Timeout risks: need asynchronous operations New 2008-09-22
Related to Redmine - Defect #8143: Problem to update subtask Closed 2011-04-13

History

#1 Updated by Chunlin Zhang about 9 years ago

I have try several way to fix this.
At last,I found modify the git_adapter.rb @ 117 to
cmd = "#{GIT_BIN} --git-dir #{target('')} log --no-color --raw --date=iso --pretty=fuller --name-only "

Just add "--name-only",the repository page will get very fast!!

#2 Updated by Toshi MARUYAMA about 9 years ago

  • Category set to SCM

#3 Updated by Toshi MARUYAMA almost 9 years ago

  • Status changed from New to Closed

Please see http://www.redmine.org/projects/redmine/wiki/RedmineRepositories#Attaching-an-existing-repository-to-a-project .

Important: When you first browse the repository, Redmine retrieves the description of all of the existing commits and stores them in the database.

This is done only once per repository but can take a very long time (or even time out) if your repository has hundreds of commits.

To avoid this, you can do it offline.

After having your repository declared in Redmine, run the following command:

$ ruby script/runner "Repository.fetch_changesets" -e production

All commits will be retrieved in to the Redmine database.

Also available in: Atom PDF