Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Bug#1019731: gitlab: failed to fetch comments in merge requests (500 Internal Server Error)

65 views
Skip to first unread message

Maximilian Stein

unread,
Sep 14, 2022, 6:20:03 AM9/14/22
to
Package: gitlab
Version: 15.3.2+ds1-1~fto11+1
Severity: normal

Dear Maintainer,

Some time after upgrading to 15.3.2 (but not from the beginning),
loading of comments in merge requests started to fail. This sounds
similar to #1019403, but I believe it is a different issue.

While loading a merge request with comments, this URI (relative to
project) fails:

-/merge_requests/346/discussions.json?per_page=20

In the production.log, I found:

Completed 500 Internal Server Error in 764ms (ActiveRecord: 493.9ms | Elasticsearch: 0.0ms | Allocations: 144723)

Psych::DisallowedClass (Tried to load unspecified class: Gitlab::Diff::Position):

app/models/diff_discussion.rb:13:in `position'
app/models/diff_discussion.rb:51:in `cache_key'
app/controllers/concerns/issuable_actions.rb:186:in `render_mr_discussions'


Unfortunately, I haven't found a workaround yet. Do you have any idea
how to get comments in merge requests again?

Best,
Maximilian

Maximilian Stein

unread,
Sep 16, 2022, 10:10:03 AM9/16/22
to
> Some time after upgrading to 15.3.2 (but not from the beginning),
> loading of comments in merge requests started to fail.


Apparently, only merge requests with annotations in the diff view are
affected. That's why I didn't notice the issue from the beginning.

Maximilian Stein

unread,
Sep 22, 2022, 1:20:03 AM9/22/22
to
Control: forwarded -1 https://gitlab.com/gitlab-org/gitlab/-/issues/374174


Hi there,

As discussed in the upstream Gitlab bug report [1], apparently the
package `ruby-activerecord` in version 6.1.6.1
(2:6.1.6.1+dfsg-3~fto11+1) is broken as it appears to contain file from
version 6.1.6 (specifically
/usr/share/rubygems-integration/all/gems/activerecord-6.1.6.1/lib/active_record/railtie.rb).
So, probably, that package needs to be fixed to get merge request
comments working again.

In the meantime, there is a workaround available for Gitlab [2].

Best,
Max


[1]: https://gitlab.com/gitlab-org/gitlab/-/issues/374174

[2]: https://gitlab.com/gitlab-org/gitlab/-/issues/374174#note_1105638411

Antoine Le Gonidec

unread,
Nov 17, 2022, 8:50:10 AM11/17/22
to
On Thu, 22 Sep 2022 07:08:46 +0200 Maximilian Stein <m...@steiny.biz> wrote:
> As discussed in the upstream Gitlab bug report [1], apparently the
> package `ruby-activerecord` in version 6.1.6.1
> (2:6.1.6.1+dfsg-3~fto11+1) is broken as it appears to contain file from
> version 6.1.6 (specifically
> /usr/share/rubygems-integration/all/gems/activerecord-6.1.6.1/lib/active_record/railtie.rb).
> So, probably, that package needs to be fixed to get merge request
> comments working again.
>
> In the meantime, there is a workaround available for Gitlab [2].

Could you please give a bit more details about the workaround?

I tried copying config/initializers/rails_safe_load_yaml_patch.rb from upstream merge request !92400 to /etc/gitlab/initializers/rails_safe_load_yaml_patch.rb, but I still get the 500 error (after a full rebuild of the assets). So I guess I am missing a step.

I run gitlab 15.4.2+ds1-1~fto11+3 from bullseye-fasttrack.
OpenPGP_signature

Antoine Le Gonidec

unread,
Nov 18, 2022, 5:20:04 AM11/18/22
to
My bad, I mixed things up: the 500 error I am experiencing is the one from https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1019403 (undefined method `h' for LabelsHelper:Module).

Sorry for the noise.
OpenPGP_signature

Maximilian Stein

