Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Data racing issue with heavy load #3

Open
QianYizhou opened this issue May 16, 2023 · 1 comment
Open

Data racing issue with heavy load #3

QianYizhou opened this issue May 16, 2023 · 1 comment

Comments

@QianYizhou
Copy link

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.

@leeshineSZ
Copy link

I also have this question. how to deal with the competition?while reader is reading, the writer is going to write the same area.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants