Skip to content

User code can lead to infinite panics in interact in deadpool-sqlite #113

@SergioBenitez

Description

@SergioBenitez

Here's the interact method, for reference:

https://github.com/bikeshedder/deadpool/blob/2c7a0b7aee915e775f8d751e0a73ec884bae6f71/sqlite/src/lib.rs#L136-L146

If f() panics, it will do so while the lock is held. This poisons the lock. Every attempt to interact() thereafter will panic!() because of the unwrap() on line 144 (itself because of the unwrap() in 142). I would suggest the following changes:

  1. Use a non-poisoning lock, like parking_lot::Mutex().
  2. Propagate errors from spawn_blocking(), don't panic.

Alternatively, detect the error and close the connection so that the poisoned mutex is never reused.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-sqliteArea: SQLite / deadpool-sqlitebugCategory: This is a bug.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions