Bug 259848 - www/gitlab-ce
Summary: www/gitlab-ce
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Only Me
Assignee: Matthias Fechner
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-11-15 10:20 UTC by Anton Evel
Modified: 2021-11-22 15:48 UTC (History)
2 users (show)

See Also:
bugzilla: maintainer-feedback? (mfechner)


Attachments
Licensee::InvalidLicense exception (70.42 KB, image/jpeg)
2021-11-15 10:20 UTC, Anton Evel
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Anton Evel 2021-11-15 10:20:22 UTC
Created attachment 229504 [details]
Licensee::InvalidLicense exception

Dear Matthias,
I have a strange behaviour of gitlab-ce: every time I'm adding file license.txt to any of my projects I have the following exception in production.log:

----

Completed 500 Internal Server Error in 3083ms (ActiveRecord: 13.2ms | Elasticsearch: 0.0ms | Allocations: 26527)

ActionView::Template::Error (14:error reading from server: EOF.):
    1: - blob = local_assigns.fetch(:blob)
    2: - auxiliary_viewer = blob.auxiliary_viewer
    3: - if auxiliary_viewer && auxiliary_viewer.render_error.nil? && auxiliary_viewer.visible_to?(current_user)
    4:   .well-segment.blob-auxiliary-viewer
    5:     = render 'projects/blob/viewer', viewer: auxiliary_viewer

