Skip to content

self.pending_capacity.is_empty() not always guaranteed #224

@DarrenTsung

Description

@DarrenTsung

https://github.com/carllerche/h2/blob/master/src/proto/streams/prioritize.rs#L357

I'm getting panics at this assert when trying to load test by sending 4k notifications as fast as possible. Looking at the code, it looks safe to have this assert as try_assign_capacity can push 0 or 1 streams into self.pending_capacity and can be called from assign_connection_capacity which must pop 1 stream from self.pending_capacity before calling try_assign_capacity.

However, try_assign_capacity can also be called from send_data (https://github.com/carllerche/h2/blob/master/src/proto/streams/prioritize.rs#L148).

When opening a bunch of simultaneous streams, I seeing send_data getting called multiple times (unable to assign capacity, the streams are put in self.pending_capacity). Then a call to assign_connection_capacity when there is extra capacity, then the panic because there are still streams waiting in self.pending_capacity.

Do you guys know what might be happening? Maybe there's a bug externally to the assert and the assert should still hold true, or maybe this assert doesn't hold true with code pushed after the fact?

Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions