Skip to content

In some cases, the order of values retrieved by calling try_dequeue does not match the order in which the values were placed by enqueue. #424

@wangxm7237

Description

@wangxm7237

Call Sequence:
1 call to enqueue, inserting value 4.
2.After a 50ms interval, second call to enqueue, inserting value 0.
3.Within less than 1ms, first call to try_dequeue, retrieving value 0.
4Within less than 1ms, second call to try_dequeue, retrieving value 4.

The first enqueue operation (ImplicitProducer::enqueue) inserts value 4 into an instance (e.g., 0x0000007f28001920).
The second enqueue operation (ImplicitProducer::enqueue) inserts value 0 into a different instance (e.g., 0x0000007f2c0103a0).
The first try_dequeue operation selects the instance (0x0000007f2c0103a0) based on a "best" scoring mechanism and retrieves value 0.
The second try_dequeue operation selects the instance (0x0000007f28001920) based on the same mechanism and retrieves value 4.

Is there a solution to ensure that the dequeue order matches the enqueue order in this scenario?

Image

We checked the code and appended the log and found

Image
For data 0 and data 4, the bestSize calculation is 1, resulting in the wrong order of data when retrieving.

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