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

Improve implementation and add testing regarding file manager thread #11552

Merged
merged 1 commit into from Jun 10, 2016

Conversation

@izgzhen
Copy link
Contributor

izgzhen commented Jun 2, 2016

First there is a more completed unit test. And in the test running, I found a runtime error Serde(Custom("bincode does not support Deserializer::deserialize)) when reading response from file manage thread. I analyzed a bit and found that it is probably caused by the Uuid field. I temporarily work around it by making the Id essentially a string wrapped inside SelectedFileId.

Related to PR #11131.


  • ./mach build -d does not report any errors
  • ./mach test-tidy does not report any errors
  • There are tests for these changes

This change is Reviewable

@highfive
Copy link

highfive commented Jun 2, 2016

Heads up! This PR modifies the following files:

  • @KiChjang: components/net/filemanager_thread.rs, components/net_traits/filemanager_thread.rs, components/net_traits/filemanager_thread.rs, components/net_traits/lib.rs, components/net_traits/lib.rs, components/script/dom/bindings/trace.rs, components/net_traits/Cargo.toml, components/net_traits/Cargo.toml, components/script/dom/blob.rs
@bors-servo
Copy link
Contributor

bors-servo commented Jun 2, 2016

The latest upstream changes (presumably #11114) made this pull request unmergeable. Please resolve the merge conflicts.

@@ -27,7 +82,7 @@ fn test_filemanager() {
let _ = chan.send(FileManagerThreadMsg::SelectFile(tx));

match rx.try_recv() {

This comment has been minimized.

@emilio

emilio Jun 2, 2016

Member

nit: Probably simpler to just assert!(rx.try_recv().is_err(), "xxx")

This comment has been minimized.

@izgzhen

izgzhen Jun 3, 2016

Author Contributor

Cool, thanks

@izgzhen izgzhen force-pushed the izgzhen:add-testing-fix-filemanager branch from 977d445 to 2a53fdc Jun 3, 2016
@izgzhen
Copy link
Contributor Author

izgzhen commented Jun 3, 2016

r? @Manishearth

Not intended to bug you, just thinking it might be easier to track whatever decision I am making :P

@highfive highfive assigned Manishearth and unassigned glennw Jun 3, 2016
@izgzhen izgzhen force-pushed the izgzhen:add-testing-fix-filemanager branch 2 times, most recently from 4761a04 to 04b0703 Jun 3, 2016
@izgzhen
Copy link
Contributor Author

izgzhen commented Jun 8, 2016

@Manishearth I just updated this. You might want to have a look if you got time :)

@jdm jdm removed the S-needs-rebase label Jun 8, 2016
FileManagerThreadMsg::ReadFile(sender, id) => self.read_file(sender, id),
FileManagerThreadMsg::ReadFile(sender, id) => {
match self.try_read_file(id) {
Ok(buffer) => sender.send(Ok(buffer)).expect("FileManager send error"),

This comment has been minimized.

@Manishearth

Manishearth Jun 9, 2016

Member

Not expect, we should silently ignore the sending error.

send() fails if the receiver doesn't exist. This can happen if a content thread crashed, in this case. Content threads crashing should not bring down the chrome process.

(Basically, the chrome process should never crash unless it's an irrecoverable error for the entire browser)

@izgzhen izgzhen force-pushed the izgzhen:add-testing-fix-filemanager branch from 04b0703 to 4f22598 Jun 9, 2016
@highfive
Copy link

highfive commented Jun 9, 2016

New code was committed to pull request.

@izgzhen izgzhen force-pushed the izgzhen:add-testing-fix-filemanager branch from 4f22598 to 49b1243 Jun 9, 2016
@highfive
Copy link

highfive commented Jun 9, 2016

New code was committed to pull request.

FileManagerThreadMsg::ReadFile(sender, id) => self.read_file(sender, id),
FileManagerThreadMsg::ReadFile(sender, id) => {
match self.try_read_file(id) {
Ok(buffer) => sender.send(Ok(buffer)).unwrap(),

This comment has been minimized.

@Manishearth

Manishearth Jun 9, 2016

Member

Unwrap also panics. let _ = xyz.send();

Err(FileManagerThreadError::InvalidSelection) => {},
_ => assert!(false, "Should be an invalid selection before dialog is implemented"),
if let Ok(vec) = msg {
assert!(test_file_content == vec, "Read content differs");

This comment has been minimized.

@Manishearth

Manishearth Jun 9, 2016

Member

This can be condensed using expect, but not necessary

if let Ok(mut handler) = opened {
handler.read_to_end(&mut test_file_content)
.expect("Read tests/unit/net/test.txt error");
}

This comment has been minimized.

@Manishearth

Manishearth Jun 9, 2016

Member

We should just panic here via expect if opened is not OK, and get rid of the opened_ok checks later

This comment has been minimized.

@Manishearth

Manishearth Jun 9, 2016

Member

s/later/below

This comment has been minimized.

@izgzhen

izgzhen Jun 9, 2016

Author Contributor

Well, I made too loose an assumption before that the test.txt might not exist at all 😂

… in FileManagerThreadMsg
@izgzhen izgzhen force-pushed the izgzhen:add-testing-fix-filemanager branch from 49b1243 to f8fa9aa Jun 9, 2016
@highfive
Copy link

highfive commented Jun 9, 2016

New code was committed to pull request.


#[test]
fn test_filemanager() {
let chan: IpcSender<FileManagerThreadMsg> = FileManagerThreadFactory::new();

// Try to open a dummy file "tests/unit/net/test.txt" in tree
let mut handler = File::open("test.txt").expect("test.txt is stolen");

This comment has been minimized.

@izgzhen

izgzhen Jun 9, 2016

Author Contributor

@Manishearth Now it will panic if test.txt is missing

FileManagerThreadMsg::ReadFile(sender, id) => {
match self.try_read_file(id) {
Ok(buffer) => { let _ = sender.send(Ok(buffer)); }
Err(_) => { let _ = sender.send(Err(FileManagerThreadError::ReadFileError)); }

This comment has been minimized.

@izgzhen

izgzhen Jun 9, 2016

Author Contributor

@Manishearth Now send should not crash file manger thread

@Manishearth
Copy link
Member

Manishearth commented Jun 9, 2016

@bors-servo
Copy link
Contributor

bors-servo commented Jun 9, 2016

📌 Commit f8fa9aa has been approved by Manishearth

@bors-servo
Copy link
Contributor

bors-servo commented Jun 9, 2016

Testing commit f8fa9aa with merge 57c9dd8...

bors-servo added a commit that referenced this pull request Jun 9, 2016
…arth

Improve implementation and add testing regarding file manager thread

First there is a more completed unit test. And in the test running, I found a runtime error `Serde(Custom("bincode does not support Deserializer::deserialize))` when reading response from file manage thread. I analyzed a bit and found that it is probably caused by the `Uuid` field. I temporarily work around it by making the `Id` essentially a string wrapped inside `SelectedFileId`.

Related to PR #11131.

<!-- Please describe your changes on the following line: -->

---
<!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: -->
- [x] `./mach build -d` does not report any errors
- [x] `./mach test-tidy` does not report any errors

<!-- Either: -->
- [x] There are tests for these changes

<!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="35" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/11552)
<!-- Reviewable:end -->
@bors-servo
Copy link
Contributor

bors-servo commented Jun 9, 2016

💔 Test failed - mac-rel-wpt

@highfive
Copy link

highfive commented Jun 9, 2016

  ▶ CRASH [expected OK] /dom/nodes/Node-parentNode.html
  │ 
  │ ERROR:constellation::constellation: Panic: resize sent to nonexistent pipeline
  │ ERROR:constellation::constellation: Backtrace:
  │ frame #0  - 0x000000010ad95e7e - backtrace::backtrace::trace::hccde8df28b4db2a2
  │ frame #1  - 0x000000010ad95e01 - backtrace::capture::Backtrace::new::h42f95930bb8c5ee8
  │ frame #2  - 0x000000010a2d2dc6 - _&lt;F as alloc..boxed..FnBox&lt;A&gt;&gt;::call_box::h6bf1f1518fe13d1a
  │ frame #3  - 0x000000010ad7b6f7 - util::panicking::initiate_panic_hook::_$u7b$$u7b$closure$u7d$$u7d$::_$u7b$$u7b$closure$u7d$$u7d$::ha2bd86c312dc8d7a
  │ frame #4  - 0x000000010af8a5c4 - std::panicking::rust_panic_with_hook::h983af77c1a2e581b
  │ frame #5  - 0x0000000109c915e4 - std::panicking::begin_panic::h0bf39f6d43ab9349
  │ frame #6  - 0x000000010a332880 - script::script_thread::ScriptThread::handle_msgs::_$u7b$$u7b$closure$u7d$$u7d$::h41a556e2c2c94fe6
  │ frame #7  - 0x000000010a315372 - script::script_thread::ScriptThread::handle_msgs::h6a699373a020da16
  │ frame #8  - 0x000000010a2d1597 - std::panicking::try::call::hb8565a24f25031fc
  │ frame #9  - 0x000000010afa60db - __rust_try
  │ frame #10 - 0x000000010afa6075 - __rust_maybe_catch_panic
  │ frame #11 - 0x000000010a2d27f4 - _&lt;F as alloc..boxed..FnBox&lt;A&gt;&gt;::call_box::h78c73797281bb868
  │ frame #12 - 0x000000010afa1b58 - std::sys::thread::Thread::new::thread_start::h9c883b6d445ece46
  │ frame #13 - 0x00007fff9534f059 - _pthread_body
  │ frame #14 - 0x00007fff9534efd6 - _pthread_start
  │ 
  └ ERROR:constellation::constellation: Pipeline failed in hard-fail mode.  Crashing!
@jdm
Copy link
Member

jdm commented Jun 9, 2016

@bors-servo
Copy link
Contributor

bors-servo commented Jun 9, 2016

Previous build results for android, arm32, arm64, linux-dev, linux-rel, mac-dev-unit, mac-rel-css, windows are reusable. Rebuilding only mac-rel-wpt...

@bors-servo
Copy link
Contributor

bors-servo commented Jun 9, 2016

💔 Test failed - mac-rel-wpt

@highfive
Copy link

highfive commented Jun 9, 2016

  ▶ CRASH [expected OK] /dom/nodes/Node-parentNode.html
  │ 
  │ ERROR:constellation::constellation: Panic: resize sent to nonexistent pipeline
  │ ERROR:constellation::constellation: Backtrace:
  │ frame #0  - 0x00000001024c7dbe - backtrace::backtrace::trace::hccde8df28b4db2a2
  │ frame #1  - 0x00000001024c7d41 - backtrace::capture::Backtrace::new::h42f95930bb8c5ee8
  │ frame #2  - 0x0000000101a04d06 - _&lt;F as alloc..boxed..FnBox&lt;A&gt;&gt;::call_box::h6bf1f1518fe13d1a
  │ frame #3  - 0x00000001024ad637 - util::panicking::initiate_panic_hook::_$u7b$$u7b$closure$u7d$$u7d$::_$u7b$$u7b$closure$u7d$$u7d$::ha2bd86c312dc8d7a
  │ frame #4  - 0x00000001026bc504 - std::panicking::rust_panic_with_hook::h983af77c1a2e581b
  │ frame #5  - 0x00000001013c3524 - std::panicking::begin_panic::h0bf39f6d43ab9349
  │ frame #6  - 0x0000000101a647c0 - script::script_thread::ScriptThread::handle_msgs::_$u7b$$u7b$closure$u7d$$u7d$::h41a556e2c2c94fe6
  │ frame #7  - 0x0000000101a472b2 - script::script_thread::ScriptThread::handle_msgs::h6a699373a020da16
  │ frame #8  - 0x0000000101a034d7 - std::panicking::try::call::hb8565a24f25031fc
  │ frame #9  - 0x00000001026d801b - __rust_try
  │ frame #10 - 0x00000001026d7fb5 - __rust_maybe_catch_panic
  │ frame #11 - 0x0000000101a04734 - _&lt;F as alloc..boxed..FnBox&lt;A&gt;&gt;::call_box::h78c73797281bb868
  │ frame #12 - 0x00000001026d3a98 - std::sys::thread::Thread::new::thread_start::h9c883b6d445ece46
  │ frame #13 - 0x00007fff9534f059 - _pthread_body
  │ frame #14 - 0x00007fff9534efd6 - _pthread_start
  │ 
  └ ERROR:constellation::constellation: Pipeline failed in hard-fail mode.  Crashing!

  ▶ CRASH [expected OK] /html/semantics/embedded-content/the-iframe-element/change_parentage.html
  │ 
  │ ERROR:constellation::constellation: Panic: resize sent to nonexistent pipeline
  │ ERROR:constellation::constellation: Backtrace:
  │ frame #0  - 0x0000000107988dbe - backtrace::backtrace::trace::hccde8df28b4db2a2
  │ frame #1  - 0x0000000107988d41 - backtrace::capture::Backtrace::new::h42f95930bb8c5ee8
  │ frame #2  - 0x0000000106ec5d06 - _&lt;F as alloc..boxed..FnBox&lt;A&gt;&gt;::call_box::h6bf1f1518fe13d1a
  │ frame #3  - 0x000000010796e637 - util::panicking::initiate_panic_hook::_$u7b$$u7b$closure$u7d$$u7d$::_$u7b$$u7b$closure$u7d$$u7d$::ha2bd86c312dc8d7a
  │ frame #4  - 0x0000000107b7d504 - std::panicking::rust_panic_with_hook::h983af77c1a2e581b
  │ frame #5  - 0x0000000106884524 - std::panicking::begin_panic::h0bf39f6d43ab9349
  │ frame #6  - 0x0000000106f257c0 - script::script_thread::ScriptThread::handle_msgs::_$u7b$$u7b$closure$u7d$$u7d$::h41a556e2c2c94fe6
  │ frame #7  - 0x0000000106f082b2 - script::script_thread::ScriptThread::handle_msgs::h6a699373a020da16
  │ frame #8  - 0x0000000106ec44d7 - std::panicking::try::call::hb8565a24f25031fc
  │ frame #9  - 0x0000000107b9901b - __rust_try
  │ frame #10 - 0x0000000107b98fb5 - __rust_maybe_catch_panic
  │ frame #11 - 0x0000000106ec5734 - _&lt;F as alloc..boxed..FnBox&lt;A&gt;&gt;::call_box::h78c73797281bb868
  │ frame #12 - 0x0000000107b94a98 - std::sys::thread::Thread::new::thread_start::h9c883b6d445ece46
  │ frame #13 - 0x00007fff9534f059 - _pthread_body
  │ frame #14 - 0x00007fff9534efd6 - _pthread_start
  │ 
  └ ERROR:constellation::constellation: Pipeline failed in hard-fail mode.  Crashing!
@jdm
Copy link
Member

jdm commented Jun 9, 2016

bors-servo added a commit that referenced this pull request Jun 9, 2016
…arth

Improve implementation and add testing regarding file manager thread

First there is a more completed unit test. And in the test running, I found a runtime error `Serde(Custom("bincode does not support Deserializer::deserialize))` when reading response from file manage thread. I analyzed a bit and found that it is probably caused by the `Uuid` field. I temporarily work around it by making the `Id` essentially a string wrapped inside `SelectedFileId`.

Related to PR #11131.

<!-- Please describe your changes on the following line: -->

---
<!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: -->
- [x] `./mach build -d` does not report any errors
- [x] `./mach test-tidy` does not report any errors

<!-- Either: -->
- [x] There are tests for these changes

<!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="35" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/11552)
<!-- Reviewable:end -->
@bors-servo
Copy link
Contributor

bors-servo commented Jun 9, 2016

Testing commit f8fa9aa with merge 6f9016c...

@bors-servo
Copy link
Contributor

bors-servo commented Jun 10, 2016

@bors-servo bors-servo merged commit f8fa9aa into servo:master Jun 10, 2016
2 checks passed
2 checks passed
continuous-integration/travis-ci/pr The Travis CI build passed
Details
homu Test successful
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

7 participants
You can’t perform that action at this time.