Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WSAStartup Error on Windows #377

Open
Victor-N-Suadicani opened this issue Mar 28, 2023 · 7 comments
Open

WSAStartup Error on Windows #377

Victor-N-Suadicani opened this issue Mar 28, 2023 · 7 comments

Comments

@Victor-N-Suadicani
Copy link

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.

[2023-03-28T11:48:05Z 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." })

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.

@Keruspe
Copy link
Collaborator

Keruspe commented May 19, 2023

I don't know Windows enough to debug this sorry

@gy0801151351
Copy link

I can re-produce this issue on Windows following these steps:

  1. consume a queue.
  2. send Ctrl+C to console.

图片

@egargale
Copy link

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." })

@Keruspe
Copy link
Collaborator

Keruspe commented Jul 11, 2024

Could you paste the exact snippet you're trying and the features you're enabling for lapin?

@zemelLeong
Copy link

zemelLeong commented Nov 8, 2024

@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)

image

@Keruspe
Copy link
Collaborator

Keruspe commented Nov 8, 2024

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)

@zemelLeong
Copy link

Sure. What should I do?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants