ivaldi/brimir

Internal software error when receiving new message

Closed this issue · 4 comments

From time to time, I'm seeing ActiveRecord::StatementInvalid (Mysql2::Error: Incorrect string value: ...) when new messages are being received.

The code that is throwing this error is:

app/controllers/tickets_controller.rb:168
@ticket = TicketMailer.receive(message)

We're not using MySQL ourselves, so I haven't seen this before.
Could you post the value of the string? Maybe there is some incorrectly encoded stuff in there that MySQL rejects. Are you using utf8mb4 as character set for the mysql database, tables and fields?

+------------------------+-------+
| Variable_name | Value |
+------------------------+-------+
| character_set_database | utf8 |
+------------------------+-------+
Collation: utf8_general_ci

I'll try to capture the message next time this is happening.

MySQL doesn't fully implement utf8 when you have the utf8 character set. Could you convert your database, tables and fields (yes, all three levels need this) to use utf8mb4?
More info at: https://mathiasbynens.be/notes/mysql-utf8mb4

Thanks for the hint! Now converted our database to utf8mb following https://railsmachine.com/articles/2017/05/19/converting-a-rails-database-to-utf8mb4.html
Works great ;)