unread,
Nov 19, 2022, 2:50:03 PM11/19/22
to
> My bad, I mixed things up: the 500 error I am experiencing is the one
from https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1019403
(undefined method `h' for LabelsHelper:Module).


Yeah, these two seem quite similar. The workaround for 1019403 has to be
repeated after every update, though, while this one only needs to be
implemented once.

Pirate Praveen

unread,
Feb 7, 2023, 1:10:04 PM2/7/23
to
Utkarsh suggested this change will fix this bug, we need to test it
before we add to the gitlab package.

diff --git a/config/application.rb b/config/application.rb
index 249db9c6a6..e7481e12e1 100644
--- a/config/application.rb
+++ b/config/application.rb
@@ -234,6 +234,12 @@ class Application < Rails::Application
config.active_record.has_many_inversing = false
config.active_record.belongs_to_required_by_default = false

+ # Allow Gitlab::Diff::Position because it was disallowed
+ # with Rails 6.1.6.4 security update. Whilst they have
+ # re-added support for Symbol, they expect the projects
+ # to add the classes they need to be explicitly allowed.
+ config.active_record.yaml_column_permitted_classes = [Symbol,
DateTime, Gitlab::Diff::Position]
+
# Enable the asset pipeline
config.assets.enabled = true

Antoine Le Gonidec

unread,
Feb 10, 2023, 1:10:04 PM2/10/23
to
On Tue, 07 Feb 2023 19:02:46 +0100 Pirate Praveen <pra...@onenetbeyond.org> wrote:
> diff --git a/config/application.rb b/config/application.rb
> index 249db9c6a6..e7481e12e1 100644
> --- a/config/application.rb
> +++ b/config/application.rb
> @@ -234,6 +234,12 @@ class Application < Rails::Application
> config.active_record.has_many_inversing = false
> config.active_record.belongs_to_required_by_default = false
>
> + # Allow Gitlab::Diff::Position because it was disallowed
> + # with Rails 6.1.6.4 security update. Whilst they have
> + # re-added support for Symbol, they expect the projects
> + # to add the classes they need to be explicitly allowed.
> + config.active_record.yaml_column_permitted_classes = [Symbol,
> DateTime, Gitlab::Diff::Position]
> +
> # Enable the asset pipeline
> config.assets.enabled = true

With this patch, gitlab-puma.service fails to start with the following trace:

/usr/share/gitlab/config/application.rb:241:in `<class:Application>': uninitialized constant Gitlab::Diff (NameError)
Did you mean? Diffy
from /usr/share/gitlab/config/application.rb:18:in `<module:Gitlab>'
from /usr/share/gitlab/config/application.rb:17:in `<top (required)>'
from /usr/share/gitlab/config/environment.rb:4:in `require'
from /usr/share/gitlab/config/environment.rb:4:in `<top (required)>'
from config.ru:5:in `require'
from config.ru:5:in `block in <main>'
from /var/lib/gitlab/.gem/gems/rack-2.2.6.2/lib/rack/builder.rb:116:in `eval'
from /var/lib/gitlab/.gem/gems/rack-2.2.6.2/lib/rack/builder.rb:116:in `new_from_string'
from /var/lib/gitlab/.gem/gems/rack-2.2.6.2/lib/rack/builder.rb:105:in `load_file'
from /var/lib/gitlab/.gem/gems/rack-2.2.6.2/lib/rack/builder.rb:66:in `parse_file'
from /usr/lib/x86_64-linux-gnu/rubygems-integration/2.7.0/gems/puma-5.6.5/lib/puma/configuration.rb:348:in `load_rackup'
from /usr/lib/x86_64-linux-gnu/rubygems-integration/2.7.0/gems/puma-5.6.5/lib/puma/configuration.rb:270:in `app'
from /usr/lib/x86_64-linux-gnu/rubygems-integration/2.7.0/gems/puma-5.6.5/lib/puma/runner.rb:150:in `load_and_bind'
from /usr/lib/x86_64-linux-gnu/rubygems-integration/2.7.0/gems/puma-5.6.5/lib/puma/single.rb:44:in `run'
from /usr/lib/x86_64-linux-gnu/rubygems-integration/2.7.0/gems/puma-5.6.5/lib/puma/launcher.rb:193:in `run'
from /usr/lib/x86_64-linux-gnu/rubygems-integration/2.7.0/gems/puma-5.6.5/lib/puma/cli.rb:81:in `run'
from /usr/lib/x86_64-linux-gnu/rubygems-integration/2.7.0/gems/puma-5.6.5/bin/puma:10:in `<top (required)>'
from /usr/bin/puma:23:in `load'
from /usr/bin/puma:23:in `<main>'
OpenPGP_signature

Antoine Le Gonidec

unread,
Mar 15, 2023, 11:42:23 AM3/15/23
to
The attached patch works around the failure to display comments on diffs.

It has been submitted and included upstream already, see:
- https://gitlab.com/gitlab-org/gitlab/-/issues/374174#note_1238695337
- https://gitlab.com/gitlab-org/gitlab/-/merge_requests/108902
properly-set-allowed-yaml-classes.patch
OpenPGP_signature
0 new messages