I have an application using tokio-cron-scheduler. However, after the application starting and running for a while, the cron scheduler no longer work and print Tick send error SendError(true) to the console every 500ms.
I did some investigation on it, here is the source code where produce the error:
loop {
if let Err(e) = tx.send(true) {
let shutdown = { *(shutdown.read().await) };
if shutdown {
return;
}
error!("Tick send error {:?}", e);
}
tokio::time::sleep(Duration::from_millis(500)).await;
}
tokio::sync::broadcast::Sender documentation says
An unsuccessful send would be one where all associated [Receiver] handles have already been dropped.
I have no idea why this occurs. Would you please provide some hints or suggestions for how to debug this error? Since my application is a little complex, so I'm sorry that I can't provide a minimal example to reproduce the issue.
Hi @jukanntenn
Yes, an MPSC receiver channel was dropped somewhere causing this. Can be that your job scheduler variable ran out of scope. It is a bit hard to debug without the code though.
I have an application using tokio-cron-scheduler. However, after the application starting and running for a while, the cron scheduler no longer work and print
Tick send error SendError(true)
to the console every 500ms.I did some investigation on it, here is the source code where produce the error:
tokio::sync::broadcast::Sender
documentation saysI have no idea why this occurs. Would you please provide some hints or suggestions for how to debug this error? Since my application is a little complex, so I'm sorry that I can't provide a minimal example to reproduce the issue.
Thanks a lot!