A bug in framework::Channel
Created by: JiayiFeng
- Create a new channel whose capacity is 2.
- Send 2 data(0 and 1) into the new channel.
- Try to send the third data(3) to the channel. For the channel is full, the
Send()
function will be blocked. -
Receive()
data from the channel with another thread. The first received data should be 0 in my understanding. However, in my test I found it's 3 in fact.
In PR #9387 I did a few modifications in the channel_test
to help you replicate the bug:
[ RUN ] Channel.RecevingOrderEqualToSendingOrderWithBufferedChannel
97: /Users/baidu/Documents/git_workspace/Paddle/paddle/fluid/framework/channel_test.cc:52: Failure
97: Expected: recv
97: Which is: 2
97: To be equal to: i
97: Which is: 0
97: /Users/baidu/Documents/git_workspace/Paddle/paddle/fluid/framework/channel_test.cc:52: Failure
97: Expected: recv
97: Which is: 3
97: To be equal to: i
97: Which is: 1
97: /Users/baidu/Documents/git_workspace/Paddle/paddle/fluid/framework/channel_test.cc:52: Failure
97: Expected: recv
97: Which is: 4
97: To be equal to: i
97: Which is: 2
97: /Users/baidu/Documents/git_workspace/Paddle/paddle/fluid/framework/channel_test.cc:52: Failure
97: Expected: recv
97: Which is: 0
97: To be equal to: i
97: Which is: 3
97: /Users/baidu/Documents/git_workspace/Paddle/paddle/fluid/framework/channel_test.cc:52: Failure
97: Expected: recv
97: Which is: 1
97: To be equal to: i
97: Which is: 4
97: [ FAILED ] Channel.RecevingOrderEqualToSendingOrderWithBufferedChannel (408 ms)