Skip to content

DelayedJob crash if it failed to write error log #65

@guoyk93

Description

@guoyk93

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\":\"斐 ....

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions