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
Suffered a major mysql database encoding issue upgrading to rails 6.1.2 ! #41403
Comments
Sorry that happened @thomasdarde. However we need more information here to determine if the cause is Rails. I haven't heard of this problem with other apps upgrade and using mysql. Please provide the errors/stacktrace you saw and your version of mysql. Also check your database configuration in production for settings that are unique to your app/env. |
First thank you everyone for your support, I'm sorry for openging the tickets with as little information but wanted for other people to find an existing ticket if they found the same situation. Mysql Version (aws rds) is 5.7.25, i'm using mysql2 gem I'm using this line in my database.yml
The schema is also with this kind of encoding information for each table : charset: "utf8mb4", collation: "utf8mb4_unicode_ci" In the mysql adaptater of activerecord @config[:encoding] is not in use at all anymore (in rails 6.1.2) |
I had the same encoding problem with MySQL 5.7 after upgrading to Rails 6.1.2, but in my case, it was because I used the wrong client library version (MySQL 8.x client library) to build the Some newer Linux distros only provide MySQL 8.0 client libraries by default (like Ubuntu 20.04 or later), so I think maybe OP has the same problem. |
Can you share the result on the environment? conn = ActiveRecord::Base.connection
pp(
server_version: conn.raw_connection.server_info[:version],
client_version: conn.raw_connection.info[:version],
encoding: conn.instance_variable_get(:@config)[:encoding],
collation: conn.instance_variable_get(:@config)[:collation],
character_set_client: conn.show_variable("character_set_client"),
character_set_results: conn.show_variable("character_set_results"),
character_set_connection: conn.show_variable("character_set_connection"),
collation_connection: conn.show_variable("collation_connection"),
) If you have an encoding issue, the server variables may not be set by the connection (it works on the our test case with non utf8mb4 encoding though). rails/activerecord/test/cases/adapters/mysql2/connection_test.rb Lines 96 to 118 in 1a60826
|
Hello, thanks a lot for this incredible support .
So it seams I'm on the same situation than @masaosg , I will apply the same medication. I will close this thread as a solution is now available if someone has the same issue |
I have this problem without a server/client version mismatch.
If I run
and I can use utf8mb4 characters again. In my case this happens on a CircleCI test run, where it's not easy to change the DB settings. |
I think we should revert that change adding the |
Reverted in 4f5e6b5 for 6-1-stable. main still have that change and maybe we will need to revisit it for 7.0 |
Steps to reproduce
Updating to rails 6.1.2 (a minor update) did create encoding issues with a mysql database.
We are still gathering data on how to reproduce exactly this issue
Expected behavior
A minor update of rails should not change this kind of very sensitive data
Actual behavior
The database was loaded with incorrect encoding leading to bad read, and bad writes to the database, this only showed in production
I suspect this change is linked to the issue :
9f39d00#diff-868f1dccfcbed26a288bf9f3fd8a39c863a4413ab0075e12b6805d9798f556d1
Still investigating
System configuration
Rails version: 6.1.2
Ruby version: 2.7.2
The text was updated successfully, but these errors were encountered: