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

AsyncStorage.getItem blocks when debugging remotely #12830

Closed
bartolkaruza opened this issue Mar 9, 2017 · 92 comments
Closed

AsyncStorage.getItem blocks when debugging remotely #12830

bartolkaruza opened this issue Mar 9, 2017 · 92 comments
Labels
Bug Help Wanted :octocat: Issues ideal for external contributors. Resolution: Locked This issue was locked by the bot.

Comments

@bartolkaruza
Copy link

bartolkaruza commented Mar 9, 2017

Description

In some situations when calling AsyncStorage.getItem, either with a callback, calling then or using async await, the proceeding callback is not called and the promise does not resolve. This only happens when the remote debugger is on.

result or error are not called below:

AsyncStorage.getItem('key')
      .then(result => console.log('result', result))
      .catch(e => console.log('err', e));

AFTER is not printed (and no error is thrown):

console.log('BEFORE');
const result = await AsyncStorage.getItem('key');
console.log('AFTER');

The same code above completes the first time (and several consecutive times) it is run in the same debug session but blocks at a later stage. The point in time where it starts blocking is consistent in my app, so there is a piece of context that I haven't found yet which is causing it. I will continue searching for this context. Are maybe others running into similar behavior?

No matter the availability of data, getItem should always resolve (or reject), right?

Reproduction

I will keep trying to isolate the reproduction but so far I have not been able to cleanly reproduce, but in my full app, it is consistently occurring.

Solution

Additional Information

This issue is occurring on both iOS devices and simulators. I haven't seen it on Android yet.
OS X 10.11.6
Xcode 8.2.1
React Native Debugger 0.5.6
React Native 0.42.0

  "dependencies": {
    "react": "15.4.2",
    "react-native": "0.42.0",
    "analytics-react-native": "^1.0.1",
    "axios": "^0.11.1",
    "bugsnag-react-native": "^2.0.2",
    "firebase": "^3.6.10",
    "moment": "2.17.1",
    "react-native-auth0": "^1.0.0-beta.1",
    "react-native-code-push": "^1.17.2-beta",
    "react-native-drawer": "^2.2.3",
    "react-native-gifted-chat": "https://github.com/immidi/react-native-gifted-chat",
    "react-native-loading-spinner-overlay": "^0.4.1s",
    "react-native-lock": "git+ssh://git@github.com/auth0/react-native-lock.git",
    "react-native-navbar-wrapper": "^1.0.0",
    "react-native-onesignal": "^3.0.2",
    "react-native-smart-badge": "1.1.1",
    "react-navigation": "1.0.0-beta.3",
    "react-redux": "^4.4.5",
    "redux": "^3.5.2",
    "redux-devtools-extension": "^2.13.0"
  },
  "devDependencies": {
    "babel-jest": "19.0.0",
    "babel-preset-react-native": "1.9.1",
    "jest": "19.0.2",
    "react-test-renderer": "15.4.2",
    "remote-redux-devtools": "^0.5.7",
    "chai": "*",
    "chai-as-promised": "*",
    "colors": "*",
    "mocha": "*",
    "q": "*",
    "underscore": "*",
    "wd": "*",
    "eslint": "^3.1.1",
    "eslint-plugin-react": "^5.2.2",
    "eslint-plugin-react-native": "^1.1.0",
    "babel-eslint": "^6.1.2"
  }
@hramos
Copy link
Contributor

hramos commented May 25, 2017

We're cutting down on the number of outstanding issues, in order to allow us to focus. I'm closing this issue because it has been open for over 60 days with no activity. If you think it should still be opened let us know why. PRs are always welcome.

@hramos hramos closed this as completed May 25, 2017
@hramos hramos added the Icebox label May 26, 2017
@youhan26
Copy link

youhan26 commented Aug 8, 2017

any update? see the same problem

@bartolkaruza
Copy link
Author

@youhan26 This issue has stopped for me. Not sure what the reason is, but have you tried upgrading react native to the latest version?

@youhan26
Copy link

youhan26 commented Aug 8, 2017

@bartolkaruza I try to use real phone to test, It's ok. maybe just because of simulator

@davidblurton
Copy link

Still broken on react native 0.46.4 on a real device.

@davidblurton
Copy link

@hramos please reopen. AsyncStorage is a key component of react native and it's currently unusable when debugging.

@manishoo
Copy link

I'm experiencing the same issue. RN 48, Genymotion running android 7

@iamanam
Copy link

iamanam commented Nov 23, 2017

i am having the same issue. Anyone had any solution?
Edit: It worked on real device. So seems like problem is in genymotion

@gosuperninja
Copy link

This is happening for me fairly consistently with RN 0.50.3. I can refresh my app a couple times with the multiGet promise completing, but after that the promise no longer completes. Issuing a react-native run-android will allow the multiget to return. This is happening with an Android Emulator API version 26.

@Ble3k
Copy link

Ble3k commented Dec 14, 2017

Same issue.

I think this problem should be payed attention.

@krean93
Copy link

krean93 commented Dec 14, 2017

I have the same problem
Tested:
Android virtual machine (genymotion)
Android real machine

`console.log('beforereadtoken')
try {
let token = await AsyncStorage.getItem('fb_token');
} catch(e) {
console.log('there was an error');
console.log(e);
}

console.log('afterreadtoken')`

The second console.log does not get printed, also no errors are printed

@zengadget
Copy link

zengadget commented Dec 18, 2017

I have same problem on Android. Statements after 'await' are never executed. My 'workaround' for now is to kill and relaunch the app, then it starts working for some time. (react-native 0.51.0)

@yalopov
Copy link

yalopov commented Dec 26, 2017

Same problem here using node v8.8.1, npm v5.6, RN v0.50.4 and debugging using chrome 62.

I'm using a real device by the way

@afrakhan123
Copy link

Hi this was happening to me until I ran "react-native run-android" again. I seem to need to do this everytime I import AsyncStorage to a new file.

@luhui
Copy link

luhui commented Jan 10, 2018

Same issue on Android with real device, after reload the device. When it happened, I must kill the app and relaunch.

Can we re-open this issue? @bartolkaruza

RN v0.51.0

@bartolkaruza
Copy link
Author

@hramos There seems to be regular activity on this issue on very recent versions, even though I have not experienced it myself recently. Could you re-open it?

@hramos hramos reopened this Jan 12, 2018
@fatfatson
Copy link

+1 Same issue on Android, have to restarting app

@nenti
Copy link

nenti commented Jan 24, 2018

This issue is also a regular problem that occurs on redux-persist project. (rt2zz/redux-persist#603 (comment))

@DarkSmile92
Copy link

Having the same issue out of the blue from one day to another without changing anything on my react-native project!

@acherkashin
Copy link

+1 Same issue on Android 6, API Level 23. I resolve this issue by rerun 'react-native run-android'.

@amclelland
Copy link

+1

@rohitranjan1991
Copy link

+1. Any update on this ? This is a issue worth looking into. cannot go ahead with this for production apps.

@AustinHunt
Copy link

I've been able to confirm that this is as a result of some kind of blocking in Android when debugging with an emulator.

@AustinHunt
Copy link

A fix would definitely be nice.

@nmfzone
Copy link

nmfzone commented Mar 2, 2018

It's still happening, even in recent react native version. It's very annoying, why this issue not prioritize to solve?

Btw it's happening even the debugging is not active. And it's happen in emulator and real devices. 👎

@Joey33
Copy link

Joey33 commented Mar 3, 2018

If it would help you:

I discovered this issue only now after starting to use VSC debugger or RNDebugger. I've always debugged in Chrome before and never ever experienced any AsyncStorage failures. So I tried now a few times in Chrome (opening&closing remote debugging session from app) and in Chrome it's fine.

What else have I observed:

  1. When you start debugging session in VSC/RND and never exit dbg mode, it's fine (though slow of course)
  2. When you exit remote dbg and AsyncStorage gets screwed up, when you do 'react'native run-android' again the issue is gone

@jean-ben-guigui
Copy link

+1bitmoji

@nstanwar
Copy link

+1

1 similar comment
@patriciy
Copy link

+1

@mtkhorma
Copy link

mtkhorma commented May 1, 2018

as far as i know we cant use local storage in RN, so if we can't debug our apps when using Asyncstorage, what on earth we can do to store some data locally on the device?

@papayuca
Copy link

papayuca commented May 4, 2018

+1

3 similar comments
@trexguo
Copy link

trexguo commented May 5, 2018

+1

@miedziak
Copy link

miedziak commented May 6, 2018

+1

@RiyadWu
Copy link

RiyadWu commented May 8, 2018

+1

@johniak
Copy link

johniak commented May 8, 2018

+1 :(

@norbertsongin
Copy link

+1

5 similar comments
@dgarciamuria
Copy link

+1

@gosuperninja
Copy link

+1

@teraconsulting
Copy link

+1

@ianbarnett8
Copy link

+1

@LordShiroe
Copy link

+1

@iamanam
Copy link

iamanam commented May 11, 2018

This issue is opened for more than year but still nothing. That's really sad. Someone really need to look at it.

@cmwendwa
Copy link

+1

3 similar comments
@SurajMDurgad
Copy link

+1

@nicolascoutureau
Copy link

+1

@brunneus
Copy link

+1

@facebook facebook locked as too heated and limited conversation to collaborators May 16, 2018
@hramos
Copy link
Contributor

hramos commented May 16, 2018

Locking due to +1 spam. Issue's still open in case any one wants to volunteer a fix.

@cpojer
Copy link
Contributor

cpojer commented Feb 15, 2019

This issue has been moved to react-native-async-storage/async-storage#11.

@cpojer cpojer closed this as completed Feb 15, 2019
@react-native-bot react-native-bot added the Resolution: Locked This issue was locked by the bot. label Feb 15, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Bug Help Wanted :octocat: Issues ideal for external contributors. Resolution: Locked This issue was locked by the bot.
Projects
None yet
Development

No branches or pull requests