[user@vm-arch rust]$ uname -a
Linux vm-arch 3.12.7-2-ARCH #1 SMP PREEMPT Sun Jan 12 13:09:09 CET 2014 x86_64 GNU/Linux
[user@vm-arch rust]$ rustc -v
rustc 0.9
host: x86_64-unknown-linux-gnu
Description
The following code spawns a Unix Socket on /tmp/main.sock. Using nc -U /tmp/main.rs, the program responds with Incomming as expected. Pressing Ctrl-D, to issue an EOF, directly after connecting crashes the program. The issue does not occur when calling read_byte on the stream directly, or by using an TcpListener.
Code
use std::io::{Listener, Acceptor};
fn main() {
let mut acceptor = std::io::net::unix::UnixListener::bind(&Path::new("/tmp/main.sock")).listen().unwrap();
println("Listening");
for stream in acceptor.incoming() {
do spawn {
println("Incoming");
std::io::buffered::BufferedStream::new(stream.unwrap()).read_byte();
}
}
}
Expected behaviour
No crash, maybe possibly an error message, but the application keeps on running.
Observed behaviour
netcat -U /tmp/main.sock
^D
Listening
Incoming
There are not many persons who know what wonders are opened to them in the
stories and visions of their youth; for when as children we listen and dream,
we think but half-formed thoughts, and when as men we try to remember, we are
dulled and prosaic with the poison of life. But some of us awake in the night
with strange phantasms of enchanted hills and gardens, of fountains that sing
in the sun, of golden cliffs overhanging murmuring seas, of plains that stretch
down to sleeping cities of bronze and stone, and of shadowy companies of heroes
that ride caparisoned white horses along the edges of thick forests; and then
we know that we have looked back through the ivory gates into that world of
wonder which was ours before we were wise and unhappy.
fatal runtime error: assertion failed: !ptr.is_null()
Aborted (core dumped)
System
Description
The following code spawns a Unix Socket on
/tmp/main.sock
. Usingnc -U /tmp/main.rs
, the program responds with Incomming as expected. Pressing Ctrl-D, to issue an EOF, directly after connecting crashes the program. The issue does not occur when callingread_byte
on the stream directly, or by using an TcpListener.Code
Expected behaviour
No crash, maybe possibly an error message, but the application keeps on running.
Observed behaviour