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

Removed sources of panic from ports/glutin. #10910

Merged
merged 1 commit into from May 20, 2016

Conversation

@asajeffrey
Copy link
Member

asajeffrey commented Apr 28, 2016

Fixes #10547.


This change is Reviewable

None => {
warn!("Window event stream closed.");
return false;
},

This comment has been minimized.

Copy link
@samlh

samlh Apr 28, 2016

Contributor

Return true? #10547 implies that this can happen when the window is closing.

This comment has been minimized.

Copy link
@asajeffrey

asajeffrey Apr 28, 2016

Author Member

I wasn't sure about what to do here, most likely the window is already closing, and I'm not sure what'll happen if we try to close it twice? Is it idempotent?

@KiChjang
Copy link
Member

KiChjang commented Apr 29, 2016

I can't make a call on what to do about the returned value here. r? @pcwalton

@highfive highfive assigned pcwalton and unassigned KiChjang Apr 29, 2016
@bors-servo
Copy link
Contributor

bors-servo commented Apr 30, 2016

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

@asajeffrey asajeffrey force-pushed the asajeffrey:remove-unwrap-from-glutin-app branch from 2d81522 to 234c9f7 Apr 30, 2016
@asajeffrey asajeffrey force-pushed the asajeffrey:remove-unwrap-from-glutin-app branch from 234c9f7 to 135c6db May 9, 2016
@bors-servo
Copy link
Contributor

bors-servo commented May 10, 2016

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

@asajeffrey asajeffrey force-pushed the asajeffrey:remove-unwrap-from-glutin-app branch from 135c6db to 74b466f May 10, 2016
@asajeffrey
Copy link
Member Author

asajeffrey commented May 10, 2016

Rebased.

@asajeffrey asajeffrey force-pushed the asajeffrey:remove-unwrap-from-glutin-app branch from 74b466f to caab457 May 12, 2016
@asajeffrey
Copy link
Member Author

asajeffrey commented May 12, 2016

Rebased and bumped log to 0.3.6.

@jdm jdm removed the S-needs-rebase label May 12, 2016
@bors-servo
Copy link
Contributor

bors-servo commented May 19, 2016

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

@asajeffrey asajeffrey force-pushed the asajeffrey:remove-unwrap-from-glutin-app branch from caab457 to 55f1cf4 May 19, 2016
@asajeffrey
Copy link
Member Author

asajeffrey commented May 19, 2016

Rebased.

I had a think about what the return value should be from handle_next_event if the event queue returns None. In this case, we must be in shutdown already, so sending a Quit event will most likely confuse the other threads, since this is the second quit event. So I think returning false is the thing to do here.

@samlh
Copy link
Contributor

samlh commented May 19, 2016

Not that I have any authority, but this looks good to me :).

@asajeffrey asajeffrey force-pushed the asajeffrey:remove-unwrap-from-glutin-app branch from 55f1cf4 to 37511cc May 20, 2016
@highfive
Copy link

highfive commented May 20, 2016

New code was committed to pull request.

@asajeffrey
Copy link
Member Author

asajeffrey commented May 20, 2016

Rebased.

@aneeshusa
Copy link
Member

aneeshusa commented May 20, 2016

@bors-servo
Copy link
Contributor

bors-servo commented May 20, 2016

📌 Commit 37511cc has been approved by aneeshusa

@bors-servo
Copy link
Contributor

bors-servo commented May 20, 2016

Testing commit 37511cc with merge 5f34522...

bors-servo added a commit that referenced this pull request May 20, 2016
…eeshusa

Removed sources of panic from ports/glutin.

Fixes #10547.

<!-- 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/10910)
<!-- Reviewable:end -->
@bors-servo
Copy link
Contributor

bors-servo commented May 20, 2016

@bors-servo bors-servo merged commit 37511cc into servo:master May 20, 2016
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
@metajack
Copy link
Contributor

metajack commented May 20, 2016

Hmm. I have a fix for this as well, but on the glutin side. See rust-windowing/glutin#777. The difference is that the change to glutin will prevent wait_events() from returning None.

What happens that once glutin gets a WM_DESTROY event (to close the window) it shuts down its event loops which causes recv() to panic, but the iterator discards the error and just returns None.

This patch is fine though as it doesn't coflict; it may cease to be necessary in the near future.

@asajeffrey
Copy link
Member Author

asajeffrey commented May 20, 2016

We probably want to remove sources of panic from ports/glutin anway, since it's one of our single points of failure, a panic in ports/glutin brings down the whole browser. I'm quite happy about having a belt-and-braces approach here.

@metajack
Copy link
Contributor

metajack commented May 20, 2016

The issue here is that by returning immediately, you now have a very hot loop. This whole loop was written with the assumption that it would block here, and now that it's gone as soon as WM_DESTROY comes in, we probably spike to 100% CPU until shutdown.

@asajeffrey
Copy link
Member Author

asajeffrey commented May 20, 2016

@metajack ah, the problem is that there's nothing handle_next_event can do to indicate that event processing should finish at this point? It can return a boolean, but that just controls whether a quit event is sent. We could park the thread, but that's pretty nasty.

@metajack
Copy link
Contributor

metajack commented May 20, 2016

Event processing isn't finished, though. We're waiting for shutdown to fully propagate. In my patch wait_events() blocks until the WAKEUP message arrives, and then we'll pull the FinishedShuttingDown message out of the other event queue. Maybe we can block on that event queue if we're in shutdown?

The main issue here is we have two event queues and Rust has nothing like select().

@asajeffrey
Copy link
Member Author

asajeffrey commented May 20, 2016

Moving the conversation about hot-spinning at shutdown to #11307.

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

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