spacedriveapp / spacedrive

Spacedrive is an open source cross-platform file explorer, powered by a virtual distributed filesystem written in Rust.
https://spacedrive.com
GNU Affero General Public License v3.0
29.4k stars 839 forks source link

Watcher panicked after editing file #2458

Open matheus-consoli opened 2 months ago

matheus-consoli commented 2 months ago

Describe the bug

The application crashes after editing a new file create from outside of Spacedrive.

Reproduction

  1. create a new Location
  2. let it open on the side
  3. create a new file in the location using another application (touch file)
  4. edit the file (vim file)

Expected behavior

The application should not crash

Platform and versions

>> pnpm --version && cargo --version && rustc --version
9.0.6
cargo 1.78.0 (54d8815d0 2024-03-26)
rustc 1.78.0 (9b00956e5 2024-04-29)

Stack trace

2024-05-06T22:37:54.692469Z ERROR sd_core: core/src/lib.rs:239: panicked at core/src/location/manager/watcher/utils.rs:942:13:
not yet implemented: file has changed in some way, re-identify it panic.file="core/src/location/manager/watcher/utils.rs:942" panic.column=13
fatal runtime error: failed to initiate panic, error 3

Additional context

The issue's origin is this todo!(): https://github.com/spacedriveapp/spacedrive/blob/44478207e72495b3777e294660d78939711b544f/core/src/location/manager/watcher/utils.rs#L942

I'll be happy to work on it, but I will just need some help with the expected behavior :)

fogodev commented 2 months ago

Yeah, a concurrency issue that I mapped with this todo! but was hoping that it would never happen ):

Will give it a better look when possible