Open Victor-N-Suadicani opened 1 year ago
I don't know Windows enough to debug this sorry
I can re-produce this issue on Windows following these steps:
Same error here. Compiled code for linux and windows. No error in Linux. In windows got:
ERROR lapin::io_loop: error doing IO error=IOError(Os { code: 10093, kind: Uncategorized, message: "Either the application has not called WSAStartup, or WSAStartup failed." })
Could you paste the exact snippet you're trying and the features you're enabling for lapin?
@Keruspe I got same error. This is my code snippet.
async fn declare_queue(&self, channel: &mut Channel) -> errors::Result<Queue> {
let queue_name = self.queue_name();
let field_table = self.queue_field_table();
let queue_declare_options = self.queue_declare_options();
let queue = channel
.queue_declare(queue_name, queue_declare_options, field_table)
.await?;
Ok(queue)
}
async fn unread_count(&self, channel: &mut Channel) -> errors::Result<u32> {
let queue = self.declare_queue(channel).await?;
Ok(queue.message_count())
}
#[tokio::test]
async fn test_unread_count() {
register_log();
let amqp_uri = conf!().amqp_uri().to_string();
let mut cfg = Config::default();
cfg.url = Some(amqp_uri);
let pool = cfg.create_pool(Some(Runtime::Tokio1)).unwrap();
let conn = pool.get().await.unwrap();
let mut channel = conn.create_channel().await.unwrap();
let unread_count = AuthStream::AuthUserInfoByIdStreams
.unread_count(&mut channel)
.await
.unwrap();
tracing::info!(?unread_count);
}
2024-11-08T07:53:43.923524Z ERROR lapin::io_loop: C:\Users\11989\.cargo\registry\src\rsproxy.cn-0dccff568467c15b\lapin-2.5.0\src\io_loop.rs:279: error doing IO error=IOError(Os { code: 10093, kind: Uncategorized, message: "应用程序没有调用 WSAStartup,或者 WSAStartup 失败。" })
2024-11-08T07:53:43.924021Z ERROR lapin::channels: C:\Users\11989\.cargo\registry\src\rsproxy.cn-0dccff568467c15b\lapin-2.5.0\src\channels.rs:137: Connection error error=IO error: 应用程序没有调用 WSAStartup,或者 WSAStartup 失败。 (os error 10093)
Thanks! I hope to be able to give a proper look at it and give you feedback. Would you be able to test some patches ? (I do not have access to any windows testing env)
Sure. What should I do?
On Windows, I'm getting the following error log when creating a connection and channel in lapin, using it to publish and receive some messages and then letting the program reach the end of main.
The log seems to happen at the end of main. I suppose it has to do with stopping some threads that lapin create but I don't really know.