Skip to content

Getting 404 errors on repository pages with redmine 3.3.1 and redmine-git-hosting 1.2.3 #715

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
lelutin opened this issue May 7, 2018 · 4 comments

Comments

@lelutin
Copy link

lelutin commented May 7, 2018

Hi there,

I'm having issues where repository pages show a 404 error. In redmine's production.log file I can see this:

Started GET "/projects/projectname/repository" for 0.0.0.0 at 2018-05-07 17:11:18 -0400
Processing by RepositoriesController#show as HTML
  Parameters: {"id"=>"projectname"}
  Current user: username (id=116)
Completed 404 Not Found in 203ms (ActiveRecord: 145.5ms)

ActiveRecord::RecordNotFound (Couldn't find all GitCaches with 'id': (last, {:order=>"created_at DESC"}) (found 0 results, but was looking for 2)):
  plugins/redmine_git_hosting/lib/redmine_git_hosting/cache/database.rb:53:in `apply_cache_limit'
  plugins/redmine_git_hosting/lib/redmine_git_hosting/cache.rb:15:in `set_cache'
  plugins/redmine_git_hosting/lib/redmine_git_hosting/shell_redirector.rb:124:in `exit_shell'
  plugins/redmine_git_hosting/lib/redmine_git_hosting/shell_redirector.rb:47:in `execute'
  plugins/redmine_git_hosting/lib/redmine/scm/adapters/xitolite_adapter.rb:510:in `git_cmd'
  plugins/redmine_git_hosting/lib/redmine/scm/adapters/xitolite_adapter.rb:185:in `lastrev'
  plugins/redmine_git_hosting/lib/redmine/scm/adapters/xitolite_adapter.rb:167:in `block (2 levels) in entries'
  plugins/redmine_git_hosting/lib/redmine_git_hosting/shell_redirector.rb:279:in `block in each_line'
  plugins/redmine_git_hosting/lib/redmine_git_hosting/shell_redirector.rb:277:in `each_line'
  plugins/redmine_git_hosting/lib/redmine_git_hosting/shell_redirector.rb:277:in `each_line'
  plugins/redmine_git_hosting/lib/redmine/scm/adapters/xitolite_adapter.rb:149:in `block in entries'
  plugins/redmine_git_hosting/lib/redmine_git_hosting/shell_redirector.rb:46:in `execute'
  plugins/redmine_git_hosting/lib/redmine/scm/adapters/xitolite_adapter.rb:510:in `git_cmd'
  plugins/redmine_git_hosting/lib/redmine/scm/adapters/xitolite_adapter.rb:148:in `entries'
  app/models/repository/git.rb:97:in `scm_entries'
  app/models/repository.rb:205:in `entries'
  app/controllers/repositories_controller.rb:116:in `show'
  plugins/redmine_git_hosting/lib/redmine_git_hosting/patches/repositories_controller_patch.rb:40:in `show_with_git_hosting'
  lib/redmine/sudo_mode.rb:63:in `sudo_mode'

The problem is exactly the same as described in #681 however we're already using gitolite v3 (3.6.6). I've also tried resync'ing repositories, clearing git caches and it somewhat helps but the issue comes back, and repositories that were showing up alright sometimes end up showing a 404 again.

My colleague found out that every time we hit refresh on that 404 page, one more cache line shows up for the repository: for one more file, or one more commit, or one more blob.. and at some point after forcing the plugin to add more cache lines that way there ends up being enough information for it to show the repository page! ... but as I said the problem comes back, and for repositories with a lot of files and revisions that's sure to become a big issue.

Here's the Gemfile.lock that we have in /usr/share/redmine. I can give you more info if needed (I'm not sure what command to issue to get more relevant info):

GIT
  remote: https://github.com/jbox-web/gitolite-rugged.git
  revision: 551741d1df06f6e386bc23461c7bfcac3dfb28b2
  tag: 1.2.0
  specs:
    gitolite-rugged (1.2.0)
      gratr19 (~> 0.4.4, >= 0.4.4.1)
      rugged (~> 0.22, >= 0.22.2)

GIT
  remote: https://github.com/jbox-web/grack.git
  revision: 1bc51d833970d8544790198cc1d75310dd835175
  branch: fix_rails4
  specs:
    gitlab-grack (2.0.0.pre)
      rack (~> 1.6.0)

GEM
  remote: https://rubygems.org/
  specs:
    RedCloth (4.3.2)
    actionmailer (4.2.7.1)
      actionpack (= 4.2.7.1)
      actionview (= 4.2.7.1)
      activejob (= 4.2.7.1)
      mail (~> 2.5, >= 2.5.4)
      rails-dom-testing (~> 1.0, >= 1.0.5)
    actionpack (4.2.7.1)
      actionview (= 4.2.7.1)
      activesupport (= 4.2.7.1)
      rack (~> 1.6)
      rack-test (~> 0.6.2)
      rails-dom-testing (~> 1.0, >= 1.0.5)
      rails-html-sanitizer (~> 1.0, >= 1.0.2)
    actionpack-action_caching (1.1.1)
      actionpack (>= 4.0.0, < 5.0)
    actionpack-xml_parser (1.0.2)
      actionpack (>= 4.0.0, < 5)
    actionview (4.2.7.1)
      activesupport (= 4.2.7.1)
      builder (~> 3.1)
      erubis (~> 2.7.0)
      rails-dom-testing (~> 1.0, >= 1.0.5)
      rails-html-sanitizer (~> 1.0, >= 1.0.2)
    activejob (4.2.7.1)
      activesupport (= 4.2.7.1)
      globalid (>= 0.3.0)
    activemodel (4.2.7.1)
      activesupport (= 4.2.7.1)
      builder (~> 3.1)
    activerecord (4.2.7.1)
      activemodel (= 4.2.7.1)
      activesupport (= 4.2.7.1)
      arel (~> 6.0)
    activesupport (4.2.7.1)
      i18n (~> 0.7)
      json (>= 1.7.7)
      minitest (~> 5.1)
      thread_safe (~> 0.3, >= 0.3.4)
      tzinfo (~> 1.1)
    addressable (2.4.0)
    arel (6.0.3)
    asciidoctor (1.5.6.1)
    builder (3.2.2)
    coderay (1.1.1)
    concurrent-ruby (1.0.0)
    creole (0.5.0)
    css_parser (1.3.6)
      addressable
    dalli (2.7.6)
    erubis (2.7.0)
    github-markup (2.0.0)
    globalid (0.3.6)
      activesupport (>= 4.1.0)
    gratr19 (0.4.4.1)
    haml (5.0.4)
      temple (>= 0.8.0)
      tilt
    haml-rails (1.0.0)
      actionpack (>= 4.0.1)
      activesupport (>= 4.0.1)
      haml (>= 4.0.6, < 6.0)
      html2haml (>= 1.0.1)
      railties (>= 4.0.1)
    hiredis (0.6.1)
    html2haml (2.2.0)
      erubis (~> 2.7.0)
      haml (>= 4.0, < 6)
      nokogiri (>= 1.6.0)
      ruby_parser (~> 3.5)
    htmlentities (4.3.3)
    i18n (0.7.0)
    jquery-rails (4.2.1)
      rails-dom-testing (>= 1, < 3)
      railties (>= 4.2.0)
      thor (>= 0.14, < 2.0)
    json (2.0.1)
    loofah (2.0.3)
      nokogiri (>= 1.5.9)
    mail (2.6.4)
      mime-types (>= 1.16, < 4)
    mime-types (2.6.1)
    mimemagic (0.3.0)
    minitest (5.9.0)
    mysql2 (0.4.5)
    net-ldap (0.12.1)
    nokogiri (1.6.8.1)
    org-ruby (0.9.12)
      rubypants (~> 0.2)
    protected_attributes (1.1.3)
      activemodel (>= 4.0.1, < 5.0)
    rack (1.6.4)
    rack-openid (1.4.2)
      rack (>= 1.1.0)
      ruby-openid (>= 2.1.8)
    rack-parser (0.7.0)
      rack
    rack-test (0.6.3)
      rack (>= 1.0)
    rails (4.2.7.1)
      actionmailer (= 4.2.7.1)
      actionpack (= 4.2.7.1)
      actionview (= 4.2.7.1)
      activejob (= 4.2.7.1)
      activemodel (= 4.2.7.1)
      activerecord (= 4.2.7.1)
      activesupport (= 4.2.7.1)
      bundler (>= 1.3.0, < 2.0)
      railties (= 4.2.7.1)
      sprockets-rails
    rails-deprecated_sanitizer (1.0.3)
      activesupport (>= 4.2.0.alpha)
    rails-dom-testing (1.0.6)
      activesupport (>= 4.2.0.beta, < 5.0)
      nokogiri (~> 1.6.0)
      rails-deprecated_sanitizer (>= 1.0.1)
    rails-html-sanitizer (1.0.3)
      loofah (~> 2.0)
    railties (4.2.7.1)
      actionpack (= 4.2.7.1)
      activesupport (= 4.2.7.1)
      rake (>= 0.8.7)
      thor (>= 0.18.1, < 2.0)
    rake (10.5.0)
    rbpdf (1.19.0)
      htmlentities (>= 4.3.1)
      rbpdf-font (~> 1.19.0)
    rbpdf-font (1.19.0)
    rdoc (4.3.0)
    redcarpet (3.3.4)
    redis (4.0.1)
    request_store (1.3.0)
    rmagick (2.16.0)
    roadie (3.1.1)
      css_parser (~> 1.3.4)
      nokogiri (>= 1.5.0, < 1.7.0)
    roadie-rails (1.1.0)
      railties (>= 3.0, < 4.3)
      roadie (~> 3.1)
    ruby-openid (2.7.0)
    ruby_parser (3.10.1)
      sexp_processor (~> 4.9)
    rubypants (0.6.0)
    rugged (0.26.0)
    sexp_processor (4.10.0)
    sprockets (3.7.0)
      concurrent-ruby (~> 1.0)
      rack (> 1, < 3)
    sprockets-rails (2.3.2)
      actionpack (>= 3.0)
      activesupport (>= 3.0)
      sprockets (>= 2.8, < 4.0)
    temple (0.8.0)
    thor (0.19.1)
    thread_safe (0.3.5)
    tilt (2.0.8)
    tzinfo (1.2.2)
      thread_safe (~> 0.1)
    will_paginate (3.1.6)

PLATFORMS
  ruby

DEPENDENCIES
  RedCloth
  actionpack-action_caching
  actionpack-xml_parser
  activerecord-jdbc-adapter (~> 1.3.2)
  activerecord-jdbcmysql-adapter
  asciidoctor
  builder (>= 3.0.4)
  coderay (~> 1.1.1)
  creole
  dalli
  github-markup
  gitlab-grack!
  gitolite-rugged!
  haml-rails
  hiredis
  jquery-rails (~> 4.0)
  mime-types
  mimemagic
  mysql2 (~> 0.4.0)
  net-ldap (~> 0.8)
  nokogiri (>= 1.6.7.2)
  org-ruby
  protected_attributes
  rack-openid
  rack-parser
  rails (~> 4.2.7)
  rails-html-sanitizer (>= 1.0.3)
  rbpdf (~> 1.19.0)
  rdoc (~> 4.3)
  redcarpet (~> 3.2)
  redis
  request_store (~> 1.1)
  rmagick (>= 2.14.0)
  roadie-rails
  ruby-openid (~> 2.3)
  tzinfo-data
  will_paginate

BUNDLED WITH
   1.13.6
@lelutin
Copy link
Author

lelutin commented May 7, 2018

fwiw redmine and gitolite were installed with the debian packages from stretch

@Stevehans
Copy link

We're seeing the same problem but with redmine 3.2.4 and xitolite 2.7.4

@kienanstewart
Copy link

Same issue that @lelutin had: ended up switching to memcache for the caching and haven't had any problems at all.

@PowerKiKi
Copy link
Collaborator

As discussed in #732 (comment), issues related to Redmine < 4.0 or severely outdated issues are being closed to help clean up the issue tracker.

If this issue is still relevant to you and you are running Redmine >= 4.0, please open a new issue including all new relevant information.

dosyfier added a commit to dosyfier/redmine_git_hosting that referenced this issue Apr 4, 2020
…for GitCache objects

This caused frequent 404 errors on the "Repository" view whenever
GitCache needed to be purged.
PowerKiKi added a commit that referenced this issue Jun 28, 2020
Fix #715 by correcting misuse of ActiveRecord API for GitCache objects
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants