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 races in sonet #1

Closed
yulin2 opened this Issue Feb 13, 2014 · 2 comments

Comments

Projects
None yet
2 participants
@yulin2

yulin2 commented Feb 13, 2014

Dear developers of sonnet project,

I'm a Ph.D. student and I'm doing a research on checking data races for Android apps. I found a potential race in sonet/core/src/com/piusvelte/sonet/core/OAuthLogin.java:

at line 25, "mSonetOAuth.getAuthUrl()" is invoked in an AsyncTask;
at line 545, "mSonetOAuth.retrieveAccessToken()" is invoked in another AsyncTask.

If these two lines of code can be executed in parallel, there will be a data race on "mOAuthProvider" field of "SonetOAuth" class:
line 56 in SonetOAuth.java writes to "mOAuthProvider", while line 63 uses it. This may cause NullPointerException.

Do you think this two AsyncTasks may happen in parallel, will this data race lead to a potential bug? Do you need synchronization?

Thanks,
Yu

@piusvelte

This comment has been minimized.

Show comment
Hide comment
@piusvelte

piusvelte Feb 13, 2014

Owner

Thank you for your interest. The first AsyncTask is run to get the url for the webview, in which the second AsyncTask is run when the callback url is loaded. Because of this dependency, the second cannot run until the first completes. Does this answer your question?

Owner

piusvelte commented Feb 13, 2014

Thank you for your interest. The first AsyncTask is run to get the url for the webview, in which the second AsyncTask is run when the callback url is loaded. Because of this dependency, the second cannot run until the first completes. Does this answer your question?

@yulin2

This comment has been minimized.

Show comment
Hide comment
@yulin2

yulin2 Feb 13, 2014

OK, I see your point. Thanks for the confirmation!

yulin2 commented Feb 13, 2014

OK, I see your point. Thanks for the confirmation!

@piusvelte piusvelte closed this Feb 13, 2014

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment