Bug #4

Large repositories give 500 Internal Server error

Added by dakota almost 3 years ago. Updated almost 3 years ago.

Status:ClosedStart date:2010-07-27
Priority:NormalDue date:
Assignee:chantra% Done:

100%

Category:SettingsSpent time:-
Target version:0.0.6
Affected Version:

Description

For large repositories an Internal error is generated when trying to download them.

Through testing I have managed to narrow the problem down to repositories that are larger than 5 MB. Is this an intentional limitation?

Is there a way to work around it? Very rare for us to have projects that are that small.

Redmine production.log:

Processing GitrevisionDownloadController#index (for 192.168.3.152 at 2010-07-27 15:34:12) [GET]
  Parameters: {"project_id"=>"3", "rev"=>"master", "action"=>"index", "controller"=>"gitrevision_download"}

Grit::Git::GitTimeout (Grit::Git::GitTimeout):
  grit (2.0.0) lib/grit/git.rb:268:in `sh'
  grit (2.0.0) lib/grit/git.rb:240:in `run'
  grit (2.0.0) lib/grit/git.rb:215:in `method_missing'
  grit (2.0.0) lib/grit/repo.rb:382:in `archive_tar_gz'
  vendor/plugins/redmine_gitrevision_download/app/controllers/gitrevision_download_controller.rb:93:in `index'
  /usr/lib/ruby/1.8/phusion_passenger/rack/request_handler.rb:95:in `process_request'
  /usr/lib/ruby/1.8/phusion_passenger/abstract_request_handler.rb:207:in `main_loop'
  /usr/lib/ruby/1.8/phusion_passenger/railz/application_spawner.rb:374:in `start_request_handler'
  /usr/lib/ruby/1.8/phusion_passenger/railz/application_spawner.rb:332:in `handle_spawn_application'
  /usr/lib/ruby/1.8/phusion_passenger/utils.rb:184:in `safe_fork'
  /usr/lib/ruby/1.8/phusion_passenger/railz/application_spawner.rb:330:in `handle_spawn_application'
  /usr/lib/ruby/1.8/phusion_passenger/abstract_server.rb:352:in `__send__'
  /usr/lib/ruby/1.8/phusion_passenger/abstract_server.rb:352:in `main_loop'
  /usr/lib/ruby/1.8/phusion_passenger/abstract_server.rb:196:in `start_synchronously'
  /usr/lib/ruby/1.8/phusion_passenger/abstract_server.rb:163:in `start'
  /usr/lib/ruby/1.8/phusion_passenger/railz/application_spawner.rb:209:in `start'
  /usr/lib/ruby/1.8/phusion_passenger/spawn_manager.rb:262:in `spawn_rails_application'
  /usr/lib/ruby/1.8/phusion_passenger/abstract_server_collection.rb:126:in `lookup_or_add'
  /usr/lib/ruby/1.8/phusion_passenger/spawn_manager.rb:256:in `spawn_rails_application'
  /usr/lib/ruby/1.8/phusion_passenger/abstract_server_collection.rb:80:in `synchronize'
  /usr/lib/ruby/1.8/phusion_passenger/abstract_server_collection.rb:79:in `synchronize'
  /usr/lib/ruby/1.8/phusion_passenger/spawn_manager.rb:255:in `spawn_rails_application'
  /usr/lib/ruby/1.8/phusion_passenger/spawn_manager.rb:154:in `spawn_application'
  /usr/lib/ruby/1.8/phusion_passenger/spawn_manager.rb:287:in `handle_spawn_application'
  /usr/lib/ruby/1.8/phusion_passenger/abstract_server.rb:352:in `__send__'
  /usr/lib/ruby/1.8/phusion_passenger/abstract_server.rb:352:in `main_loop'
  /usr/lib/ruby/1.8/phusion_passenger/abstract_server.rb:196:in `start_synchronously'
  /usr/lib/phusion_passenger/passenger-spawn-server:61

Rendering /usr/share/redmine/public/500.html (500 Internal Server Error)

History

#1 Updated by chantra almost 3 years ago

  • Status changed from New to In Progress
  • Assignee set to chantra
  • Target version set to 0.0.5

The issue is that Grit is timeouting after some times while archiving the repository:
http://github.com/chantra/redmine_gitrevision_download/blob/0be16b320cd9ad0064d27cb917b05aee327e922f/app/controllers/gitrevision_download_controller.rb#L93

The trick here would be to set the timeout value of Grit higher.

http://grit.rubyforge.org/ might contain just what us needed.

#2 Updated by chantra almost 3 years ago

Hi,

Please download tagged version revision 0.0.5.

You should then be able to boost up the timeout value of Grit.

You will need to db_migrate to get the plugin running.

#3 Updated by dakota almost 3 years ago

Thanks for the super quick response.

Not getting a internal error anymore, at least now getting a friendly error.

I set the timeout to 3600(1 Hour), after 4 minutes I get a error saying it timed out after 3600 seconds.

Looking at the Grit code I think the problem now is due to the response size limit. The repository in question is ~30mb, I believe some of our other repositories are even bigger. If I comment out the max size limit in Grit (lib/grit/git.rb) it works fine (Although it does take a very long time).

#4 Updated by chantra almost 3 years ago

Cool,

Actually, I think I found a way to solve that out.

I will push an update whenever I have time to tweak this.

#5 Updated by chantra almost 3 years ago

Walther,

Could you give a spin to ff0a09c1e6c70dec82f3ac0b56c1c39659d61e4e

This allow to set grit's max_size in bytes.

Let me know if that get you sorted. Tks

#6 Updated by chantra almost 3 years ago

  • Status changed from In Progress to Resolved
  • Target version changed from 0.0.5 to 0.0.6

#7 Updated by chantra almost 3 years ago

  • Category set to Settings

#8 Updated by dakota almost 3 years ago

Works fine now. Thanks.

One alternative possibility to speed things up might be to get Grit to dump the output into a temporary file and pass back the filename. Not sure if this is possible without changing Grit itself though.

#9 Updated by chantra almost 3 years ago

  • Status changed from Resolved to Closed
  • % Done changed from 0 to 100

Walther Lalk wrote:

Works fine now. Thanks.

One alternative possibility to speed things up might be to get Grit to dump the output into a temporary file and pass back the filename. Not sure if this is possible without changing Grit itself though.

Well, archiving to file can be done with http://grit.rubyforge.org/classes/Grit/Repo.html#M000241

But anyhow, grit will still:
  1. create tar archive
  2. optionally pipe that into gzip
  3. write it to a file or return the content in a byte array.

As Grit is using git from command line, i am not sure there is much that can be done in order to improve speed. But maybe it is worth logging a feature request at http://github.com/mojombo/grit/issues.

For now, this ticket will be closed as it is solved by adjusting max_size value.

I might push version 0.0.6 pretty soon.

Tks

Also available in: Atom PDF