inotify-rs icon indicating copy to clipboard operation
inotify-rs copied to clipboard

panic when call event_stream

Open rink1969 opened this issue 3 years ago • 1 comments

panic info:

   5: std::panicking::begin_panic
             at ~/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/panicking.rs:505:12
   6: tokio::io::driver::Handle::current
             at ~/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-0.3.5/src/io/driver/mod.rs:277:13
   7: tokio::io::async_fd::AsyncFd<T>::with_interest
             at ~/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-0.3.5/src/io/async_fd.rs:99:51
   8: tokio::io::async_fd::AsyncFd<T>::new
             at ~/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-0.3.5/src/io/async_fd.rs:89:9
   9: inotify::stream::EventStream<T>::new
             at ~/.cargo/registry/src/github.com-1ecc6299db9ec823/inotify-0.9.1/src/stream.rs:35:17
  10: inotify::inotify::Inotify::event_stream
             at ~/.cargo/registry/src/github.com-1ecc6299db9ec823/inotify-0.9.1/src/inotify.rs:406:9
  11: controller::sync::Notifier::watch::{{closure}}
             at ~/work/github/cita-cloud/controller_poc/src/sync.rs:128:26

related source code:

        let mut inotify = Inotify::init().expect("Failed to initialize inotify");

        let root_path = Path::new(&self.root);
        let mut wds = Vec::new();
        for dir in SYNC_FOLDERS.iter() {
            let path = root_path.join(dir);
            let wd = inotify.add_watch(path, WatchMask::MOVED_TO).unwrap();
            wds.push(wd);
        }

        let mut buffer = vec![0u8; 4096];
        let mut stream = inotify.event_stream(&mut buffer).unwrap();

        while let Some(event_or_error) = stream.next().await {

This happend when upgrade inotify to latest version (v0.9.1). After back to v0.8.3, it's ok.

rink1969 avatar Dec 14 '20 12:12 rink1969

Thank you for reporting!

hannobraun avatar Dec 14 '20 19:12 hannobraun