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

Race Condition #2

Closed
lkorth opened this issue Jan 20, 2017 · 4 comments
Closed

Race Condition #2

lkorth opened this issue Jan 20, 2017 · 4 comments

Comments

@lkorth
Copy link

lkorth commented Jan 20, 2017

In version 3.1 of the Kount Android SDK there is a race condition that results in data not being collected. If you call DataCollector#setContext right before (usually in the same event loop) calling DataCollector#collectForSession the failure callback is always called with DataCollector.Error.CONTEXT_NOT_SET the first time or whenever the DataCollector singleton is not in memory.

This is a result of the WebView being creating inside of a Handler on the main thread, DataCollector#collectForSession will execute before the WebView has been created and the check for the WebView will fail and result in the failure callback. Since responses are already communicated back via callbacks it would be nice to wrap the code and check inside of DataCollector#collectForSession inside of a Handler

new Handler(Looper.getMainLooper())).post(new Runnable() { 
    public void run() {
        ...
    }
});

or similarly alter the check to avoid this race condition.

Thanks!

@lkorth
Copy link
Author

lkorth commented Jan 23, 2017

I've added a commit in a branch in my fork of this repo that simply reproduces this issue.

lkorth added a commit to braintree/braintree_android that referenced this issue Jan 25, 2017
@gjd-keynetics
Copy link
Contributor

The Alternate Implementation described in this workaround seems to workand solves this issue for now. A more permanent solution is slated for the next release in late Q1/ beginning of Q2.

@seancc0
Copy link

seancc0 commented Jul 9, 2019

Fhttp://www.javadoc.io/doc/com.braintreepayments.api/braintreehttp://www.javadoc.io/doc/com.braintreepahttp://www.javadoc.io/doc/com.braintreepayments.api/braintreeyments.api/braintree

@seancc0
Copy link

seancc0 commented Jul 9, 2019

Thttp://www.javadoc.io/doc/com.braintreepayments.api/braintree

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants