diff --git a/message-queue/src/client.rs b/message-queue/src/client.rs index 43ee8ced1..4f2703400 100644 --- a/message-queue/src/client.rs +++ b/message-queue/src/client.rs @@ -68,9 +68,13 @@ impl MessageQueue { async fn send(socket: &mut TcpStream, msg: MessageQueueRequest) -> bool { let msg = borsh::to_vec(&msg).unwrap(); let Ok(()) = socket.write_all(&u32::try_from(msg.len()).unwrap().to_le_bytes()).await else { + log::warn!("couldn't send the message len"); + return false; + }; + let Ok(()) = socket.write_all(&msg).await else { + log::warn!("couldn't write the message"); return false; }; - let Ok(()) = socket.write_all(&msg).await else { return false }; true } @@ -134,8 +138,12 @@ impl MessageQueue { if !Self::send(&mut socket, msg.clone()).await { continue 'outer; } - let Ok(status) = socket.read_u8().await else { - continue 'outer; + let status = match socket.read_u8().await { + Ok(status) => status, + Err(e) => { + log::warn!("couldn't read status u8: {e:?}"); + continue 'outer; + } }; // If there wasn't a message, check again in 1s // TODO: Use a notification system here @@ -150,12 +158,17 @@ impl MessageQueue { // Timeout after 5 seconds in case there's an issue with the length handling let Ok(msg) = tokio::time::timeout(core::time::Duration::from_secs(5), async { // Read the message length - let Ok(len) = socket.read_u32_le().await else { - return vec![]; + let len = match socket.read_u32_le().await { + Ok(len) => len, + Err(e) => { + log::warn!("couldn't read len: {e:?}"); + return vec![]; + } }; let mut buf = vec![0; usize::try_from(len).unwrap()]; // Read the message let Ok(_) = socket.read_exact(&mut buf).await else { + log::warn!("couldn't read the message"); return vec![]; }; buf diff --git a/processor/src/main.rs b/processor/src/main.rs index f673169bb..8aa7ef196 100644 --- a/processor/src/main.rs +++ b/processor/src/main.rs @@ -563,6 +563,8 @@ async fn run(mut raw_db: D, network: N, mut loop { let mut txn = raw_db.txn(); + log::trace!("new db txn in run"); + let mut outer_msg = None; tokio::select! {