GPG support giving Internal Server Errors (500) due to agent socket issues
Summary
Just upgraded to 9.5.0 (omnibus on Debian Stretch) half an hour ago or so.
When adding a GPG key, I received a 500 error the first two or three attempts. After enough refreshes, it finally worked. Then when viewing a signed commit, I received another 500 error. Refreshing got that to work. From the rails production log, these appear to be due to issues with the gpg agent socket.
Steps to reproduce
Appears to only happen once—trying other commits did not reproduce. Neither did gitlab-ctl restart
. Unsure if once per install or what.
Example Project
N/A
What is the current bug behavior?
Error 500 on first few attempts to do a GPG action.
What is the expected correct behavior?
No 500 errors.
Relevant logs and/or screenshots
Error from trying to view commit:
ActionView::Template::Error (No such file or directory @ unlink_internal - /tmp/d20170824-32374-18xyvoi/S.gpg-agent.ssh):
1: .page-content-header.js-commit-box{ 'data-commit-path' => branches_project_commit_path(@project, @commit.id) }
2: .header-main-content
3: = render partial: 'signature', object: @commit.signature
4: %strong
5: #{ s_('CommitBoxTitle|Commit') }
6: %span.commit-sha= @commit.short_id
lib/gitlab/gpg.rb:72:in `optimistic_using_tmp_keychain'
lib/gitlab/gpg.rb:53:in `using_tmp_keychain'
lib/gitlab/gpg.rb:38:in `user_infos_from_key'
app/models/gpg_key.rb:54:in `user_infos'
app/models/gpg_key.rb:58:in `verified_user_infos'
lib/gitlab/gpg/commit.rb:93:in `user_infos'
lib/gitlab/gpg/commit.rb:75:in `attributes'
lib/gitlab/gpg/commit.rb:70:in `block in create_cached_signature!'
lib/gitlab/gpg/commit.rb:58:in `block in using_keychain'
lib/gitlab/gpg.rb:74:in `block in optimistic_using_tmp_keychain'
lib/gitlab/gpg.rb:72:in `optimistic_using_tmp_keychain'
lib/gitlab/gpg.rb:56:in `block in using_tmp_keychain'
lib/gitlab/gpg.rb:55:in `synchronize'
lib/gitlab/gpg.rb:55:in `using_tmp_keychain'
lib/gitlab/gpg/commit.rb:46:in `using_keychain'
lib/gitlab/gpg/commit.rb:69:in `create_cached_signature!'
lib/gitlab/gpg/commit.rb:32:in `signature'
app/models/commit.rb:240:in `signature'
app/views/projects/commit/_commit_box.html.haml:3:in `_app_views_projects_commit__commit_box_html_haml___1175929223260619563_69928823039580'
app/views/projects/commit/show.html.haml:10:in `_app_views_projects_commit_show_html_haml__2998057210535732375_69928828783560'
app/controllers/projects/commit_controller.rb:22:in `show'
lib/gitlab/i18n.rb:46:in `with_locale'
lib/gitlab/i18n.rb:52:in `with_user_locale'
app/controllers/application_controller.rb:326:in `set_locale'
lib/gitlab/middleware/multipart.rb:93:in `call'
lib/gitlab/request_profiler/middleware.rb:14:in `call'
lib/gitlab/middleware/go.rb:16:in `call'
lib/gitlab/etag_caching/middleware.rb:11:in `call'
lib/gitlab/request_context.rb:18:in `call'
lib/gitlab/metrics/requests_rack_middleware.rb:27:in `call'
Error from trying to add a key:
Processing by Profiles::GpgKeysController#create as HTML
Parameters: {"utf8"=>"✓", "authenticity_token"=>"«REDACTED»", "gpg_key"=>"[FILTERED]"}
Completed 500 Internal Server Error in 1630ms (ActiveRecord: 5.0ms)
Errno::ENOENT (No such file or directory @ unlink_internal - /tmp/d20170824-32374-kfgqij/S.gpg-agent.browser):
lib/gitlab/gpg.rb:72:in `optimistic_using_tmp_keychain'
lib/gitlab/gpg.rb:56:in `block in using_tmp_keychain'
lib/gitlab/gpg.rb:55:in `synchronize'
lib/gitlab/gpg.rb:55:in `using_tmp_keychain'
lib/gitlab/gpg.rb:24:in `fingerprints_from_key'
app/models/gpg_key.rb:95:in `extract_fingerprint'
app/controllers/profiles/gpg_keys_controller.rb:12:in `create'
lib/gitlab/i18n.rb:46:in `with_locale'
lib/gitlab/i18n.rb:52:in `with_user_locale'
app/controllers/application_controller.rb:326:in `set_locale'
lib/gitlab/middleware/multipart.rb:93:in `call'
lib/gitlab/request_profiler/middleware.rb:14:in `call'
lib/gitlab/middleware/go.rb:16:in `call'
lib/gitlab/etag_caching/middleware.rb:11:in `call'
lib/gitlab/request_context.rb:18:in `call'
lib/gitlab/metrics/requests_rack_middleware.rb:27:in `call'
Output of checks
(If you are reporting a bug on GitLab.com, write: This bug happens on GitLab.com)
Results of GitLab environment info
Expand for output related to GitLab environment info
System information System: Debian 9.1 Current User: git Using RVM: no Ruby Version: 2.3.3p222 Gem Version: 2.6.6 Bundler Version:1.13.7 Rake Version: 12.0.0 Redis Version: 3.2.5 Git Version: 2.13.5 Sidekiq Version:5.0.4 Go Version: unknownGitLab information Version: 9.5.0 Revision: 77bfdac Directory: /opt/gitlab/embedded/service/gitlab-rails DB Adapter: postgresql URL: https://git.metrics.net HTTP Clone URL: https://git.metrics.net/some-group/some-project.git SSH Clone URL: git@git.metrics.net:some-group/some-project.git Using LDAP: yes Using Omniauth: no
GitLab Shell Version: 5.8.0 Repository storage paths:
- default: /var/opt/gitlab/git-data/repositories Hooks: /opt/gitlab/embedded/service/gitlab-shell/hooks Git: /opt/gitlab/embedded/bin/git
Results of GitLab application Check
Expand for output related to the GitLab application check
Checking GitLab Shell ...
GitLab Shell version >= 5.8.0 ? ... OK (5.8.0) Repo base directory exists? default... yes Repo storage directories are symlinks? default... no Repo paths owned by git:root, or git:git? default... yes Repo paths access is drwxrws---? default... yes hooks directories in repos are links: ... 5/2 ... ok 5/3 ... ok 5/4 ... ok 5/5 ... ok 6/6 ... ok 6/7 ... ok 6/8 ... ok 6/9 ... ok 6/10 ... ok 6/11 ... ok 6/12 ... ok 6/13 ... ok 6/14 ... ok 6/15 ... ok 6/16 ... ok 6/17 ... ok 6/18 ... ok 6/19 ... ok 6/20 ... ok 6/21 ... ok 6/22 ... ok 6/23 ... ok 6/24 ... ok 6/25 ... ok 6/26 ... ok 6/27 ... ok 6/28 ... ok 6/29 ... ok 6/30 ... ok 6/31 ... ok 6/32 ... ok 6/33 ... ok 6/34 ... ok 6/35 ... ok 6/36 ... ok 6/37 ... ok 4/38 ... ok 49/39 ... ok 49/40 ... ok 5/41 ... ok 4/42 ... ok 5/43 ... ok 6/44 ... ok 6/45 ... ok 6/46 ... ok 6/47 ... ok 4/50 ... ok 6/52 ... ok 6/53 ... ok 57/54 ... ok 4/55 ... ok 57/56 ... ok 57/57 ... ok 4/58 ... ok 6/59 ... ok 59/61 ... ok 49/62 ... repository is empty Running /opt/gitlab/embedded/service/gitlab-shell/bin/check Check GitLab API access: OK Access to /var/opt/gitlab/.ssh/authorized_keys: OK Send ping to redis server: OK gitlab-shell self-check successful
Checking GitLab Shell ... Finished
Checking Sidekiq ...
Running? ... yes Number of Sidekiq processes ... 1
Checking Sidekiq ... Finished
Checking Reply by email ...
Reply by email is disabled in config/gitlab.yml
Checking Reply by email ... Finished
Checking LDAP ...
Server: ldapmain not verifying SSL hostname of LDAPS server 'haruhi.metrics.net:636' LDAP authentication... Success LDAP users with access to your GitLab server (only showing the first 100 results) DN: cn=«REDACTED» uid: «REDACTED» ⋮ « 9 more lines redacted »
Checking LDAP ... Finished
Checking GitLab ...
Git configured correctly? ... yes Database config exists? ... yes All migrations up? ... yes Database contains orphaned GroupMembers? ... no GitLab config exists? ... yes GitLab config up to date? ... yes Log directory writable? ... yes Tmp directory writable? ... yes Uploads directory exists? ... yes Uploads directory has correct permissions? ... yes Uploads directory tmp has correct permissions? ... yes Init script exists? ... skipped (omnibus-gitlab has no init script) Init script up-to-date? ... skipped (omnibus-gitlab has no init script) Projects have namespace: ... 5/2 ... yes 5/3 ... yes 5/4 ... yes 5/5 ... yes 6/6 ... yes 6/7 ... yes 6/8 ... yes 6/9 ... yes 6/10 ... yes 6/11 ... yes 6/12 ... yes 6/13 ... yes 6/14 ... yes 6/15 ... yes 6/16 ... yes 6/17 ... yes 6/18 ... yes 6/19 ... yes 6/20 ... yes 6/21 ... yes 6/22 ... yes 6/23 ... yes 6/24 ... yes 6/25 ... yes 6/26 ... yes 6/27 ... yes 6/28 ... yes 6/29 ... yes 6/30 ... yes 6/31 ... yes 6/32 ... yes 6/33 ... yes 6/34 ... yes 6/35 ... yes 6/36 ... yes 6/37 ... yes 4/38 ... yes 49/39 ... yes 49/40 ... yes 5/41 ... yes 4/42 ... yes 5/43 ... yes 6/44 ... yes 6/45 ... yes 6/46 ... yes 6/47 ... yes 4/50 ... yes 6/52 ... yes 6/53 ... yes 57/54 ... yes 4/55 ... yes 57/56 ... yes 57/57 ... yes 4/58 ... yes 6/59 ... yes 59/61 ... yes 49/62 ... yes Redis version >= 2.8.0? ... yes Ruby version >= 2.3.3 ? ... yes (2.3.3) Git version >= 2.7.3 ? ... yes (2.13.5) Active users: ... 44
Checking GitLab ... Finished
Possible fixes
No suggestions, sorry.