-
Notifications
You must be signed in to change notification settings - Fork 3.3k
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
4.7.1 C++ target has new Multithread issue #2210
Comments
An example stack trace: #0 0x0000000000fd2ed0 in __gnu_cxx::__normal_iterator<std::shared_ptrantlr4::atn::ATNConfig*, std::vector<std::shared_ptrantlr4::atn::ATNConfig, std::allocator<std::shared_ptrantlr4::atn::ATNConfig > > >::__normal_iterator (this=0x7ffff5164300, _i=@0x8: ) at /usr/include/c++/5/bits/stl_iterator.h:741 |
Can confirm - I'm seeing this issue as well after upgrading to 4.7.1 to fix a memory leak issue. My stack trace is pretty much identical. Edit: also, my old demo from the first time this issue came up shows the issue after being updated to 4.7.1: https://github.com/jechase/antlr_cpp_threads |
@mike-lischke any updates on this? |
Can you try my pending patch #2177? That solved all my multi threading issues so far. |
@mike-lischke Looks like that worked! No threading or memory leak issues :) |
Confirmed, works great! Huge memory savings too. |
I wonder why you see mem leak fixes, however. There isn't anything in the code that would take care for memory beyond what was there before. @parrt I think this patch can be merged, now that we have 2 other confirmations it does what it is supposed to do. That way interested developers get a thread safe runtime right with the first download of the branch. And it's a pretty important fix (#2177). |
I saw the memory leaks in 4.7.0 and the threading issue in 4.7.1, where the leaks had (presumably) been fixed. So with this to address the threading issues, all problems are solved! At least as far as I'm aware. |
@parrt I assume this can be closed now |
Hi Mike,
I'm doing my developement on 4.7, but I gave a try to the 4.7.1 C++ target:
dfa::DFAState *ParserATNSimulator::getExistingTargetState(dfa::DFAState previousD, size_t t) {
dfa::DFAState retval;
auto iterator = previousD->edges.find(t);
retval = (iterator == previousD->edges.end()) ? nullptr : iterator->second;
return retval;
}
I have been trying to play with the read and write locks in the methods of that class, but it seems the problem is pervasive, if I add locks, I can go a bit further but the overall locking mechanism probably lacks complete testing, hence this is not yet multi-thread safe.
Can you address this? My setup is really complex, would be hard to give you a testcase but we could work on that.
Thanks
Alain
The text was updated successfully, but these errors were encountered: