0.1.13 breaks registering an fd on multiple event loops
alexcrichton opened this issue · 4 comments
Since 0.1.13 the tests for tokio-signal have started failing with an error along the lines of Error { repr: Os { code: 17, message: "File exists" } }
.
It looks like prints two successes in 0.1.12 and only one in 0.1.13:
extern crate tokio_core;
extern crate mio;
use mio::*;
use std::io;
use mio::unix::*;
use std::net::TcpListener;
use std::os::unix::prelude::*;
use tokio_core::reactor::{Core, PollEvented};
fn main() {
let a = Core::new().unwrap();
let b = Core::new().unwrap();
let l = TcpListener::bind("127.0.0.1:0").unwrap();
println!("{:?}", PollEvented::new(Custom(l.as_raw_fd()), &a.handle()));
println!("{:?}", PollEvented::new(Custom(l.as_raw_fd()), &b.handle()));
}
#[derive(Debug)]
struct Custom(i32);
impl Evented for Custom {
fn register(&self, poll: &Poll, token: Token, events: Ready, opts: PollOpt) -> io::Result<()> {
EventedFd(&self.0).register(poll, token, events, opts)
}
fn reregister(&self, poll: &Poll, token: Token, events: Ready, opts: PollOpt) -> io::Result<()> {
EventedFd(&self.0).reregister(poll, token, events, opts)
}
fn deregister(&self, poll: &Poll) -> io::Result<()> {
EventedFd(&self.0).deregister(poll)
}
}
Thanks for the report.
I tried running the snippet w/ tokio-core 0.1.13 but get 2 successes. Do you have more info on how to reproduce? What OS, etc... maybe post the full Cargo.lock?
Ok, this does seem to happen on Linux only and not OS X.
Yes, the OS Travis is using in the test logs above is Linux and I was testing with Linux locally.
I opened #308 which should fix the issue.
I used it to successfully run the tokio-signal tests. Would you mind double confirming this fixes the issue as you see it? I can release a fix once this gets merged.