question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Race condition in 0.10.x

See original GitHub issue

I’ve just upgraded to 0.10.4 and also tried this in 0.10.0.

I’m now finding that take has become a little deaf during page load.

I have the following Saga that work fine in 0.9.5, that I’ve added some logging to.

export function* loadSearchResultsSaga(action) {
  console.log('Put SEARCH_RESULTS_REQUESTED');

  yield put(searchResultsActions.loadSearchResults(action));

  console.log('Take SEARCH_RESULTS_SUCCESS');

  yield take([
    searchResultsTypes.SEARCH_RESULTS_SUCCESS,
    searchResultsTypes.SEARCH_RESULTS_FAILURE,
  ]);

  console.log('Put LOADING FINNISH');

  yield put(appStateActions.loadingFinish());
}

However in 0.10.x it gets stuck at the take.

To dig into this a bit further I’ve added the following Saga to log out all the redux actions.

function* log() {
    yield* takeEvery('*', function* (action) {
      console.log('Action:', action.type);
    });
  }

This leads to the following output in the console.

searchResultsSagas.js:118 Action: SET_SEARCH_RESULTS_TRACKING_FLAG
searchResultsSagas.js:28  Put SEARCH_RESULTS_REQUESTED
searchResultsSagas.js:118 Action: SEARCH_RESULTS_REQUEST
searchResultsSagas.js:118 Action: LOCATION_UPDATED
searchResultsSagas.js:118 Action: HASH_UPDATED
client.js:55              [HMR] connected
searchResultsSagas.js:118 Action: SEARCH_RESULTS_SUCCESS
searchResultsSagas.js:35  Take SEARCH_RESULTS_SUCCESS

So it would seem that the Redux action is firing before the take has an opportunity to run. I’m guessing this is caused by a delay in the response to yield put on the previous line.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:11 (4 by maintainers)

github_iconTop GitHub Comments

0reactions
SpainTraincommented, Jun 9, 2016

nit: this would have perhaps been better behind a minor version bump given that this breaks code that relies on the 0.10.0-0.10.4 behavior

Read more comments on GitHub >

github_iconTop Results From Across the Web

What is a Race Condition? - TechTarget
A race condition is an undesirable situation that occurs when a device or system attempts to perform two or more operations at the...
Read more >
Study of Race Condition: A Privilege Escalation Vulnerability
The Race condition is a privilege escalation vulnerability that manipulates the time between imposing a security control and.
Read more >
Study of Race Condition: A Privilege Escalation Vulnerability
A race condition occurs in a shared memory program when two threads access the same variable using shared memory data, and at least...
Read more >
[Bug 683842] New: Fix race condition in videomixer2 on 0.10
x Summary: Fix race condition in videomixer2 on 0.10 Classification: Platform Product: GStreamer Version: 0.10.x OS/Version: Linux Status: UNCONFIRMED Severity: ...
Read more >
Race condition in ActionController::Serialization ... - GitHub
Race condition in ... joaomdmoura added V: 0.10.x C: Good for New Contributors labels on Jun 25, 2015. @joaomdmoura joaomdmoura added this to...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found