Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

panic when call event_stream #164

Open
rink1969 opened this issue Dec 14, 2020 · 1 comment
Open

panic when call event_stream #164

rink1969 opened this issue Dec 14, 2020 · 1 comment

Comments

@rink1969
Copy link

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.

@hannobraun
Copy link
Owner

Thank you for reporting!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants