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

Error handling fixes #134

Merged
merged 4 commits into from Jan 30, 2017
Merged

Conversation

@antrik
Copy link
Contributor

antrik commented Jan 17, 2017

Some fixes and cleanups for "recursive I/O" and related error handling.

@emilio
Copy link
Member

emilio commented Jan 18, 2017

Looks great, some comments:

  • r=me on the first commit, I don't know how we could trigger that anyway.
  • r=me on the second commit, with s/serialisation/serialization in the commit message.
  • r=me on the third commit, with a question: Do we want to support slightly old rustc versions? Because if so we might want to stick to try! (not a big deal IMO, but worth thinking about).
  • And r=me on the last commit, with the same typo corrected, and a comment about why we don't handle the error immediately in the code so it doesn't slip through if someone refactors that in the future.

Thanks for doing this! :)

@emilio
emilio approved these changes Jan 18, 2017
antrik added 4 commits Jan 17, 2017
I believe the whole premise of this error was invalid in the first
place: as far as I can see, there is actually nothing wrong with using
IPC channels during serialisation or deserialisation of an IPC channel
message -- in fact we added a test case for this in
ca63fdb . So what this handling really
did (originally), was complaining -- and hiding the actual error message
-- when there was an I/O error while doing recursive IPC during
deserialisation; whereas otherwise recursive I/O worked just fine.

(Also, the `send()` part of the implementation was never correct: it
translated errors in the low-level send operation, where no recursion
can actually happen; while errors during serialisation just panic...)

Note that 1f1d092 indeed changed the
error handling to pass through the real I/O errors during
deserialisation, as it should. The `recursive_io_error()` would instead
now be triggered on a condition that can never actually come up, as far
as I can see...

Summing up, neither were we actually detecting recursive I/O, nor should
we.

As a nice side effect (in fact what made me look into this in the first
place), with this bogus handling gone, we now no longer use the never
stabilised (and now deprecated) `RefCell::borrow_state()`, and thus can
drop the local `RefCell` fork.
Just like deserialisation in `recv()`, serialisation during `send()` can
trigger I/O (or possibly other?) errors. Pass these on to the caller,
rather than throwing a `panic!`.
I'm pretty sure we should restore the thread
`OS_IPC_CHANNELS_FOR_DESERIALIZATION` and
`OS_IPC_SHARED_MEMORY_REGIONS_FOR_DESERIALIZATION` values to their
previous states also when deserialisation fails, not only when it
succeeds.
@antrik antrik force-pushed the antrik:fix-recursive-io-error-handling branch from 67a78f8 to a5b568b Jan 30, 2017
@antrik
Copy link
Contributor Author

antrik commented Jan 30, 2017

@emilio added a comment regarding the error handling.

I don't think there is any policy about only using features that have been stable for a long time. (This would actually prevent fixing warnings about no longer needed feature gates?) I believe we already use the syntax in various Servo repositories; and I'd be surprised if it's not already being used in various external dependencies as well...

Not changing the spelling of "serialisation", since it's not actually a mistake, as I mentioned on IRC :-)

@antrik
Copy link
Contributor Author

antrik commented Jan 30, 2017

@bors-servo r=emilio

@bors-servo
Copy link
Contributor

bors-servo commented Jan 30, 2017

📌 Commit a5b568b has been approved by emilio

@highfive highfive assigned emilio and unassigned pcwalton Jan 30, 2017
@bors-servo
Copy link
Contributor

bors-servo commented Jan 30, 2017

Testing commit a5b568b with merge 6e2ce12...

bors-servo added a commit that referenced this pull request Jan 30, 2017
Error handling fixes

Some fixes and cleanups for "recursive I/O" and related error handling.
@bors-servo
Copy link
Contributor

bors-servo commented Jan 30, 2017

☀️ Test successful - status-appveyor, status-travis

@bors-servo bors-servo merged commit a5b568b into servo:master Jan 30, 2017
3 checks passed
3 checks passed
continuous-integration/appveyor/pr AppVeyor build succeeded
Details
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

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