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

Avoid a possible deadlock in main_fetch's synchronous code. #13388

Merged
merged 1 commit into from Sep 24, 2016
Merged
Changes from all commits
Commits
File filter...
Filter file types
Jump to…
Jump to file
Failed to load files.

Always

Just for now

Avoid a possible deadlock in main_fetch's synchronous code.

On playpen, similar code caused a deadlock on 1.11 stable, and worked fine
on nightly 1.13; it seems safer to avoid the pattern entirely.
  • Loading branch information
Ms2ger committed Sep 23, 2016
commit ccfd977076ca09aa89de236a55071938a562176b
@@ -312,15 +312,18 @@ fn main_fetch(request: Rc<Request>, cache: &mut CORSCache, cors_flag: bool,
Data::Done => break,
}
}
} else if let ResponseBody::Done(ref vec) = *response.body.lock().unwrap() {
// in case there was no channel to wait for, the body was
// obtained synchronously via basic_fetch for data/file/about/etc
// We should still send the body across as a chunk
if let Some(ref mut target) = *target {
target.process_response_chunk(vec.clone());
}
} else {
assert!(*response.body.lock().unwrap() == ResponseBody::Empty)
let body = response.body.lock().unwrap();
if let ResponseBody::Done(ref vec) = *body {
// in case there was no channel to wait for, the body was
// obtained synchronously via basic_fetch for data/file/about/etc
// We should still send the body across as a chunk
if let Some(ref mut target) = *target {
target.process_response_chunk(vec.clone());
}
} else {
assert!(*body == ResponseBody::Empty)
}
}

// overloaded similarly to process_response
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.