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

Oneshot: UB triggered when using Axum #47

Closed
nastynaz opened this issue Jun 2, 2024 · 2 comments
Closed

Oneshot: UB triggered when using Axum #47

nastynaz opened this issue Jun 2, 2024 · 2 comments

Comments

@nastynaz
Copy link

nastynaz commented Jun 2, 2024

I used the AsyncSender and AsyncReceiver channels and this code started panicking when using kanal. I tried it with Flume and Tokio mpsc channels and there's no issue.

It happens when a client cancels their HTTP request, causing Axum to cancel the future that calls this:

  pub async fn pnl_report(&self) -> HashMap<Coin, CurrentPnl> {
      let (tx, rx) = tokio::sync::oneshot::channel();
      self.query_sender // <-- kanal async sender
          .send(PNLQuery::Report(tx))
          .await
          .expect("BUG: query sender channel should never be closed");

      rx.await
          .expect("BUG: oneshot query sender should never be closed") // <- this panics
  }

It appears that somehow the .send() is getting cancelled but the rx.await isn't.

@nastynaz nastynaz changed the title UB triggered by using Axum UB triggered when using Axum Jun 2, 2024
@fereidani fereidani changed the title UB triggered when using Axum Oneshot: UB triggered when using Axum Jul 21, 2024
@fereidani
Copy link
Owner

I'm dropping oneshot feature, going to continue it in another package. Its design need to change and it is not compatible with mpmc channel signal design.

@fereidani
Copy link
Owner

there are already report open for this bug.

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