sagebind / isahc

The practical HTTP client that is fun to use.

Home Page:https://docs.rs/isahc

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[ panic] isahc panicked at 'called `Result::unwrap()` on an `Err`

txgj opened this issue · comments

commented

thread 'isahc-agent-0' panicked at 'called Result::unwrap() on an Err value: Os { code: 1, kind: PermissionDenied, message: "..." }', /root/.cargo/registry/src/github.com-1ecc6299db9ec823/isahc-1.7.2/src/agent/mod.rs:548:68
note: run with RUST_BACKTRACE=1 environment variable to display a backtrace

commented

cause:

self.selector.register(socket, readable, writable).unwrap();

code in fn register:

match result {
            Err(e) if is_bad_socket_error(&e) => {
                tracing::debug!(socket, error = ?e, "bad socket registered, will try again later");
                self.bad_sockets.insert(socket);
                Ok(())
            }
            result => result,
        }

Thanks for filing an issue! I'll take a deeper look into this when I am able. At a cursory glance, the key part of this error is that the cause is an ErrorKind::PermissionDenied from the operating system. Off the top of my head the only reason why this error might occur is if your user doesn't have permission to open certain sockets.

Also, which operating system are you experiencing this error on? That might help lead me into the right direction.

Could you share an example program that reproduces this problem? That would also be very helpful. You wouldn't happen to be using dial by chance, are you? Sometimes that can cause weird errors like this one if you supply invalid socket information, such as specifying an ordinary file path with the unix_socket option.

commented

@sagebind Thank you very much!
The operating system is linux.
I just use isahc like this:

  let resp = self
            .client
            .put(&host)
            .headers(headers)
            .body(buf)
            .send()?;

This problem is sporadic. I run this on many machines and only one machine's application was crashed caused by this panic. Maybe at that point, something (such as network or hard disk) went wrong?

Hello,

I'm facing the same problem as @txgj when using isahc, with the same error message:

thread 'isahc-agent-0' panicked at 'called Result::unwrap() on an Err value: Os { code: 1, kind: PermissionDenied, message: "Operation not permitted" }', /usr/local/cargo/registry/src/github.com-1ecc6299db9ec823/isahc-1.7.2/src/agent/mod.rs:548:68

The application is using the isahc::client::HttpClient::send_async(request).await, and not trying to use dial or a custom path for a socket

The app is running on a container inside a k8s cluster, and the problem as @txgj mentioned is sporadic

Is there an investigation going on for this problem ?

Thanks :)

@men1n2 This issue is the investigation. 😄 I cannot promise any sort of timeline for fixing this, but I will be looking into it over the next week or so to try and identify the problem. Right now I don't even know what the cause of this might be so it might be a little while before I can identify a fix.