Skip to content

[Bug]: Intermittent issue causing failure to decode jobs #75

Description

@m4c-ro

What happened?

I'm having an issue where apalis doesn't run any background jobs from a particular worker, but the missing jobs reappear after a restart. This issue is occurring approximately every third time I run my program. I'm using the sqlite backend.

Looking into it I started calling list_tasks. In the error case, the very first job I enqueue immediately causes the call to list_tasks to fail with a decode error:

Decode(DecodeError(DecodeError(Syntax("invalid type: sequence, expected unit"))))

I think this is coming from serde_json bubbling up from apalis-sql/src/from_row.rs. Jobs are processed after I restart, so maybe there is some state outside of the database which is corrupted. But here is the state of the jobs table when this error occurred anyway:

 job       | id                         | job_type | status | attempts | max_attempts | run_at     | last_result | lock_at    | lock_by | done_at    | priority | metadata
-----------+----------------------------+----------+--------+----------+--------------+------------+-------------+------------+---------+------------+----------+----------
<--snip--> | 01KQYJKD4B4Z0QMHWM51XQZSSM | email    | Done   | 1        | 5            | 1778068862 | {"Ok":null} | 1778068862 | email   | 1778068862 | 0        | {}

I enabled tracing at the TRACE level, and added the tracing layer to the worker, but unfortunately I'm not seeing any logs related to this issue.

Crate versions:

apalis = { version = "1.0.0-rc.7", default-features = false, features = ["catch-panic", "limit", "retry", "timeout", "tracing"] }
apalis-codec = { version = "0.1.0-rc.7", default-features = false, features = ["msgpack"] }
apalis-core = "1.0.0-rc.7"
apalis-cron = "1.0.0-rc.7"
apalis-sqlite = "1.0.0-rc.7"

Any ideas?

Expected behavior

Jobs to be run reliably

Steps to reproduce

Not sure yet. This seems to happen randomly.

Minimal code example

Version

1.0.0-rc.x

Environment

  • OS: Linux
  • Rust version:
  • Cargo version:

Relevant log output

Additional context

No response

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions