进入 Wiki 页面报 500 错误
Summary
进入 Wiki 页面时报 500 错误。
Steps to reproduce
通过以下两种方式进入 Wiki 页面,会出现 500 错误页面。
Example Project
https://jihulab.com/jh-sre-demos/plain-html
What is the current bug behavior?
What is the expected correct behavior?
Relevant logs and/or screenshots
日志链接,message 内容也可以展开下面查看。
日志中的 backtrace
"component": "gitlab",
"subcomponent": "production_json",
"method": "GET",
"path": "/jh-sre-demos/plain-html/-/wikis/home",
"format": "html",
"controller": "Projects::WikisController",
"action": "show",
"status": 500,
"time": "2024-06-06T03:03:35.242Z",
"params": [
{
"key": "view",
"value": "create"
},
{
"key": "namespace_id",
"value": "jh-sre-demos"
},
{
"key": "project_id",
"value": "plain-html"
},
{
"key": "id",
"value": "home"
}
],
"correlation_id": "01HZNR0WW0C3FJDG84D0H343F0",
"meta.caller_id": "Projects::WikisController#show",
"meta.remote_ip": "2408:8214:46c:1f30:9ca:cdf2:6b81:842a",
"meta.feature_category": "wiki",
"meta.user": "kangliu",
"meta.user_id": 1084,
"meta.project": "jh-sre-demos/plain-html",
"meta.root_namespace": "jh-sre-demos",
"meta.client_id": "user/1084",
"remote_ip": "2408:8214:46c:1f30:9ca:cdf2:6b81:842a",
"user_id": 1084,
"username": "kangliu",
"ua": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/125.0.0.0 Safari/537.36",
"queue_duration_s": 0.020409,
"request_urgency": "low",
"target_duration_s": 5,
"cf_ray": "88f52b8bda8638a2-TNA",
"cf_ipcountry": "CN",
"gitaly_calls": 6,
"gitaly_duration_s": 0.042983,
"redis_calls": 42,
"redis_allowed_cross_slot_calls": 1,
"redis_duration_s": 0.012344,
"redis_read_bytes": 7717,
"redis_write_bytes": 2543,
"redis_cache_calls": 6,
"redis_cache_duration_s": 0.001739,
"redis_cache_read_bytes": 793,
"redis_cache_write_bytes": 147,
"redis_db_load_balancing_calls": 1,
"redis_db_load_balancing_duration_s": 0.000298,
"redis_db_load_balancing_write_bytes": 56,
"redis_feature_flag_calls": 24,
"redis_feature_flag_duration_s": 0.006988,
"redis_feature_flag_read_bytes": 5891,
"redis_feature_flag_write_bytes": 1390,
"redis_rate_limiting_calls": 1,
"redis_rate_limiting_duration_s": 0.000311,
"redis_rate_limiting_read_bytes": 2,
"redis_rate_limiting_write_bytes": 75,
"redis_repository_cache_calls": 7,
"redis_repository_cache_duration_s": 0.002204,
"redis_repository_cache_read_bytes": 782,
"redis_repository_cache_write_bytes": 227,
"redis_sessions_calls": 3,
"redis_sessions_allowed_cross_slot_calls": 1,
"redis_sessions_duration_s": 0.000804,
"redis_sessions_read_bytes": 249,
"redis_sessions_write_bytes": 648,
"db_count": 28,
"db_write_count": 0,
"db_cached_count": 2,
"db_txn_count": 0,
"db_replica_txn_count": 0,
"db_primary_txn_count": 0,
"db_main_txn_count": 0,
"db_main_replica_txn_count": 0,
"db_replica_count": 28,
"db_primary_count": 0,
"db_main_count": 0,
"db_main_replica_count": 28,
"db_replica_cached_count": 2,
"db_primary_cached_count": 0,
"db_main_cached_count": 0,
"db_main_replica_cached_count": 2,
"db_replica_wal_count": 0,
"db_primary_wal_count": 0,
"db_main_wal_count": 0,
"db_main_replica_wal_count": 0,
"db_replica_wal_cached_count": 0,
"db_primary_wal_cached_count": 0,
"db_main_wal_cached_count": 0,
"db_main_replica_wal_cached_count": 0,
"db_replica_txn_max_duration_s": 0.0,
"db_primary_txn_max_duration_s": 0.0,
"db_main_txn_max_duration_s": 0.0,
"db_main_replica_txn_max_duration_s": 0.0,
"db_replica_txn_duration_s": 0.0,
"db_primary_txn_duration_s": 0.0,
"db_main_txn_duration_s": 0.0,
"db_main_replica_txn_duration_s": 0.0,
"db_replica_duration_s": 0.013,
"db_primary_duration_s": 0.0,
"db_main_duration_s": 0.0,
"db_main_replica_duration_s": 0.013,
"cpu_s": 0.144348,
"mem_objects": 74796,
"mem_bytes": 6880609,
"mem_mallocs": 22050,
"mem_total_bytes": 9872449,
"pid": 546,
"worker_id": "puma_3",
"rate_limiting_gates": []
"exception.class":"ActionView::Template::Error",
"exception.message":"undefined method `id' for nil:NilClass\n\n where(container_identifier: container_identifier, commit_sha: commit.id, path: page.path).first\n ^^^",
"exception.backtrace": [
"jh/app/models/content_validation/content_blocked_state.rb:59:in `find_by_wiki_page'",
"jh/app/models/jh/wiki_page.rb:12:in `human_title'",
"app/views/shared/wikis/_form.html.haml:10",
"actionview (7.0.8.1) lib/action_view/base.rb:244:in `public_send'",
"actionview (7.0.8.1) lib/action_view/base.rb:244:in `_run'",
"actionview (7.0.8.1) lib/action_view/template.rb:157:in `block in render'",
"activesupport (7.0.8.1) lib/active_support/notifications.rb:208:in `instrument'",
"actionview (7.0.8.1) lib/action_view/template.rb:361:in `instrument_render_template'",
"actionview (7.0.8.1) lib/action_view/template.rb:155:in `render'",
"actionview (7.0.8.1) lib/action_view/renderer/partial_renderer.rb:251:in `block in render_partial_template'",
"activesupport (7.0.8.1) lib/active_support/notifications.rb:208:in `instrument'",
"actionview (7.0.8.1) lib/action_view/renderer/partial_renderer.rb:246:in `render_partial_template'",
"actionview (7.0.8.1) lib/action_view/renderer/partial_renderer.rb:237:in `render'",
"actionview (7.0.8.1) lib/action_view/renderer/renderer.rb:81:in `render_partial_to_object'",
"actionview (7.0.8.1) lib/action_view/renderer/renderer.rb:53:in `render_partial'",
"actionview (7.0.8.1) lib/action_view/helpers/rendering_helper.rb:44:in `render'",
"app/views/shared/wikis/edit.html.haml:19",
"actionview (7.0.8.1) lib/action_view/base.rb:244:in `public_send'",
"actionview (7.0.8.1) lib/action_view/base.rb:244:in `_run'",
"actionview (7.0.8.1) lib/action_view/template.rb:157:in `block in render'",
"activesupport (7.0.8.1) lib/active_support/notifications.rb:208:in `instrument'",
"actionview (7.0.8.1) lib/action_view/template.rb:361:in `instrument_render_template'",
"actionview (7.0.8.1) lib/action_view/template.rb:155:in `render'",
"actionview (7.0.8.1) lib/action_view/renderer/template_renderer.rb:65:in `block (2 levels) in render_template'",
"activesupport (7.0.8.1) lib/active_support/notifications.rb:206:in `block in instrument'",
"activesupport (7.0.8.1) lib/active_support/notifications/instrumenter.rb:24:in `instrument'",
"activesupport (7.0.8.1) lib/active_support/notifications.rb:206:in `instrument'",
"actionview (7.0.8.1) lib/action_view/renderer/template_renderer.rb:60:in `block in render_template'",
"actionview (7.0.8.1) lib/action_view/renderer/template_renderer.rb:75:in `block in render_with_layout'",
"activesupport (7.0.8.1) lib/active_support/notifications.rb:208:in `instrument'",
"actionview (7.0.8.1) lib/action_view/renderer/template_renderer.rb:74:in `render_with_layout'",
"actionview (7.0.8.1) lib/action_view/renderer/template_renderer.rb:59:in `render_template'",
"actionview (7.0.8.1) lib/action_view/renderer/template_renderer.rb:11:in `render'",
"actionview (7.0.8.1) lib/action_view/renderer/renderer.rb:61:in `render_template_to_object'",
"actionview (7.0.8.1) lib/action_view/renderer/renderer.rb:29:in `render_to_object'",
"actionview (7.0.8.1) lib/action_view/rendering.rb:117:in `block in _render_template'",
"actionview (7.0.8.1) lib/action_view/base.rb:270:in `in_rendering_context'",
"actionview (7.0.8.1) lib/action_view/rendering.rb:116:in `_render_template'",
"actionpack (7.0.8.1) lib/action_controller/metal/streaming.rb:216:in `_render_template'",
"actionview (7.0.8.1) lib/action_view/rendering.rb:103:in `render_to_body'",
"actionpack (7.0.8.1) lib/action_controller/metal/rendering.rb:158:in `render_to_body'",
"actionpack (7.0.8.1) lib/action_controller/metal/renderers.rb:141:in `render_to_body'",
"actionpack (7.0.8.1) lib/abstract_controller/rendering.rb:27:in `render'",
"actionpack (7.0.8.1) lib/action_controller/metal/rendering.rb:139:in `render'",
"actionpack (7.0.8.1) lib/action_controller/metal/instrumentation.rb:22:in `block (2 levels) in render'",
"/usr/lib/ruby/3.1.0/benchmark.rb:311:in `realtime'",
"activesupport (7.0.8.1) lib/active_support/core_ext/benchmark.rb:14:in `ms'",
"actionpack (7.0.8.1) lib/action_controller/metal/instrumentation.rb:22:in `block in render'",
"actionpack (7.0.8.1) lib/action_controller/metal/instrumentation.rb:91:in `cleanup_view_runtime'",
"activerecord (7.0.8.1) lib/active_record/railties/controller_runtime.rb:34:in `cleanup_view_runtime'",
"elasticsearch-rails (7.2.1) lib/elasticsearch/rails/instrumentation/controller_runtime.rb:37:in `cleanup_view_runtime'",
"actionpack (7.0.8.1) lib/action_controller/metal/instrumentation.rb:21:in `render'",
"app/controllers/application_controller.rb:132:in `render'",
"app/controllers/concerns/wiki_actions.rb:168:in `handle_redirection'",
"app/controllers/concerns/wiki_actions.rb:131:in `show'",
"actionpack (7.0.8.1) lib/action_controller/metal/basic_implicit_render.rb:6:in `send_action'",
"actionpack (7.0.8.1) lib/abstract_controller/base.rb:215:in `process_action'",
"actionpack (7.0.8.1) lib/action_controller/metal/rendering.rb:165:in `process_action'",
"actionpack (7.0.8.1) lib/abstract_controller/callbacks.rb:234:in `block in process_action'",
"activesupport (7.0.8.1) lib/active_support/callbacks.rb:118:in `block in run_callbacks'",
"ee/lib/gitlab/ip_address_state.rb:10:in `with'",
"ee/app/controllers/ee/application_controller.rb:45:in `set_current_ip_address'",
"activesupport (7.0.8.1) lib/active_support/callbacks.rb:127:in `block in run_callbacks'",
"lib/gitlab/auth/current_user_mode.rb:73:in `with_current_admin'",
"app/controllers/application_controller.rb:471:in `set_current_admin'",
"activesupport (7.0.8.1) lib/active_support/callbacks.rb:127:in `block in run_callbacks'",
"lib/gitlab/session.rb:11:in `with_session'",
"app/controllers/application_controller.rb:459:in `set_session_storage'",
"activesupport (7.0.8.1) lib/active_support/callbacks.rb:127:in `block in run_callbacks'",
"lib/gitlab/i18n.rb:114:in `with_locale'",
"lib/gitlab/i18n.rb:120:in `with_user_locale'",
"app/controllers/application_controller.rb:450:in `set_locale'",
"activesupport (7.0.8.1) lib/active_support/callbacks.rb:127:in `block in run_callbacks'",
"marginalia (1.11.1) lib/marginalia.rb:109:in `record_query_comment'",
"activesupport (7.0.8.1) lib/active_support/callbacks.rb:127:in `block in run_callbacks'",
"app/controllers/application_controller.rb:443:in `set_current_context'",
"activesupport (7.0.8.1) lib/active_support/callbacks.rb:127:in `block in run_callbacks'",
"sentry-rails (5.17.3) lib/sentry/rails/controller_transaction.rb:28:in `block in sentry_around_action'",
"sentry-ruby (5.17.3) lib/sentry/hub.rb:102:in `with_child_span'",
"sentry-ruby (5.17.3) lib/sentry-ruby.rb:490:in `with_child_span'",
"sentry-rails (5.17.3) lib/sentry/rails/controller_transaction.rb:14:in `sentry_around_action'",
"activesupport (7.0.8.1) lib/active_support/callbacks.rb:127:in `block in run_callbacks'",
"activesupport (7.0.8.1) lib/active_support/callbacks.rb:138:in `run_callbacks'",
"actionpack (7.0.8.1) lib/abstract_controller/callbacks.rb:233:in `process_action'",
"actionpack (7.0.8.1) lib/action_controller/metal/rescue.rb:23:in `process_action'",
"actionpack (7.0.8.1) lib/action_controller/metal/instrumentation.rb:67:in `block in process_action'",
"activesupport (7.0.8.1) lib/active_support/notifications.rb:206:in `block in instrument'",
"activesupport (7.0.8.1) lib/active_support/notifications/instrumenter.rb:24:in `instrument'",
"activesupport (7.0.8.1) lib/active_support/notifications.rb:206:in `instrument'",
"actionpack (7.0.8.1) lib/action_controller/metal/instrumentation.rb:66:in `process_action'",
"actionpack (7.0.8.1) lib/action_controller/metal/params_wrapper.rb:259:in `process_action'",
"activerecord (7.0.8.1) lib/active_record/railties/controller_runtime.rb:27:in `process_action'",
"actionpack (7.0.8.1) lib/abstract_controller/base.rb:151:in `process'",
"actionview (7.0.8.1) lib/action_view/rendering.rb:39:in `process'",
"actionpack (7.0.8.1) lib/action_controller/metal.rb:188:in `dispatch'",
"actionpack (7.0.8.1) lib/action_controller/metal.rb:251:in `dispatch'",
"actionpack (7.0.8.1) lib/action_dispatch/routing/route_set.rb:49:in `dispatch'",
"actionpack (7.0.8.1) lib/action_dispatch/routing/route_set.rb:32:in `serve'",
"actionpack (7.0.8.1) lib/action_dispatch/routing/mapper.rb:18:in `block in <class:Constraints>'",
"actionpack (7.0.8.1) lib/action_dispatch/routing/mapper.rb:48:in `serve'",
"actionpack (7.0.8.1) lib/action_dispatch/journey/router.rb:50:in `block in serve'",
"actionpack (7.0.8.1) lib/action_dispatch/journey/router.rb:32:in `each'",
"actionpack (7.0.8.1) lib/action_dispatch/journey/router.rb:32:in `serve'",
"actionpack (7.0.8.1) lib/action_dispatch/routing/route_set.rb:852:in `call'",
"gitlab-experiment (0.9.1) lib/gitlab/experiment/middleware.rb:19:in `call'",
"omniauth (2.1.0) lib/omniauth/strategy.rb:202:in `call!'",
"omniauth (2.1.0) lib/omniauth/strategy.rb:169:in `call'",
"omniauth (2.1.0) lib/omniauth/strategy.rb:202:in `call!'",
"omniauth (2.1.0) lib/omniauth/strategy.rb:169:in `call'",
"omniauth (2.1.0) lib/omniauth/strategy.rb:202:in `call!'",
"omniauth (2.1.0) lib/omniauth/strategy.rb:169:in `call'",
"omniauth (2.1.0) lib/omniauth/strategy.rb:202:in `call!'",
"omniauth (2.1.0) lib/omniauth/strategy.rb:169:in `call'",
"omniauth (2.1.0) lib/omniauth/strategy.rb:470:in `call_app!'",
"ee/lib/omni_auth/strategies/group_saml.rb:41:in `other_phase'",
"omniauth (2.1.0) lib/omniauth/strategy.rb:195:in `call!'",
"omniauth (2.1.0) lib/omniauth/strategy.rb:169:in `call'",
"omniauth (2.1.0) lib/omniauth/strategy.rb:202:in `call!'",
"omniauth (2.1.0) lib/omniauth/strategy.rb:169:in `call'",
"flipper (0.26.2) lib/flipper/middleware/memoizer.rb:72:in `memoized_call'",
"flipper (0.26.2) lib/flipper/middleware/memoizer.rb:37:in `call'",
"lib/gitlab/metrics/elasticsearch_rack_middleware.rb:16:in `call'",
"lib/gitlab/middleware/sidekiq_shard_awareness_validation.rb:20:in `block in call'",
"lib/gitlab/sidekiq_sharding/validator.rb:42:in `enabled'",
"lib/gitlab/middleware/sidekiq_shard_awareness_validation.rb:20:in `call'",
"lib/gitlab/middleware/memory_report.rb:13:in `call'",
"lib/gitlab/middleware/speedscope.rb:13:in `call'",
"lib/gitlab/database/load_balancing/rack_middleware.rb:23:in `call'",
"lib/gitlab/middleware/rails_queue_duration.rb:33:in `call'",
"lib/gitlab/etag_caching/middleware.rb:21:in `call'",
"lib/gitlab/metrics/rack_middleware.rb:16:in `block in call'",
"lib/gitlab/metrics/web_transaction.rb:46:in `run'",
"lib/gitlab/metrics/rack_middleware.rb:16:in `call'",
"lib/gitlab/middleware/go.rb:20:in `call'",
"lib/gitlab/middleware/query_analyzer.rb:11:in `block in call'",
"lib/gitlab/database/query_analyzer.rb:40:in `within'",
"lib/gitlab/middleware/query_analyzer.rb:11:in `call'",
"lib/gitlab/middleware/organizations/current.rb:20:in `call'",
"batch-loader (2.0.5) lib/batch_loader/middleware.rb:11:in `call'",
"rack-attack (6.7.0) lib/rack/attack.rb:103:in `call'",
"apollo_upload_server (2.1.5) lib/apollo_upload_server/middleware.rb:19:in `call'",
"lib/gitlab/middleware/multipart.rb:173:in `call'",
"rack-attack (6.7.0) lib/rack/attack.rb:127:in `call'",
"warden (1.2.9) lib/warden/manager.rb:36:in `block in call'",
"warden (1.2.9) lib/warden/manager.rb:34:in `catch'",
"warden (1.2.9) lib/warden/manager.rb:34:in `call'",
"rack-cors (2.0.1) lib/rack/cors.rb:102:in `call'",
"rack (2.2.8.1) lib/rack/tempfile_reaper.rb:15:in `call'",
"rack (2.2.8.1) lib/rack/etag.rb:27:in `call'",
"rack (2.2.8.1) lib/rack/conditional_get.rb:27:in `call'",
"rack (2.2.8.1) lib/rack/head.rb:12:in `call'",
"actionpack (7.0.8.1) lib/action_dispatch/http/permissions_policy.rb:38:in `call'",
"actionpack (7.0.8.1) lib/action_dispatch/http/content_security_policy.rb:36:in `call'",
"lib/gitlab/middleware/read_only/controller.rb:50:in `call'",
"lib/gitlab/middleware/read_only.rb:18:in `call'",
"lib/gitlab/middleware/unauthenticated_session_expiry.rb:18:in `call'",
"rack (2.2.8.1) lib/rack/session/abstract/id.rb:266:in `context'",
"rack (2.2.8.1) lib/rack/session/abstract/id.rb:260:in `call'",
"actionpack (7.0.8.1) lib/action_dispatch/middleware/cookies.rb:704:in `call'",
"lib/gitlab/middleware/same_site_cookies.rb:27:in `call'",
"actionpack (7.0.8.1) lib/action_dispatch/middleware/callbacks.rb:27:in `block in call'",
"activesupport (7.0.8.1) lib/active_support/callbacks.rb:99:in `run_callbacks'",
"actionpack (7.0.8.1) lib/action_dispatch/middleware/callbacks.rb:26:in `call'",
"sentry-rails (5.17.3) lib/sentry/rails/rescued_exception_interceptor.rb:12:in `call'",
"actionpack (7.0.8.1) lib/action_dispatch/middleware/debug_exceptions.rb:28:in `call'",
"lib/gitlab/middleware/path_traversal_check.rb:14:in `call'",
"lib/gitlab/middleware/handle_malformed_strings.rb:21:in `call'",
"sentry-ruby (5.17.3) lib/sentry/rack/capture_exceptions.rb:29:in `block (2 levels) in call'",
"sentry-ruby (5.17.3) lib/sentry/hub.rb:251:in `with_session_tracking'",
"sentry-ruby (5.17.3) lib/sentry-ruby.rb:403:in `with_session_tracking'",
"sentry-ruby (5.17.3) lib/sentry/rack/capture_exceptions.rb:20:in `block in call'"
......
]
Output of checks
Results of GitLab environment info
Expand for output related to GitLab environment info
(For installations with omnibus-gitlab package run and paste the output of: `sudo gitlab-rake gitlab:env:info`) (For installations from source run and paste the output of: `sudo -u git -H bundle exec rake gitlab:env:info RAILS_ENV=production`)
Results of GitLab application Check
Expand for output related to the GitLab application check
(For installations with omnibus-gitlab package run and paste the output of:
sudo gitlab-rake gitlab:check SANITIZE=true
)(For installations from source run and paste the output of:
sudo -u git -H bundle exec rake gitlab:check RAILS_ENV=production SANITIZE=true
)(we will only investigate if the tests are passing)
Possible fixes
由 Kang Liu 编辑于