delayed_job icon indicating copy to clipboard operation
delayed_job copied to clipboard

DelayedJob crash if it failed to write error log

Open guoyk93 opened this issue 9 years ago • 0 comments

Problem is described below.

  1. Server try to fetch a JSON object of user information from a remote server. However some special character (maybe utf8mb4) make JSON.parse raise a error.
  2. DelayedJob caught the error thrown above, then try to write the stack trace into last_error field of table.
  3. MySQL backend of ActiveRecord happend to be in UTF8 encoding, it throw a error.
  4. 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\":\"斐 ....

guoyk93 avatar Sep 11 '14 15:09 guoyk93