delayed_job
delayed_job copied to clipboard
DelayedJob crash if it failed to write error log
Problem is described below.
- Server try to fetch a JSON object of user information from a remote server. However some special character (maybe
utf8mb4
) makeJSON.parse
raise a error. - DelayedJob caught the error thrown above, then try to write the stack trace into
last_error
field of table. - MySQL backend of ActiveRecord happend to be in UTF8 encoding, it throw a error.
- WHOLE running DelayedJob instance crashed and stopped.
I think some where need a 'begin ... rescue`
log writing failed. "\xEF" from ASCII-8BIT to UTF-8
Mysql2::Error: Incorrect string value: '\xF0\x9F\x92\x85 \xE1...' for column 'last_error' at row 1: UPDATE `delayed_jobs` SET `attempts` = 1, `last_error` = '757: unexpected token at \'{\"subscribe\":1,\"openid\":\"o6uLOt6Z3zaXfWBBcz4Z4Gz3PmP8\",\"nickname\":\" 麦小喵💅 ღ奶酪酱💋\",\"sex\":2,\"language\":\"zh_CN\",\"city\":\"\",\"province\":\"\",\"country\":\"斐 ....