lib/gitlab/git/wraps_gitaly_errors.rb:15:in `rescue in wrapped_gitaly_errors'
lib/gitlab/git/wraps_gitaly_errors.rb:6:in `wrapped_gitaly_errors'
lib/gitlab/git/repository.rb:762:in `license_short_name'
app/models/repository.rb:627:in `license_key'
lib/gitlab/repository_cache_adapter.rb:21:in `block (2 levels) in cache_method'
lib/gitlab/repository_cache.rb:25:in `fetch'
lib/gitlab/repository_cache_adapter.rb:163:in `block in cache_method_output'
lib/gitlab/utils/strong_memoize.rb:30:in `strong_memoize'
lib/gitlab/repository_cache_adapter.rb:203:in `block in memoize_method_output'
lib/gitlab/repository_cache_adapter.rb:212:in `no_repository_fallback'
lib/gitlab/repository_cache_adapter.rb:202:in `memoize_method_output'
lib/gitlab/repository_cache_adapter.rb:162:in `cache_method_output'
lib/gitlab/repository_cache_adapter.rb:20:in `block in cache_method'
app/models/repository.rb:632:in `license'
lib/gitlab/repository_cache_adapter.rb:113:in `block (2 levels) in memoize_method'
lib/gitlab/utils/strong_memoize.rb:30:in `strong_memoize'
lib/gitlab/repository_cache_adapter.rb:203:in `block in memoize_method_output'
lib/gitlab/repository_cache_adapter.rb:212:in `no_repository_fallback'
lib/gitlab/repository_cache_adapter.rb:202:in `memoize_method_output'
lib/gitlab/repository_cache_adapter.rb:112:in `block in memoize_method'
app/models/blob_viewer/license.rb:13:in `license'
app/models/blob_viewer/license.rb:17:in `render_error'
app/views/projects/blob/_auxiliary_viewer.html.haml:3
app/views/projects/blob/_blob.html.haml:11
app/views/projects/blob/show.html.haml:12
app/controllers/application_controller.rb:136:in `render'
app/controllers/projects/blob_controller.rb:242:in `show_html'
app/controllers/projects/blob_controller.rb:67:in `block (2 levels) in show'
app/controllers/projects/blob_controller.rb:65:in `show'
app/controllers/application_controller.rb:554:in `block in allow_gitaly_ref_name_caching'
lib/gitlab/gitaly_client.rb:341:in `allow_ref_name_caching'
app/controllers/application_controller.rb:553:in `allow_gitaly_ref_name_caching'
app/controllers/application_controller.rb:503:in `set_current_admin'
lib/gitlab/session.rb:11:in `with_session'
app/controllers/application_controller.rb:494:in `set_session_storage'
lib/gitlab/i18n.rb:105:in `with_locale'
lib/gitlab/i18n.rb:111:in `with_user_locale'
app/controllers/application_controller.rb:488:in `set_locale'
app/controllers/application_controller.rb:482:in `set_current_context'
lib/gitlab/middleware/speedscope.rb:13:in `call'
lib/gitlab/request_profiler/middleware.rb:17:in `call'
lib/gitlab/database/load_balancing/rack_middleware.rb:23:in `call'
lib/gitlab/jira/middleware.rb:19:in `call'
lib/gitlab/middleware/go.rb:20:in `call'
lib/gitlab/etag_caching/middleware.rb:21:in `call'
lib/gitlab/middleware/multipart.rb:173:in `call'
lib/gitlab/middleware/read_only/controller.rb:50:in `call'
lib/gitlab/middleware/read_only.rb:18:in `call'
lib/gitlab/middleware/same_site_cookies.rb:27:in `call'
lib/gitlab/middleware/handle_malformed_strings.rb:21:in `call'
lib/gitlab/middleware/basic_health_check.rb:25:in `call'
lib/gitlab/middleware/handle_ip_spoof_attack_error.rb:25:in `call'
lib/gitlab/middleware/request_context.rb:21:in `call'
config/initializers/fix_local_cache_middleware.rb:11:in `call'
lib/gitlab/middleware/rack_multipart_tempfile_factory.rb:19:in `call'
lib/gitlab/middleware/sidekiq_web_static.rb:20:in `call'
lib/gitlab/metrics/requests_rack_middleware.rb:75:in `call'
lib/gitlab/middleware/release_env.rb:12:in `call'

----

or sometimes ActionView::Template:Error (unintialized constant Licensee::InvalidLicense) 
in app/models/repository.rb:629:in `rescue in license`

Anton.
Comment 1 Matthias Fechner freebsd_committer freebsd_triage 2021-11-15 10:35:49 UTC
Dear Anton,

at first thanks a lot for your report and sorry for this breakage.
I already put a lot of time in to find the source for this error but everything I tried does not fix this.

I think the next step is now to go upstream, open there an issue and describe the problem there to gitlab developers.
It seems to be a bug or at least we maybe have a gem in a version installed that does not work.

I saw that gitaly has a segfault and afterwards the error is logged in gitlab itself.

My time is currently very limited, do you maybe have time to report this upstream and put a link here?

This would really be very helpful.
Comment 2 Anton Evel 2021-11-15 11:14:43 UTC
Sure, thank you!

https://gitlab.com/gitlab-org/gitlab/-/issues/345693
Comment 3 Anton Evel 2021-11-17 07:25:19 UTC
Dear Matthias,

Here https://gitlab.com/gitlab-org/gitlab/-/issues/345693 Stan Hu offered to downgrade grpc (and rubygem-grpc as I suppose). How can I try this when www/gitlab-ce depends of rubygem-grpc, not rubygem-grpc130? And how could I force gitlab to use 1.30 version of grpc?

Thank you!
Comment 4 Matthias Fechner freebsd_committer freebsd_triage 2021-11-17 16:29:26 UTC
I prepared a commit that makes grpc 1.30.2 available and modified all ports to use this version, but I see the same problems, I updated the issue upstream accordingly and also made a vagrant script available to quickly spin up a FreeBSD VM with gitlab installed, so we can quickly test on a freshly installed machine.

This should also help gitlab to hopefully find why it fails.
Comment 5 Matthias Fechner freebsd_committer freebsd_triage 2021-11-21 07:29:02 UTC
I have now a fix available, I only have to wait for sunpoet to approve the commit to the port devel/grpc to upgrade it before to version 1.42.0.
Comment 6 Anton Evel 2021-11-21 18:54:47 UTC
Thank you, Matthias! Awaiting your commit!
Comment 7 commit-hook freebsd_committer freebsd_triage 2021-11-22 15:18:50 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=0bbacd67dc435bd595e7ef204fb002e2ee2df210

commit 0bbacd67dc435bd595e7ef204fb002e2ee2df210
Author:     Matthias Fechner <mfechner@FreeBSD.org>
AuthorDate: 2021-11-21 07:56:27 +0000
Commit:     Matthias Fechner <mfechner@FreeBSD.org>
CommitDate: 2021-11-22 15:17:58 +0000

    www/gitlab-ce: fix segfaults

    Accessing the project page or doing anything that is related to a license
    file caused segfault in gitaly.
    Upgrading now the gems to this specific version fixed the problem.
    As we need to use a prerelease of rubygem-grpc, it is added as extra port.

    Please see also upstream here:
    https://gitlab.com/gitlab-org/gitlab/-/issues/345693

    PR:             259848
    Reported by:    admin@asu-vei.ru

 devel/gitaly/Makefile                              |  14 +-
 devel/gitaly/files/patch-4108.patch (new)          | 770 +++++++++++++++++++++
 devel/gitaly/files/patch-ruby_Gemfile              |  21 +-
 devel/rubygem-gitlab-labkit/Makefile               |   4 +-
 .../files/patch-gitlab-labkit.gemspec (new)        |  29 +
 net/Makefile                                       |   1 +
 net/rubygem-gitaly/Makefile                        |   4 +-
 .../files/patch-gitaly.gemspec (new)               |  18 +
 net/rubygem-grpc142/Makefile (new)                 |  30 +
 net/rubygem-grpc142/distinfo (new)                 |   3 +
 .../files/patch-src_ruby_ext_grpc_extconf.rb (new) |  51 ++
 .../files/patch-src_ruby_lib_grpc.rb (new)         |  11 +
 net/rubygem-grpc142/pkg-descr (new)                |   3 +
 net/rubygem-kas-grpc/Makefile                      |   4 +-
 .../files/patch-kas-grpc.gemspec (new)             |  18 +
 net/rubygem-spamcheck/Makefile                     |   4 +-
 .../files/patch-spamcheck.gemspec (new)            |  18 +
 textproc/Makefile                                  |   1 +
 .../rubygem-autoprefixer-rails1025/Makefile (new)  |  22 +
 .../rubygem-autoprefixer-rails1025/distinfo (new)  |   3 +
 .../rubygem-autoprefixer-rails1025/pkg-descr (new) |   5 +
 www/gitlab-ce/Makefile                             |   8 +-
 www/gitlab-ce/files/patch-Gemfile                  |   9 +-
 23 files changed, 1023 insertions(+), 28 deletions(-)
Comment 8 Matthias Fechner freebsd_committer freebsd_triage 2021-11-22 15:48:55 UTC
Problem is fixed.