SPMC_Queue icon indicating copy to clipboard operation
SPMC_Queue copied to clipboard

Data racing issue with heavy load

Open QianYizhou opened this issue 1 year ago • 1 comments

Hi, Your SPMC_Queue is really inspiring! But it seems there's still a data racing issue.

My test steps:

  1. in multhread.cc, extend array size defined in struct Msg to make it heavier, e.g., struct Msg { uint64_t tsc; uint64_t i[1]; }; to struct Msg { uint64_t tsc; uint64_t i[100]; double f[100]; };
  2. compare Msg.f as well
  3. Loop more times (1e6 -> 1e7)

Then these's a possibility of assert fault. I think it may related to the write() operation: sees that operation does't care if the data is occupied by a reader -- the data may be changed by write() while reader is reading.

QianYizhou avatar May 16 '23 09:05 QianYizhou