Skip to content

std::thread::sleep used in send_derived() of channels may cause deadlock #1

@solopine

Description

@solopine

I am using tokio and this lib together, and I got deadlock in the following situation:
I use MultiAtomicArc and set BUFFER_SIZE = 8. When I send the 9th event, it will block the consumer code.
I checked the send method of MultiAtomicArc chanel in src/multi/channels/arc/atomic.rs, and found it uses std::thread::sleep instead of tokio::time::sleep (line 175), which will block the whole thread, while the consumer task spawned by tokio may be running in the same thread.

In other multi channels, there is also std::thread::sleep used.

Also, in the with_delays() of keen-retry, it also use std::thread::sleep, which block the whole thread when sending event with retry.

I am curious why not using tokio::time::sleep?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions