Recently started seeing MASSIVE delays in promise operations

I just started seeing some very nasty side effects in the development my expo app.

Some of my promise operations are taking an exorbitantly long amount of time to resolve (over 1 minute - what normally was sub-second operations).

I have been developing this app for several months, and never experienced this until two days ago (9/12/2017).

  • I backed out my most current enhancements (to a previous stable version), but the problem still exists.

  • I am seeing this issue on every device I have tested with.

  • I upgraded my project to the latest expo, but the problem still exists
    Expo SDK: 20.0.0
    React Native: 0.47 July
    React: 16.0.0-alpha.12

  • One aspect of interest is I am using the firebase API, with it’s real-time notifications. This is emitting a well-known warning about a long timers issue (Add support for AlarmManager in Timing to allow proper handling of long timers · Issue #12981 · facebook/react-native · GitHub).

    I do not think this is related, but I thought I would mention it. I have been developing a long time with this warning and have never experienced this promise delay.

Any assistance on this issue would be greatly appreciated.

Thanks in advance.

Kevin

Hi Kevin! Sorry to hear about this problem. Can you provide some sample code for the operations that are running really slow? Ideally you’d be able to reproduce this behavior on https://snack.expo.io, but I understand if it’s specific to your local environment.

Hi @dikaiosune2m,

Thanks for your quick response.

I haven’t attempted to isolate anything into a small snippet (using snack).

My project is checked into github, so I can reference some code there (FYI: my upgrade to expo 20.0.0 is not yet checked into github, so don’t be alarmed about that).

I am using redux, in conjunction with redux-logic to isolate my business logic. This basically monitors redux actions injecting value-added logic hooks.

As an example, the src/logic/discovery.js module has a promise (lines 11-21) that is causing me problems. This promise has just started taking 2 mins to resolve (previously sub-second)

This api.discovery.searchEateries() is a fetch-based promise that is using GooglePlaces api - code found in src/api/discovery.js.

Not sure if this gives you anything to go on (it is a bit embedded in my overall architecture).

Of interest, however, is:

  • this just started happening to me (without any application-specific code changes)

Any thoughts?

Kevin

Also worth noting is that not all promises are seeing this delay. As an example, the nextPage logic snippet src/logic/discovery.js is basically doing the same thing, but without delay.

This, in conjunction with the fact that this just started happening (out of the blue), is an indication of some environmental issue, and not something in the code.

That is why I stopped and upgraded to the latest expo … high hopes, but alas no resolution :frowning:

Where is the code for api.discovery.searchEateries() defined? Is that calling out to a server you control? Or to someone else’s service?

I highlighted this in the previous reply … pasted here for you convenience:

The api.discovery.searchEateries() is a fetch-based promise that is using GooglePlaces api - code found in src/api/discovery.js.

@dikaiosune … wanted to give you an update on this issue.

Oddly, as of this morning this delay issue magically went away. This is very strange indeed, because:

  • There were absolutely no app-level code changes whatsoever

  • Same Expo XDE version

  • Same Expo client version (on my device)

  • My published version of the expo app now also runs correctly (previously it was experiencing the same delay problems)

  • My app now runs on devices I have tested, without delay (previously I was experiencing the same delay problems on all devices)

This may lead one to believe that the problem was in the network services that I am communicating with. However I do not think this is the case:

  • The likely hood that I experienced the same 2 min delay in two separate services (Firebase and GooglePlaces) would be extremely small.

  • This in conjunction with the fact that when the delay problem magically went away, that both services were resolved simultaneously. This tends to indicate something other than network issues.

  • Also during the 3 day period I experienced the delay within my expo app, I repeatedly ran the exact same network code in an isolated node-based sandbox test, and never saw any delays.

I really have nothing definitive to go on here. I did do some debugging, but didn’t dig any deeper than when the fetch-based promise was resolved, so I couldn’t tell if was a network or promise delay.

In the back of my mind I am thinking if the problem were stimulated by the well known “long timer” android issue (from the firebase real-time notifications), that I could have experienced a delay in the resolution of the promise (rather than an actual network delay).

Even though my app is now running, I’m obviously still concerned with what caused this unexplained anomaly. My obvious fear is: will it rear it’s ugly head again?

Not sure if you have any additional insight, but I do appreciate your time. I will (obviously) keep my eyes on this if it occurs again.

BTW: Thanks for all your hard work on expo. This product is absolutely amazing!

1 Like