Bug 56799 - Unstable Google Places API calls (exceptions)
Summary: Unstable Google Places API calls (exceptions)
Status: RESOLVED FIXED
Alias: None
Product: Components
Classification: Xamarin
Component: Xamarin Components ()
Version: Production (addons.xamarin.com)
Hardware: PC Windows
: --- normal
Target Milestone: ---
Assignee: Bill Holmes
URL:
Depends on:
Blocks:
 
Reported: 2017-05-24 12:25 UTC by Philipp Sumi
Modified: 2017-05-25 10:20 UTC (History)
3 users (show)

Tags:
Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:
Status:
RESOLVED FIXED

Description Philipp Sumi 2017-05-24 12:25:29 UTC
I'm getting pretty nondescript errors when using the iOS library for the Google Places API. Sometimes it works, sometimes it doesn't.

My code is pretty trivial - I'm basically just relying on the PlacesClient:

        public async Task<List<ILocationSearchResult>> SearchPlacesAsync(string searchText)
        {
            PositionDto position = await DeviceLocation.ResolveLocationAsync(5);

            if (position == null)
            {
                //use zero in lack of any data...
                position = new PositionDto();
            }

            var nw = new CLLocationCoordinate2D(position.Latitude - 0.08, position.Longitude - 0.08);
            var se = new CLLocationCoordinate2D(position.Latitude + 0.08, position.Longitude + 0.08);
            var bounds = new CoordinateBounds(nw, se);

            var pc = new PlacesClient();
            var tcs = new TaskCompletionSource<List<ILocationSearchResult>>();
            pc.AutocompleteQuery(searchText, bounds, new AutocompleteFilter(), (p, e) =>
            {
                try
                {
                    if (e != null)
                    {
                        SetException(tcs, e);
                        return;
                    }

                    var results = p.Select(pred => new LocationSearchResult
                    {
                        PlaceId = pred.PlaceID,
                        Name = pred.AttributedPrimaryText?.Value,
                        Details = pred.AttributedSecondaryText?.Value
                    });

                    tcs.SetResult(results.Cast<ILocationSearchResult>().ToList());
                }
                catch (Exception exception)
                {
                    tcs.SetException(exception);
                }
                finally
                {
                    pc.Dispose();
                }
            });

            return await tcs.Task;
        }


One thing I notice is that from the time of the call to the actual error, there's quite a time span. At the same time, map lookups (reverse geocoding) etc work just fine. Also, I really don't think Google would be offline / timing out half of the time.



System.Exception: NSError -3: The operation couldn’t be completed. An internal error occurred in the Places API library. If you believe this error represents a bug, please file a report using the instructions on our community and support page (https://developers.google.com/places/support). Reason: An internal error occurred in the Places API library. If you believe this error represents a bug, please file a report using the instructions on our community and support page (https://developers.google.com/places/support). Recovery:  
  at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in /Library/Frameworks/Xamarin.iOS.framework/Versions/10.10.0.33/src/mono/mcs/class/referencesource/mscorlib/system/runtime/exceptionservices/exceptionservicescommon.cs:151 
  at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x00037] in /Library/Frameworks/Xamarin.iOS.framework/Versions/10.10.0.33/src/mono/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:187 
  at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x00028] in /Library/Frameworks/Xamarin.iOS.framework/Versions/10.10.0.33/src/mono/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:156 
  at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x00008] in /Library/Frameworks/Xamarin.iOS.framework/Versions/10.10.0.33/src/mono/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:128 
  at System.Runtime.CompilerServices.TaskAwaiter`1[TResult].GetResult () [0x00000] in <14c6fb0feb8846a2942059f2fe60aa4c>:0 
  at Ridr.Client.iOS.Maps.PlaceSearchProvider+<SearchPlacesAsync>d__4.MoveNext () [0x001cd] in D:\Repositories\Commercial\ridr\src\Ridr.Client\Ridr.Client.iOS\Maps\PlaceSearchProvider.cs:78 
--- End of stack trace from previous location where exception was thrown ---
  at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in /Library/Frameworks/Xamarin.iOS.framework/Versions/10.10.0.33/src/mono/mcs/class/referencesource/mscorlib/system/runtime/exceptionservices/exceptionservicescommon.cs:151 
  at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x00037] in /Library/Frameworks/Xamarin.iOS.framework/Versions/10.10.0.33/src/mono/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:187 
  at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x00028] in /Library/Frameworks/Xamarin.iOS.framework/Versions/10.10.0.33/src/mono/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:156 
  at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x00008] in /Library/Frameworks/Xamarin.iOS.framework/Versions/10.10.0.33/src/mono/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:128 
  at System.Runtime.CompilerServices.TaskAwaiter`1[TResult].GetResult () [0x00000] in <14c6fb0feb8846a2942059f2fe60aa4c>:0 
  at Ridr.Client.ViewModels.AppViewModel+<InvokeApiAsync>d__60`1[T].MoveNext () [0x00123] in <79fdda0097c446acb4a0707821fddd24>:0
Comment 1 Philipp Sumi 2017-05-24 12:55:48 UTC
I roughly timed the exception, and it's always taking about the same time - about 11 seconds. Other apps using the places API (e.g. Uber) don't fail a single time, while the calls in my app fail nearly always. Yesterday was ok, today is horrible (but also not a 100% failure, so the keys are good).
Comment 2 Philipp Sumi 2017-05-24 19:44:06 UTC
It appears Google screwed up here:
https://issuetracker.google.com/issues/38492985

Right now, it seems to be working - fingers crossed.
If I don't post back here within 24 hours and forget to close, please ignore.
Comment 3 Jimmy [MSFT] 2017-05-24 23:09:52 UTC
Hey Philipp, thanks for the update. Moving this to the components team in the meantime.
Comment 4 Philipp Sumi 2017-05-25 10:20:17 UTC
Code has been running stable today as well - looks like Google fixed it :)