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

Potential concurrency issue in DateTimeParsers.swift #101

Open
ClementCardonnel opened this issue Jun 13, 2023 · 1 comment
Open

Potential concurrency issue in DateTimeParsers.swift #101

ClementCardonnel opened this issue Jun 13, 2023 · 1 comment
Labels
enhancement New feature or request

Comments

@ClementCardonnel
Copy link

Hi!

I've recently encountered a crash in DateTimeParsers.swift.

My crash occurred on line 81:

Self.calendarCache[0] = calendar

Which references this static variable:

private static var calendarCache = [Int : Calendar]()

I was parsing multiple GPX files inside Swift.Tasks. I believe this crash is concurrency driven where multiple threads attempted to access the same static variable.

Could thread safety be improved by using for example an Actor? Or should I consider CoreGPX not thread safe and try to always parse my GPX files sequentially?

Thanks in advance

@vincentneo
Copy link
Owner

Could thread safety be improved by using for example an Actor?

Maybe it would, but it's probably safest to treat CoreGPX in its current form as not thread safe.

@vincentneo vincentneo added the enhancement New feature or request label Jun 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants