I am currently developing a little game in rust (I am a beginner). For this game I use threads to read and write on a TcpStream.
The whole project compile without errors.
I have use the macro "info!" everywhere in my project in order to debug it.
When I launch the binary with RUST_LOG="info"
, my thread that listen on the TcpStream exits with the error :
thread 'Server listening thread' has overflowed its stack error: process didn't exit successfully:
target\debug\server.exe
(exit code: 0xc00000fd, STATUS_STACK_OVERFLOW
This exit happens after the data read from stream. In this situation I am able to get some info output before a function call which is :
pub fn ask_shoot(tx: &mut Sender<Msg>, data: Data) {
info!("Asking shoot");
let msg: Msg = Msg::new(Event::EShoot, data.union);
info!("Sending msg to myself: {}", msg);
tx.send(msg).unwrap();
}
This function is called in my thread.
The call to Msg::new(Event::EShoot, data.union);
is also made I get an ifo! output from the new function, but I never get the info!("Sending msg to myself: {}", msg);
Whereas when I disable the environnmeant variable RUST_LOG my thread doesn't exit. So I am wondering what is going on as I want the info output for debugging.
I have try to increase my stack size with (1024*1024*10)
but this doesn't work.
Do you have any lead ?
Edit:
The crate I use for info is log
with the crate env_logger
My implementation of sdt::fmt::Display for Msg is :
impl fmt::Display for Msg {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "Event: {}, Data: {}", self.event, self.data)
}
}