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

terminate called after throwing an instance of 'std::error_code' when read_row #252

Open
fs273 opened this issue Oct 25, 2024 · 0 comments

Comments

@fs273
Copy link

fs273 commented Oct 25, 2024

I just started using this library, version 2.3.0, currently only using reader's read_row in a simple loop to read each line and print out, it can handle 99.99% of csv files correctly.
But there are some files reading rows will throw terminate called after throwing an instance of 'std::error_code' error, directly resulting in Aborted(core dumped), After pop_front:

row = this->records->pop_front();
, the program aborts. After two days of testing, I have found this occurs only during execution, and reproduce every time it encounter a fixed line in the csv file, but it is ok when I debug it.
I realized it might be a multithreading issue, I add std::this_thread::sleep_for(std::chrono::milliseconds(1)); after
this->read_csv_worker = std::thread(&CSVReader::read_csv, this, internals::ITERATION_CHUNK_SIZE);

Now it's fine to read all csvs.
But I still don't understand the cause of this problem. Why is the read_csv thread not active? Does pop_front cause core dumping before read_csv thread is ready?
Sorry I couldn't provide the csv that would reproduce the problem.

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

1 participant