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

[Bug]: Race condition possibility with setLocaleIdentifier #198

Open
3 of 4 tasks
lukehutch opened this issue Feb 2, 2024 · 3 comments
Open
3 of 4 tasks

[Bug]: Race condition possibility with setLocaleIdentifier #198

lukehutch opened this issue Feb 2, 2024 · 3 comments
Assignees
Labels
P2 Important issues not at the top of the work list. platform: android Issue is related to the Android platform. refactor Issues marked with refactor should be considered when refactoring the plugin.

Comments

@lukehutch
Copy link

lukehutch commented Feb 2, 2024

Please check the following before submitting a new issue.

Please select affected platform(s)

  • Android
  • iOS

Steps to reproduce

In a recent version of flutter-geocoding, instead of passing the locale identifier as part of the request (e.g. placemarkFromCoordinates(lat, long, localeIdentifier), now the user has to first call setLocaleIdentifier(localeIdentifier), and then call placemarkFromCoordinates(lat, long).

This is problematic if (like in my app) the locale identifier is switching frequently, and there may be more than one reverse geocoding call at a given time (basically I need to be able to reverse geocode into several locales at the same time). There is a race condition, whereby two different threads could interfere with each other's geocoding call.

I know this is an unusual usecase, but the chance for race condition is real, and this is not a good API change.

Expected results

Locale should always be passed in the call (as it is in the currently-released version).

Actual results

Locale is passed in a separate initial step, in the git latest version.

Code sample

N/A

Screenshots or video

N/A

Version

N/A

Flutter Doctor output

N/A

@mvanbeusekom mvanbeusekom added platform: android Issue is related to the Android platform. P2 Important issues not at the top of the work list. refactor Issues marked with refactor should be considered when refactoring the plugin. labels Feb 19, 2024
@mvanbeusekom
Copy link
Member

Hi @lukehutch,

Thank you for reporting this issue. We completely agree with your reasoning, however this means we need to do a large refactor of the plugin to manage multiple instances over the different platforms (we need to keep the Dart instances in sync with the matching instances on the native platform).

There is a solution for this and we are planning to apply it. However it will take some time. I will keep this ticket open to track the progress.

@mvanbeusekom mvanbeusekom self-assigned this Feb 19, 2024
@lukehutch
Copy link
Author

Hi, I just upgraded to geocoding 3.0.0, and this is still an issue with this new major-version release. Just wanted to ping you to see if there is any progress on the horizon! Thanks :-)

@winneze1
Copy link

winneze1 commented Nov 1, 2024

This a big issue. I tried to setLocaleIdentifier but it not working?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
P2 Important issues not at the top of the work list. platform: android Issue is related to the Android platform. refactor Issues marked with refactor should be considered when refactoring the plugin.
Projects
None yet
Development

No branches or pull requests

3 participants