The tcp-accept-stress, despite the previous modifications, is still deadlocking
on the osx buildbots. When building/testing/running repeatedly locally, it was
discovered that the test would often fail with TcpStream::connect returning the
error `address not available`.
This test opens up quite a large number of sockets, and it looks like by default
osx isn't the speediest at recycling those sockets for further use.
The test has been modified (and verified) to not deadlock in this error case,
and the test is not just officially ignored on OSX (with no FIXME). I believe
that we'll get good coverage of the relevant code on the linux builders, so this
isn't so much of a loss.
At the same time I turned down the stress parameters to hopefully lighten the
socket load on other platforms.
// option. This file may not be copied, modified, or distributed
// except according to those terms.
// option. This file may not be copied, modified, or distributed
// except according to those terms.
+// ignore-macos osx really doesn't like cycling through large numbers of
+// sockets as calls to connect() will start returning EADDRNOTAVAIL
+// quite quickly and it takes a few seconds for the sockets to get
+// recycled.
+
#![feature(phase)]
#[phase(plugin)]
#![feature(phase)]
#[phase(plugin)]
use native::NativeTaskBuilder;
static N: uint = 8;
use native::NativeTaskBuilder;
static N: uint = 8;
let mut a = l.listen().unwrap();
let cnt = Arc::new(atomic::AtomicUint::new(0));
let mut a = l.listen().unwrap();
let cnt = Arc::new(atomic::AtomicUint::new(0));
- let (tx, rx) = channel();
+ let (srv_tx, srv_rx) = channel();
+ let (cli_tx, cli_rx) = channel();
for _ in range(0, N) {
let a = a.clone();
let cnt = cnt.clone();
for _ in range(0, N) {
let a = a.clone();
let cnt = cnt.clone();
+ let srv_tx = srv_tx.clone();
spawn(proc() {
let mut a = a;
loop {
spawn(proc() {
let mut a = a;
loop {
Err(e) => fail!("{}", e),
}
}
Err(e) => fail!("{}", e),
}
}
});
}
for _ in range(0, N) {
});
}
for _ in range(0, N) {
+ let cli_tx = cli_tx.clone();
spawn(proc() {
for _ in range(0, M) {
let _s = TcpStream::connect(addr.ip.to_string().as_slice(),
addr.port).unwrap();
}
spawn(proc() {
for _ in range(0, M) {
let _s = TcpStream::connect(addr.ip.to_string().as_slice(),
addr.port).unwrap();
}
+ drop((cli_tx, srv_tx));
- assert_eq!(rx.iter().take(N).count(), N);
+ if cli_rx.iter().take(N).count() != N {
+ a.close_accept().unwrap();
+ fail!("clients failed");
+ }
// wait for one acceptor to die
// wait for one acceptor to die
// Notify other receivers should die
a.close_accept().unwrap();
// wait for receivers
// Notify other receivers should die
a.close_accept().unwrap();
// wait for receivers
- assert_eq!(rx.iter().take(N - 1).count(), N - 1);
+ assert_eq!(srv_rx.iter().take(N - 1).count(), N - 1);
// Everything should have been accepted.
assert_eq!(cnt.load(atomic::SeqCst), N * M);
// Everything should have been accepted.
assert_eq!(cnt.load(atomic::SeqCst), N * M);