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

crashes #60

Open
avnerbarr opened this issue Dec 30, 2021 · 2 comments
Open

crashes #60

avnerbarr opened this issue Dec 30, 2021 · 2 comments

Comments

@avnerbarr
Copy link

Hi
Getting crashes with this message:

thread '<unnamed>' panicked at 'Channel from calling thread disconnected: "SendError(..)"'

specifically:


                    let batch_output = handler(batch_input $(, &context.$ctx_arg )*);
                    for (output, mut result_tx) in batch_output.into_iter().zip(batch_txs) {
                        result_tx.send(output).expect("Channel from calling thread disconnected");
                    }

Seems if the client end disconnects / hangs etc. this will cause the server to crash (batched_fn channel)

@epwalsh
Copy link
Owner

epwalsh commented Jan 4, 2022

Hey @avnerbarr, are you able to reproduce this consistently? If so, how? I'd like to try.

@avnerbarr
Copy link
Author

Hi @epwalsh

The way I would suggest is to create a toy project (I ran in debug) which calls out to the server and kill the process before the server is able to respond.

Very trivial example I tried which seems to do the trick (most times):

async fn call_server(&self, text: &str) {

        let mut req = Request::from(text.to_string());
        
        let client = Self::builder();

        let p = client.json(&req);

        let a = p.timeout(std::time::Duration::from_secs(3)).send().await?;

        a.json::<Response>()
            .await
            .map_err(|error| {
                Self::report_error(&error);
                CloudError::from(error)
            })
}


fn builder() -> RequestBuilder {
        reqwest::Client::new().post(format!(
            "{}://{}:{}/generate",
            Self::protocol(),
            Self::host(),
            Self::port()
        )) // stubbed
    }

The server is per the code example, but perhaps tweak the batch size and batch time to allow easier debugging

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

2 participants