zboxfs / zbox

Zero-details, privacy-focused in-app file system.
https://zbox.io/fs/
Apache License 2.0
1.54k stars 76 forks source link

Panic when trying to write a file after interrupted previous attempt. #69

Open vi opened 4 years ago

vi commented 4 years ago

Example code is from issue about ENOSPC behaviour

Run (cargo run) that example code multiple times, interrupting it with Cltr+C. Eventually it starts failing.

v@l:23:14:16:/tmp/zboxtest$ RUST_BACKTRACE=1 cargo run
    Finished dev [unoptimized + debuginfo] target(s) in 0.06s
     Running `target/debug/zboxtest`
............................................................................................................................
^C
v@l:23:14:23:/tmp/zboxtest$ RUST_BACKTRACE=1 cargo run
    Finished dev [unoptimized + debuginfo] target(s) in 0.05s
     Running `target/debug/zboxtest`
......................................................................................
^C
v@l:23:14:25:/tmp/zboxtest$ RUST_BACKTRACE=1 cargo run
    Finished dev [unoptimized + debuginfo] target(s) in 0.05s
     Running `target/debug/zboxtest`
.......................................................................................................................................................................................................................................................................................................
^C
v@l:23:14:27:/tmp/zboxtest$ RUST_BACKTRACE=1 cargo run
    Finished dev [unoptimized + debuginfo] target(s) in 0.05s
     Running `target/debug/zboxtest`
................................................................................................................................................................................................................................................................................................................................................................................................................................................
^C
v@l:23:14:30:/tmp/zboxtest$ RUST_BACKTRACE=1 cargo run
    Finished dev [unoptimized + debuginfo] target(s) in 0.05s
     Running `target/debug/zboxtest`
...............................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................
^C
v@l:23:14:37:/tmp/zboxtest$ RUST_BACKTRACE=1 cargo run
    Finished dev [unoptimized + debuginfo] target(s) in 0.05s
     Running `target/debug/zboxtest`
.thread 'main' panicked at 'assertion failed: !sec.is_finished()', /home/vi/.cargo/registry/src/github.com-1ecc6299db9ec823/zbox-0.8.8/src/volume/storage/file/sector.rs:327:17
stack backtrace:
   0: backtrace::backtrace::libunwind::trace
             at /cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.40/src/backtrace/libunwind.rs:88
   1: backtrace::backtrace::trace_unsynchronized
             at /cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.40/src/backtrace/mod.rs:66
   2: std::sys_common::backtrace::_print_fmt
             at src/libstd/sys_common/backtrace.rs:84
   3: <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt
             at src/libstd/sys_common/backtrace.rs:61
   4: core::fmt::write
             at src/libcore/fmt/mod.rs:1025
   5: std::io::Write::write_fmt
             at src/libstd/io/mod.rs:1426
   6: std::sys_common::backtrace::_print
             at src/libstd/sys_common/backtrace.rs:65
   7: std::sys_common::backtrace::print
             at src/libstd/sys_common/backtrace.rs:50
   8: std::panicking::default_hook::{{closure}}
             at src/libstd/panicking.rs:193
   9: std::panicking::default_hook
             at src/libstd/panicking.rs:210
  10: std::panicking::rust_panic_with_hook
             at src/libstd/panicking.rs:471
  11: std::panicking::begin_panic
             at /rustc/3eeb8d4f2fbae0bb1c587d00b5abeaf938da47f4/src/libstd/panicking.rs:404
  12: zbox::volume::storage::file::sector::SectorMgr::write_blocks
             at /home/vi/.cargo/registry/src/github.com-1ecc6299db9ec823/zbox-0.8.8/src/volume/storage/file/sector.rs:327
  13: <zbox::volume::storage::file::file::FileStorage as zbox::volume::storage::Storable>::put_blocks
             at /home/vi/.cargo/registry/src/github.com-1ecc6299db9ec823/zbox-0.8.8/src/volume/storage/file/file.rs:224
  14: zbox::volume::storage::storage::Writer::write_frame
             at /home/vi/.cargo/registry/src/github.com-1ecc6299db9ec823/zbox-0.8.8/src/volume/storage/storage.rs:650
  15: <zbox::volume::storage::storage::Writer as std::io::Write>::write
             at /home/vi/.cargo/registry/src/github.com-1ecc6299db9ec823/zbox-0.8.8/src/volume/storage/storage.rs:668
  16: <zbox::volume::volume::Writer as std::io::Write>::write
             at /home/vi/.cargo/registry/src/github.com-1ecc6299db9ec823/zbox-0.8.8/src/volume/volume.rs:331
  17: std::io::Write::write_all
             at /rustc/3eeb8d4f2fbae0bb1c587d00b5abeaf938da47f4/src/libstd/io/mod.rs:1354
  18: <zbox::content::segment::Writer as std::io::Write>::write
             at /home/vi/.cargo/registry/src/github.com-1ecc6299db9ec823/zbox-0.8.8/src/content/segment.rs:487
  19: zbox::content::content::Writer::append_chunk
             at /home/vi/.cargo/registry/src/github.com-1ecc6299db9ec823/zbox-0.8.8/src/content/content.rs:274
  20: <zbox::content::content::Writer as std::io::Write>::write
             at /home/vi/.cargo/registry/src/github.com-1ecc6299db9ec823/zbox-0.8.8/src/content/content.rs:350
  21: <zbox::content::chunker::Chunker<W> as std::io::Write>::write
             at /home/vi/.cargo/registry/src/github.com-1ecc6299db9ec823/zbox-0.8.8/src/content/chunker.rs:164
  22: <zbox::content::store::Writer as std::io::Write>::write
             at /home/vi/.cargo/registry/src/github.com-1ecc6299db9ec823/zbox-0.8.8/src/content/store.rs:276
  23: <zbox::fs::fnode::Writer as std::io::Write>::write
             at /home/vi/.cargo/registry/src/github.com-1ecc6299db9ec823/zbox-0.8.8/src/fs/fnode.rs:812
  24: <zbox::file::File as std::io::Write>::write::{{closure}}
             at /home/vi/.cargo/registry/src/github.com-1ecc6299db9ec823/zbox-0.8.8/src/file.rs:587
  25: zbox::trans::txmgr::TxHandle::run
             at /home/vi/.cargo/registry/src/github.com-1ecc6299db9ec823/zbox-0.8.8/src/trans/txmgr.rs:206
  26: <zbox::file::File as std::io::Write>::write
             at /home/vi/.cargo/registry/src/github.com-1ecc6299db9ec823/zbox-0.8.8/src/file.rs:586
  27: zboxtest::main
             at src/main.rs:8

If needed I can attach a storage dump with the repro.

burmecia commented 4 years ago

Not sure if this issue still exists after eb8b135, I cannot reproduce it on my end. Could you check it again on your end?