Skip to content

Commit

Permalink
manually drop snapshot without running its destructor
Browse files Browse the repository at this point in the history
this fixes the panic in debug build:

  thread 'tokio-runtime-worker' panicked at crates/corro-types/src/agent.rs:1306:9:
  max value was not applied

steps to reproduce:

  - schema

    CREATE TABLE todos (
        id INTEGER NOT NULL PRIMARY KEY,
        title TEXT NOT NULL DEFAULT ''
    );

  - node A

    ./corrosion -c corro.toml exec 'INSERT INTO todos (id, title) VALUES (1, "test todo")'

  - node B

    ./corrosion -c corro.toml query 'SELECT * FROM todos'
    ./corrosion -c corro.toml exec 'DELETE FROM todos WHERE id == 1'

  now node A crashes with assert message `max value was not applied`

Signed-off-by: runsisi <runsisi@hust.edu.cn>
  • Loading branch information
runsisi committed Aug 1, 2024
1 parent 71b5413 commit 8a9eb6d
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions crates/corro-agent/src/agent/util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -976,6 +976,8 @@ pub async fn process_multiple_changes(
actor_id: None,
version: None,
})?;

std::mem::forget(snap);
}

tx.commit().map_err(|source| ChangeError::Rusqlite {
Expand Down

0 comments on commit 8a9eb6d

Please sign in to comment.