PostReceive fails on commits that reference an external issue tracker "undefined method `primary_key' for ExternalIssue:Class"
Summary:
Any commit message pushed to Gitlab that contains a reference to an external issue tracker as #X causes PostReceive to fail, preventing any other services from running and not updating the activity feed.
Steps to reproduce:
With an external issue tracker configured (I have tested with both Redmine and Custom), push a commit with any text in the body and reference an issue number. The issue number does not have to be valid, simply "#1 (closed)" is sufficient. A commit without "#X" is unaffected.
Expected behavior:
Naturally, I expect the commit to be processed normally, with "#X" becoming a link to the external issue tracker in web views, and for the activity feed to show the pushed commit.
Log:
2015-05-28_20:42:24.01644 2015-05-28T20:42:24.016Z 306 TID-7ryhk PostReceive JID- INFO: fail: 0.848 sec
2015-05-28_20:42:24.01780 2015-05-28T20:42:24.017Z 306 TID-7ryhk WARN: {"class"=>"PostReceive", "args"=>["/var/opt/gitlab/git-data/repositories/redacted-group/redacted-project.git", "key-2", "redacted-key"]}
2015-05-28_20:42:24.01796 2015-05-28T20:42:24.017Z 306 TID-7ryhk WARN: undefined method `primary_key' for ExternalIssue:Class
2015-05-28_20:42:24.01816 2015-05-28T20:42:24.018Z 306 TID-7ryhk WARN: /opt/gitlab/embedded/service/gem/ruby/2.1.0/gems/attr_encrypted-1.3.4/lib/attr_encrypted.rb:259:in `method_missing'
2015-05-28_20:42:24.01817 /opt/gitlab/embedded/service/gem/ruby/2.1.0/gems/activerecord-4.1.9/lib/active_record/reflection.rb:504:in `primary_key'
2015-05-28_20:42:24.01818 /opt/gitlab/embedded/service/gem/ruby/2.1.0/gems/activerecord-4.1.9/lib/active_record/reflection.rb:272:in `association_primary_key'
2015-05-28_20:42:24.01818 /opt/gitlab/embedded/service/gem/ruby/2.1.0/gems/activerecord-4.1.9/lib/active_record/associations/belongs_to_association.rb:70:in `replace_keys'
2015-05-28_20:42:24.01819 /opt/gitlab/embedded/service/gem/ruby/2.1.0/gems/activerecord-4.1.9/lib/active_record/associations/belongs_to_polymorphic_association.rb:13:in `replace_keys'
2015-05-28_20:42:24.01819 /opt/gitlab/embedded/service/gem/ruby/2.1.0/gems/activerecord-4.1.9/lib/active_record/associations/belongs_to_association.rb:14:in `replace'
2015-05-28_20:42:24.01820 /opt/gitlab/embedded/service/gem/ruby/2.1.0/gems/activerecord-4.1.9/lib/active_record/associations/singular_association.rb:17:in `writer'
2015-05-28_20:42:24.01820 /opt/gitlab/embedded/service/gem/ruby/2.1.0/gems/activerecord-4.1.9/lib/active_record/associations/builder/association.rb:118:in `noteable='
2015-05-28_20:42:24.01821 /opt/gitlab/embedded/service/gem/ruby/2.1.0/gems/activerecord-4.1.9/lib/active_record/attribute_assignment.rb:45:in `public_send'
2015-05-28_20:42:24.01822 /opt/gitlab/embedded/service/gem/ruby/2.1.0/gems/activerecord-4.1.9/lib/active_record/attribute_assignment.rb:45:in `_assign_attribute'
2015-05-28_20:42:24.01823 /opt/gitlab/embedded/service/gem/ruby/2.1.0/gems/activerecord-4.1.9/lib/active_record/attribute_assignment.rb:32:in `block in assign_attributes'
2015-05-28_20:42:24.01825 /opt/gitlab/embedded/service/gem/ruby/2.1.0/gems/activerecord-4.1.9/lib/active_record/attribute_assignment.rb:26:in `each'
2015-05-28_20:42:24.01826 /opt/gitlab/embedded/service/gem/ruby/2.1.0/gems/activerecord-4.1.9/lib/active_record/attribute_assignment.rb:26:in `assign_attributes'
2015-05-28_20:42:24.01826 /opt/gitlab/embedded/service/gem/ruby/2.1.0/gems/attr_encrypted-1.3.4/lib/attr_encrypted/adapters/active_record.rb:28:in `perform_attribute_assignment'
2015-05-28_20:42:24.01827 /opt/gitlab/embedded/service/gem/ruby/2.1.0/gems/attr_encrypted-1.3.4/lib/attr_encrypted/adapters/active_record.rb:35:in `assign_attributes_with_attr_encrypted'
2015-05-28_20:42:24.01827 /opt/gitlab/embedded/service/gem/ruby/2.1.0/gems/activerecord-4.1.9/lib/active_record/core.rb:452:in `init_attributes'
2015-05-28_20:42:24.01828 /opt/gitlab/embedded/service/gem/ruby/2.1.0/gems/activerecord-4.1.9/lib/active_record/core.rb:195:in `initialize'
2015-05-28_20:42:24.01828 /opt/gitlab/embedded/service/gem/ruby/2.1.0/gems/default_value_for-3.0.0/lib/default_value_for.rb:142:in `initialize'
2015-05-28_20:42:24.01829 /opt/gitlab/embedded/service/gem/ruby/2.1.0/gems/activerecord-4.1.9/lib/active_record/inheritance.rb:30:in `new'
2015-05-28_20:42:24.01829 /opt/gitlab/embedded/service/gem/ruby/2.1.0/gems/activerecord-4.1.9/lib/active_record/inheritance.rb:30:in `new'
2015-05-28_20:42:24.01829 /opt/gitlab/embedded/service/gem/ruby/2.1.0/gems/activerecord-4.1.9/lib/active_record/persistence.rb:33:in `create'
2015-05-28_20:42:24.01830 /opt/gitlab/embedded/service/gitlab-rails/app/services/system_note_service.rb:210:in `create_note'
2015-05-28_20:42:24.01830 /opt/gitlab/embedded/service/gitlab-rails/app/services/system_note_service.rb:167:in `cross_reference'
2015-05-28_20:42:24.01831 /opt/gitlab/embedded/service/gitlab-rails/app/models/note.rb:68:in `create_cross_reference_note'
2015-05-28_20:42:24.01831 /opt/gitlab/embedded/service/gitlab-rails/app/services/git_push_service.rb:101:in `block (2 levels) in process_commit_messages'
2015-05-28_20:42:24.01832 /opt/gitlab/embedded/service/gitlab-rails/app/services/git_push_service.rb:100:in `each'
2015-05-28_20:42:24.01832 /opt/gitlab/embedded/service/gitlab-rails/app/services/git_push_service.rb:100:in `block in process_commit_messages'
2015-05-28_20:42:24.01832 /opt/gitlab/embedded/service/gitlab-rails/app/services/git_push_service.rb:73:in `each'
2015-05-28_20:42:24.01833 /opt/gitlab/embedded/service/gitlab-rails/app/services/git_push_service.rb:73:in `process_commit_messages'
2015-05-28_20:42:24.01833 /opt/gitlab/embedded/service/gitlab-rails/app/services/git_push_service.rb:56:in `execute'
2015-05-28_20:42:24.01834 /opt/gitlab/embedded/service/gitlab-rails/app/workers/post_receive.rb:41:in `block in perform'
2015-05-28_20:42:24.01834 /opt/gitlab/embedded/service/gitlab-rails/app/workers/post_receive.rb:28:in `each'
2015-05-28_20:42:24.01834 /opt/gitlab/embedded/service/gitlab-rails/app/workers/post_receive.rb:28:in `perform'
2015-05-28_20:42:24.01835 /opt/gitlab/embedded/service/gem/ruby/2.1.0/gems/sidekiq-3.3.0/lib/sidekiq/processor.rb:75:in `execute_job'
2015-05-28_20:42:24.01848 /opt/gitlab/embedded/service/gem/ruby/2.1.0/gems/sidekiq-3.3.0/lib/sidekiq/processor.rb:52:in `block (2 levels) in process'
2015-05-28_20:42:24.01848 /opt/gitlab/embedded/service/gem/ruby/2.1.0/gems/sidekiq-3.3.0/lib/sidekiq/middleware/chain.rb:127:in `call'
2015-05-28_20:42:24.01849 /opt/gitlab/embedded/service/gem/ruby/2.1.0/gems/sidekiq-3.3.0/lib/sidekiq/middleware/chain.rb:127:in `block in invoke'
2015-05-28_20:42:24.01849 /opt/gitlab/embedded/service/gitlab-rails/lib/gitlab/sidekiq_middleware/memory_killer.rb:17:in `call'
2015-05-28_20:42:24.01850 /opt/gitlab/embedded/service/gem/ruby/2.1.0/gems/sidekiq-3.3.0/lib/sidekiq/middleware/chain.rb:129:in `block in invoke'
2015-05-28_20:42:24.01850 /opt/gitlab/embedded/service/gem/ruby/2.1.0/gems/sidetiq-0.6.3/lib/sidetiq/middleware/history.rb:8:in `call'
2015-05-28_20:42:24.01850 /opt/gitlab/embedded/service/gem/ruby/2.1.0/gems/sidekiq-3.3.0/lib/sidekiq/middleware/chain.rb:129:in `block in invoke'
2015-05-28_20:42:24.01851 /opt/gitlab/embedded/service/gem/ruby/2.1.0/gems/sidekiq-3.3.0/lib/sidekiq/middleware/server/active_record.rb:6:in `call'
2015-05-28_20:42:24.01852 /opt/gitlab/embedded/service/gem/ruby/2.1.0/gems/sidekiq-3.3.0/lib/sidekiq/middleware/chain.rb:129:in `block in invoke'
2015-05-28_20:42:24.01853 /opt/gitlab/embedded/service/gem/ruby/2.1.0/gems/sidekiq-3.3.0/lib/sidekiq/middleware/server/retry_jobs.rb:74:in `call'
2015-05-28_20:42:24.01853 /opt/gitlab/embedded/service/gem/ruby/2.1.0/gems/sidekiq-3.3.0/lib/sidekiq/middleware/chain.rb:129:in `block in invoke'
2015-05-28_20:42:24.01853 /opt/gitlab/embedded/service/gem/ruby/2.1.0/gems/sidekiq-3.3.0/lib/sidekiq/middleware/server/logging.rb:11:in `block in call'
2015-05-28_20:42:24.01854 /opt/gitlab/embedded/service/gem/ruby/2.1.0/gems/sidekiq-3.3.0/lib/sidekiq/logging.rb:22:in `with_context'
2015-05-28_20:42:24.01854 /opt/gitlab/embedded/service/gem/ruby/2.1.0/gems/sidekiq-3.3.0/lib/sidekiq/middleware/server/logging.rb:7:in `call'
2015-05-28_20:42:24.01855 /opt/gitlab/embedded/service/gem/ruby/2.1.0/gems/sidekiq-3.3.0/lib/sidekiq/middleware/chain.rb:129:in `block in invoke'
2015-05-28_20:42:24.01855 /opt/gitlab/embedded/service/gem/ruby/2.1.0/gems/sidekiq-3.3.0/lib/sidekiq/middleware/chain.rb:132:in `call'
2015-05-28_20:42:24.01855 /opt/gitlab/embedded/service/gem/ruby/2.1.0/gems/sidekiq-3.3.0/lib/sidekiq/middleware/chain.rb:132:in `invoke'
2015-05-28_20:42:24.01856 /opt/gitlab/embedded/service/gem/ruby/2.1.0/gems/sidekiq-3.3.0/lib/sidekiq/processor.rb:51:in `block in process'
2015-05-28_20:42:24.01856 /opt/gitlab/embedded/service/gem/ruby/2.1.0/gems/sidekiq-3.3.0/lib/sidekiq/processor.rb:98:in `stats'
2015-05-28_20:42:24.01857 /opt/gitlab/embedded/service/gem/ruby/2.1.0/gems/sidekiq-3.3.0/lib/sidekiq/processor.rb:50:in `process'
2015-05-28_20:42:24.01857 /opt/gitlab/embedded/service/gem/ruby/2.1.0/gems/celluloid-0.16.0/lib/celluloid/calls.rb:26:in `public_send'
2015-05-28_20:42:24.01858 /opt/gitlab/embedded/service/gem/ruby/2.1.0/gems/celluloid-0.16.0/lib/celluloid/calls.rb:26:in `dispatch'
2015-05-28_20:42:24.01858 /opt/gitlab/embedded/service/gem/ruby/2.1.0/gems/celluloid-0.16.0/lib/celluloid/calls.rb:122:in `dispatch'
2015-05-28_20:42:24.01858 /opt/gitlab/embedded/service/gem/ruby/2.1.0/gems/celluloid-0.16.0/lib/celluloid/cell.rb:60:in `block in invoke'
2015-05-28_20:42:24.01859 /opt/gitlab/embedded/service/gem/ruby/2.1.0/gems/celluloid-0.16.0/lib/celluloid/cell.rb:71:in `block in task'
2015-05-28_20:42:24.01859 /opt/gitlab/embedded/service/gem/ruby/2.1.0/gems/celluloid-0.16.0/lib/celluloid/actor.rb:357:in `block in task'
2015-05-28_20:42:24.01860 /opt/gitlab/embedded/service/gem/ruby/2.1.0/gems/celluloid-0.16.0/lib/celluloid/tasks.rb:57:in `block in initialize'
2015-05-28_20:42:24.01860 /opt/gitlab/embedded/service/gem/ruby/2.1.0/gems/celluloid-0.16.0/lib/celluloid/tasks/task_fiber.rb:15:in `block in create'
Checks:
Checking Environment ...
Git configured for git user? ... yes
Checking Environment ... Finished
Checking GitLab Shell ...
GitLab Shell version >= 2.6.3 ? ... OK (2.6.3)
Repo base directory exists? ... yes
Repo base directory is a symlink? ... no
Repo base owned by git:git? ... yes
Repo base access is drwxrws---? ... yes
Satellites access is drwxr-x---? ... yes
hooks directories in repos are links: ...
3/4 ... ok
5/5 ... ok
5/6 ... ok
3/7 ... ok
6/8 ... ok
3/9 ... ok
3/10 ... ok
6/11 ... ok
6/12 ... ok
6/13 ... ok
6/14 ... ok
5/15 ... ok
5/16 ... ok
2/17 ... ok
6/18 ... ok
5/19 ... ok
3/20 ... ok
6/22 ... ok
Running /opt/gitlab/embedded/service/gitlab-shell/bin/check
Check GitLab API access: OK
Check directories and files:
/var/opt/gitlab/git-data/repositories: OK
/var/opt/gitlab/.ssh/authorized_keys: OK
Test redis-cli executable: redis-cli 2.8.2
Send ping to redis server: PONG
gitlab-shell self-check successful
Checking GitLab Shell ... Finished
Checking Sidekiq ...
Running? ... yes
Number of Sidekiq processes ... 1
Checking Sidekiq ... Finished
Checking LDAP ...
LDAP is disabled in config/gitlab.yml
Checking LDAP ... Finished
Checking GitLab ...
Database config exists? ... yes
Database is SQLite ... no
All migrations up? ... yes
Database contains orphaned GroupMembers? ... no
GitLab config exists? ... yes
GitLab config outdated? ... no
Log directory writable? ... yes
Tmp directory writable? ... 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: ...
3/4 ... yes
5/5 ... yes
5/6 ... yes
3/7 ... yes
6/8 ... yes
3/9 ... yes
3/10 ... yes
6/11 ... yes
6/12 ... yes
6/13 ... yes
6/14 ... yes
5/15 ... yes
5/16 ... yes
2/17 ... yes
6/18 ... yes
5/19 ... yes
3/20 ... yes
6/22 ... yes
Projects have satellites? ...
3/4 ... yes
5/5 ... yes
5/6 ... yes
3/7 ... yes
6/8 ... yes
3/9 ... yes
3/10 ... yes
6/11 ... yes
6/12 ... yes
6/13 ... yes
6/14 ... yes
5/15 ... yes
5/16 ... yes
2/17 ... yes
6/18 ... yes
5/19 ... yes
3/20 ... yes
6/22 ... yes
Redis version >= 2.0.0? ... yes
Ruby version >= 2.0.0 ? ... yes (2.1.6)
Your git bin path is "/opt/gitlab/embedded/bin/git"
Git version >= 1.7.10 ? ... yes (2.0.5)
Active users: 5
Checking GitLab ... Finished
Versions:
System information
System: Debian 7.8
Current User: git
Using RVM: no
Ruby Version: 2.1.6p336
Gem Version: 2.2.1
Bundler Version:1.5.3
Rake Version: 10.4.2
Sidekiq Version:3.3.0
GitLab information
Version: 7.11.4
Revision: b725318
Directory: /opt/gitlab/embedded/service/gitlab-rails
DB Adapter: postgresql
URL: https://redacted-host
HTTP Clone URL: https://redacted-host/some-project.git
SSH Clone URL: git@redacted-host:some-project.git
Using LDAP: no
Using Omniauth: no
GitLab Shell
Version: 2.6.3
Repositories: /var/opt/gitlab/git-data/repositories
Hooks: /opt/gitlab/embedded/service/gitlab-shell/hooks/
Git: /opt/gitlab/embedded/bin/git
Related:
This is very similar to #1700 (closed) however the exact error message is slightly different.
https://github.com/gitlabhq/gitlabhq/issues/9333 is another similar issue, however that commit is in 7.11.4 and the issue persists.
I'm not positive but I believe this first began on 7.11.2.