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

Concurrent issue on String() function #61

Closed
youngSSS opened this issue Jul 24, 2023 · 1 comment · Fixed by #62
Closed

Concurrent issue on String() function #61

youngSSS opened this issue Jul 24, 2023 · 1 comment · Fixed by #62

Comments

@youngSSS
Copy link

youngSSS commented Jul 24, 2023

When calling String() concurrently, it goes to panic.
Is it possible to use sync.Map to avoid panic?

func (sm *StateMachine) stateRepresentation(state State) (sr *stateRepresentation) {
	var ok bool
	if sr, ok = sm.stateConfig[state]; !ok {
		sr = newstateRepresentation(state)
		sm.stateConfig[state] = sr // concurrent panic point
	}
	return
}
@qmuntal
Copy link
Owner

qmuntal commented Jul 24, 2023

Thanks for reporting, will fix soon.

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

Successfully merging a pull request may close this issue.

2 participants