-
Notifications
You must be signed in to change notification settings - Fork 171
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
Concurrent access to variable causes a race condition detection #499
Comments
Um...I don't think it'd be a test framework issue, should be something wrong in the interpreter. |
It seems that the race condition is caused by assigning the string object |
@saveriomiroddi I think I might need your help on this. We sometimes might have race condition on pointer's target read/assignment. In current implementation this might happen when we assign values to the var BTW if we just put a |
Very interesting. I'll review this over the next few days! |
Hello! This is a very interesting subject. As a general observation, I think this is the typical reasons why scripting interpreters use the GIL 😄 Having said that, I had a cursory look around at the general patterns for handling shared access to pointers (which are not thread safe in Go). I think that the high level behavior of the code would reflect the low-level one (note that I didn't read the source code yet) - in other words, at high level, there is a shared access to a variable, at low level, to a pointer. If this is the case, there are two options:
Not knowing Go well, and maybe, considering it as easier solution, I'd use 1. |
@saveriomiroddi Actually after thinking for a few days, I think this case is acceptable. Yes, it might have a race condition on pointer's target, but that's what users should expect when writing such code. |
If you're completely sure that writing this code won't case the executable to panic (which is undesirable, even for broken code) due to pointers undefined behavior, then that's a solution to the problem. |
We can start writing the thread-related tests and I guess we'll find out then. But does this mean your mutex lock feature will be blocked? |
I will check it! |
I've changed the title and description, since the race condition is not related to the test environment. |
Observed in #493:
When concurrently access a variable, with the race detector, a race condition is detected.
I don't think that race conditions in the interpreted language should reflect in race conditions in the VM, although I'm not entirely sure without a good knowledge of the VM.
Test case:
The text was updated successfully, but these errors were encountered: