Internal server error during accessing wiki pages
Summary
After upgrade to current version of Gitlab (13.8.2-ee) some of our Wikis started to misbehave - throwing 500 during access.
This especially happens in projects affected by #299301 (closed)
Steps to reproduce
- Create a wiki with some non-standard characters (in our case - polish names)
- try to access it
- 500 appears for some (not all) wikis
What is the current bug behavior?
Throwing 500 during access to Wiki pages. What is curious - it is non-deterministic, some of wikis fail on main page, some on accessing second page.
What is the expected correct behavior?
Wiki visible without any issues
Relevant logs and/or screenshots
Completed 500 Internal Server Error in 165ms (ActiveRecord: 25.2ms | Elasticsearch: 0.0ms | Allocations: 60336)
{"method":"GET","path":"/(censored)","format":"html","controller":"Projects::WikisController","action":"show","status":500,"time":"2021-02-05T07:21:21.704Z","params":[{"key":"namespace_id","value":"(censored)"},{"key":"project_id","value":"(censored)"},{"key":"id","value":"home"}],"remote_ip":"10.30.3.13","user_id":189,"username":"(censored)","ua":"Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/88.0.4324.96 Safari/537.36","correlation_id":"01EXRH25VABKNQ82B7K08120HS","meta.user":"(censored)","meta.project":"(censored)","meta.root_namespace":"(censored)","meta.caller_id":"Projects::WikisController#show","meta.remote_ip":"10.30.3.13","meta.feature_category":"wiki","gitaly_calls":4,"gitaly_duration_s":0.016764,"redis_calls":9,"redis_duration_s":0.005161,"redis_read_bytes":1580,"redis_write_bytes":1353,"redis_cache_calls":7,"redis_cache_duration_s":0.004434,"redis_cache_read_bytes":1325,"redis_cache_write_bytes":388,"redis_shared_state_calls":2,"redis_shared_state_duration_s":0.000727,"redis_shared_state_read_bytes":255,"redis_shared_state_write_bytes":965,"db_count":11,"db_write_count":0,"db_cached_count":1,"cpu_s":0.13,"exception.class":"ActionView::Template::Error","exception.message":"2:Encoding::UndefinedConversionError: U+0142 from UTF-8 to ASCII-8BIT.","exception.backtrace":["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/wiki.rb:116:in `page_versions'","app/models/wiki_page.rb:133:in `versions'","app/models/wiki_page.rb:143:in `last_version'","app/views/shared/wikis/show.html.haml:9","app/controllers/application_controller.rb:125:in `render'","app/controllers/concerns/wiki_actions.rb:82:in `show'","ee/lib/gitlab/ip_address_state.rb:10:in `with'","ee/app/controllers/ee/application_controller.rb:44:in `set_current_ip_address'","app/controllers/application_controller.rb:482:in `set_current_admin'","lib/gitlab/session.rb:11:in `with_session'","app/controllers/application_controller.rb:473:in `set_session_storage'","lib/gitlab/i18n.rb:73:in `with_locale'","lib/gitlab/i18n.rb:79:in `with_user_locale'","app/controllers/application_controller.rb:467:in `set_locale'","lib/gitlab/error_tracking.rb:52:in `with_context'","app/controllers/application_controller.rb:532:in `sentry_context'","app/controllers/application_controller.rb:460:in `block in set_current_context'","lib/gitlab/application_context.rb:56:in `block in use'","lib/gitlab/application_context.rb:56:in `use'","lib/gitlab/application_context.rb:22:in `with_context'","app/controllers/application_controller.rb:451:in `set_current_context'","lib/gitlab/request_profiler/middleware.rb:17: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:172: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:23:in `call'","config/initializers/fix_local_cache_middleware.rb:9:in `call'","lib/gitlab/metrics/requests_rack_middleware.rb:76:in `call'","lib/gitlab/middleware/release_env.rb:12:in `call'"],"db_duration_s":0.02519,"view_duration_s":0.0,"duration_s":0.16471}
ActionView::Template::Error (2:Encoding::UndefinedConversionError: U+0142 from UTF-8 to ASCII-8BIT.):
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/error_tracking.rb:52:in `with_context'
lib/gitlab/middleware/handle_ip_spoof_attack_error.rb:25:in `call'