`Encoding::UndefinedConversionError` when retrieving pod logs
Summary
(Summarize the bug encountered concisely)
Log of error in production:
Exception:
Encoding::UndefinedConversionError: "\xE2" from ASCII-8BIT to UTF-8
String that seems to have caused this exception:
✔ Started logging errors to Sentry
Stacktrace:
app/controllers/application_controller.rb:121:in `render',
ee/app/controllers/projects/logs_controller.rb:28:in `k8s',
ee/lib/gitlab/ip_address_state.rb:10:in `with',
ee/app/controllers/ee/application_controller.rb:43:in `set_current_ip_address',
lib/gitlab/session.rb:11:in `with_session',
app/controllers/application_controller.rb:468:in `set_session_storage',
app/controllers/application_controller.rb:462:in `set_locale',
lib/gitlab/application_context.rb:46:in `block in use',
lib/gitlab/application_context.rb:46:in `use',
lib/gitlab/application_context.rb:19:in `with_context',
app/controllers/application_controller.rb:453:in `set_current_context',
lib/gitlab/error_tracking.rb:34:in `with_context',
app/controllers/application_controller.rb:546:in `sentry_context',
ee/lib/omni_auth/strategies/group_saml.rb:41:in `other_phase',
ee/lib/gitlab/jira/middleware.rb:19:in `call'
Steps to reproduce
(How one can reproduce the issue - this is very important)
- Create a project and link it to a cluster.
- Deploy an application to the cluster
- Make sure
✔
is added to the k8s logs. You can use https://gitlab.com/rpereira2/tanuki-inc/ which already has✔
in its k8s logs. - Go to the environment pod logs page. If you're using https://gitlab.com/rpereira2/tanuki-inc>, go to https://gitlab.com/rpereira2/tanuki-inc/-/environments and click on one of the pods to see the logs page.
- The logs API will fail with a 500 error.
- The exception mentioned here will be found in the logs.
Example Project
(If possible, please create an example project here on GitLab.com that exhibits the problematic behavior, and link to it here in the bug report)
(If you are using an older version of GitLab, this will also determine whether the bug is fixed in a more recent version)
https://gitlab.com/rpereira2/tanuki-inc/
What is the current bug behavior?
(What actually happens)
What is the expected correct behavior?
(What you should see instead)
Relevant logs and/or screenshots
(Paste any relevant logs - please use code blocks (```) to format console output, logs, and code as it's tough to read otherwise.)
Output of checks
(If you are reporting a bug on GitLab.com, write: This bug happens on GitLab.com)
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
(If you can, link to the line of code that might be responsible for the problem)