Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incompatible character encodings when logging jobs with non-utf8 arguments #66

Closed
composerinteralia opened this issue Aug 31, 2023 · 1 comment
Assignees

Comments

@composerinteralia
Copy link

What did you do?

Tried running isolator against the GitHub test suite and saw a number of incompatible character encodings: ASCII-8BIT and UTF-8 errors.

Here's a test to reproduce the problem:

  context "when logging non-utf8 details" do
    specify do
      logger = instance_double("Logger")
      Isolator.configure do |config|
        config.logger = logger
      end

      job_args = ["abc123", "\xff".dup.force_encoding(Encoding::ASCII_8BIT)]
      details = "MyJob (#{job_args.join(", ")})"
      exception = Isolator::BackgroundJobError.new(details: details)

      described_class.new(exception).call
    end
  end

Because of the ASCII_8BIT job argument, the whole exception message ends up as ASCII_8BIT. We're able to combine that just fine with other ascii-only strings, but we're not able to combine that with the UTF_8 used to print the backtrace.

What did you expect to happen?

I'm not certain. Encodings can be difficult...

A fallback to leave out the if there's any sort of encoding problem, perhaps? Or replace it with - or something else ascii that's likely to be more broadly compatible?

Environment

Ruby Version:

3.2

Framework Version (Rails, whatever):

Rails main (7.1)

Isolator Version:

0.10.0

@palkan
Copy link
Owner

palkan commented Sep 12, 2023

Thanks! Fixed (decided to go with retry+fallback for now).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants