Two bugs in C++ reader
Created by: JiayiFeng
There are two bugs in our current code:
-
In the double buffer reader: The double buffer reader creates a prefetching thread to read data from files and yield them into a member variable
bufer_
. However, if the double buffer itself is destroyed before the prefetching thread, it will raise a segment fault because the thread is still trying to yield data to a destroyed address. -
In the shuffle reader: https://github.com/PaddlePaddle/Paddle/blob/d7d0c1eb0be54611ad093dc210d48317a678a9bb/paddle/fluid/operators/reader/create_shuffle_reader_op.cc#L49-L65 The
ReadIntoBuffers ()
is invoked byShuffleReader
's constructor. So if the underlying reader holds an empty file, an exception will be thrown by line 53. That is unexpected. The exception of 'no next data' should be thrown inReadNext()
, not here.