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

Race condition in chargePoint.Start() #227

Closed
andig opened this issue Oct 6, 2023 · 4 comments · Fixed by #228 or #232
Closed

Race condition in chargePoint.Start() #227

andig opened this issue Oct 6, 2023 · 4 comments · Fixed by #228 or #232

Comments

@andig
Copy link
Contributor

andig commented Oct 6, 2023

chargePoint.Start() sets global variable

ocppj.FormationViolation = ocppj.FormatViolationV16

Same variable is written by centralSystem.Start() which creates a race condition during test.

This is particularly problematic since centralSystem.Start() cannot be serialised, i.e. it is not clear when the cs actually has started.

@andig andig changed the title Re Race condition in chargePoint.Start() Oct 6, 2023
@andig
Copy link
Contributor Author

andig commented Oct 6, 2023

A potential workaround could be to use dispatcher.IsRunning() to determine if at least the cs' Go routine has started. This leads to another race. While dispatcher.IsRunning() uses mutex, DefaultServerDispatcher.Start() does not serialise its access to d.running. I can provide a PR for this second race.

@andig
Copy link
Contributor Author

andig commented Oct 9, 2023

@lorenzodonini thank you for the quick merge. Could we keep this issue open? The workaround is now fixed, the race in ocppj.FormatViolationV16 still present. I you can give a hint what this value- shared between CS and CP- should do I could take another look.

@andig
Copy link
Contributor Author

andig commented Oct 9, 2023

Looks like there is a design issue with FormationViolation. It is used for creating error messages in ocppj.Endpoint. Instead of global variable it should be part of endpoint defintion.

@lorenzodonini
Copy link
Owner

I agree this should be an override within the endpoint instead of a global variable. I re-opened the issue and will move the discussion to the open branch.

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