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

Encoding issue with old backup file #214

Closed
marocchino opened this issue Nov 19, 2024 · 5 comments · Fixed by #215
Closed

Encoding issue with old backup file #214

marocchino opened this issue Nov 19, 2024 · 5 comments · Fixed by #215
Assignees
Labels
bug Something isn't working

Comments

@marocchino
Copy link
Contributor

Describe the bug

There have been reports that encoding errors occur after a major version upgrade if there is a backup from a previous version. When this symptom is present, get variant always returns with disabled.

Steps to reproduce the bug

  1. install unleash 5.1.1
  2. make backup file with Unleash::Client.new
  3. update unleash 6.0.8
  4. Unleash::Client.new again

Expected behavior

no error

Logs, error output, etc.

[2024/11/18 18:13:52]   INFO    [Unleash] ERROR: Error when sending report to unleash server. Server responded with http code 400.

---

[1] protodev 3.2.5-p208(main)> Rails.configuration.unleash = Unleash::Client.new
[Unleash] ERROR: Unable to save backup file. Exception thrown Encoding::UndefinedConversionError:'"\xE3" from ASCII-8BIT to UTF-8'
[Unleash] ERROR: stacktrace: ["/data/pksys/pokota/shared/bundle/ruby/3.2.0/gems/unleash-6.0.8/lib/unleash/toggle_fetcher.rb:65:in `write'" 
... 省略 ...

[4] protodev 3.2.5-p208(main)> FeatureToggle.new('ft0000_nextgen', User.find(187), nil, Time.zone.now, country).enabled
[Shard: main_r]  [pokota_protodev2016] replica User Load (2.4ms)  SELECT `users`.* FROM `users` WHERE `users`.`id` = 187 LIMIT 1
[Shard: main_r]  [pokota_protodev2016] replica UserRankPoint Load (2.3ms)  SELECT `user_rank_points`.* FROM `user_rank_points` WHERE `user_rank_points`.`user_id` = 187 LIMIT 1
false

Screenshots

No response

Additional context

No response

Unleash version

No response

Subscription type

Pro

Hosting type

Hosted by Unleash

SDK information (language and version)

ruby 6.0.8

@marocchino marocchino added the bug Something isn't working label Nov 19, 2024
@sighphyre sighphyre self-assigned this Nov 20, 2024
@sighphyre
Copy link
Member

@marocchino Thanks for raising this, I'll take a look

@sighphyre
Copy link
Member

Hey @marocchino, I can't seem to reproduce this and I think there's something strange going on with the trace you've posted. That error in the client isn't from loading the backup, it's from creating the backup from the response from upstream. Based on the warning there, it looks like the SDK is struggling to talk to upstream. Is there a proxy in between Unleash and the SDK? Is the connection actually healthy?

This is also a bit of a surprise because the backup code and the HTTP code hasn't changed significantly from the 5.x range. But what looks to be happening is some very odd 200 ASCII encoded response is being returned from the server and that's causing the SDK to wipe its internal cache.

Would you be able to post a response from cURL from whereever the SDK is running to your Unleash server? And maybe the content of your backup file as well, if possible. I know I'm asking for a lot here but it's worth a shot!

@marocchino
Copy link
Contributor Author

You need utf-8 characters in backup json.
Try inserting Asian characters like こんにちは, 안녕

@sighphyre
Copy link
Member

You need utf-8 characters in backup json. Try inserting Asian characters like こんにちは, 안녕

Yes, tried that, still can't reproduce it. But I see you have a PR open and it makes sense, I'll merge that, thank you

@github-project-automation github-project-automation bot moved this from In Progress to Done in Issues and PRs Nov 21, 2024
@sighphyre
Copy link
Member

@marocchino Thanks for the report and the fix! 6.0.9 is out which contains your patch

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

2 participants