New issue
Advanced search Search tips

Issue 726200 link

Starred by 4 users

Issue metadata

Status: Fixed
Owner:
Closed: Sep 2017
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Mac
Pri: 1
Type: Bug-Regression

Blocking:
issue 640466
issue 602914



Sign in to add a comment

Running a menu from an app-modal dialog hangs Chrome when observing private run loop modes

Project Member Reported by a...@chromium.org, May 25 2017

Issue description

Chrome Version: 60.0.3109.0 (Official Build) canary (64-bit)
OS: 10.11.6 (15G1421)

What steps will reproduce the problem?
(1) File > Print...
(2) Click the "Print using system dialog..." link
(3) In the resulting native print dialog click the [PDF ▼] button and select "Save as PDF..."

What is the expected result?
The browser doesn't hang.

What happens instead?
The browser hangs.

 
Sample of Google Chrome.txt
145 KB View Download

Comment 1 by a...@chromium.org, May 25 2017

Symbolized.
sym.txt
167 KB View Download

Comment 2 by a...@chromium.org, May 25 2017

This is a recent regression; 60.0.30xx didn't have this hang.

Comment 3 by a...@chromium.org, May 25 2017

You are probably looking for a change made after 470766 (known good), but no later than 470771 (first known bad).
CHANGELOG URL:
  https://chromium.googlesource.com/chromium/src/+log/4ae97f1e5eba0fcd23ad35a23100cace5e8e8660..f548f57a4ec26eabaec6e466ee668aa29834b6c2

Comment 4 by a...@chromium.org, May 25 2017

Cc: thestig@chromium.org
Owner: tapted@chromium.org
Trent, in the bisect your CL stood out.

https://codereview.chromium.org/2852233002

Probably yours.

Comment 5 by a...@chromium.org, May 25 2017

FYI M60 cuts tomorrow; you might need to revert this before the deadline.

Comment 6 by tapted@chromium.org, May 25 2017

There's some stuff on top of it. I'll prep a disable CL.

Comment 7 by tapted@chromium.org, May 25 2017

Status: Started (was: Assigned)
https://codereview.chromium.org/2898953006/

Comment 8 by tapted@chromium.org, May 25 2017

Blocking: 640466

Comment 9 by tapted@chromium.org, May 25 2017

Labels: ReleaseBlock-Beta M-60
Cc: mark@chromium.org sdy@chromium.org rsesek@chromium.org
Summary: Running a menu from an app-modal dialog hangs Chrome when observing private run loop modes (was: Generating PDF from native print dialog hangs Chrome)
(need a base OWNER for https://codereview.chromium.org/2898953006/ ..)

Looking into the problem.. it's weird. It looks as though the popup menu's runloop simply doesn't exit. This is the one run at SelectItemAndRestoreAllMenuBits() in HIToolbox, so there's only assembly code to debug. Dismissing the menu without selecting anything will also hang.

I don't know why the one on the print dialog is special. Chrome's NPPopupButtonCell menus on Cocoa dialogs behave. The difference may be that this nested menu runloop is being run under a modal run loop:

   2420 -[NSPrintPanel runModalWithPrintInfo:]  (in AppKit) + 498  [0x7fff98846e55]
     2420 -[NSApplication runModalForWindow:]  (in AppKit) + 156  [0x7fff98450375]
       2420 __35-[NSApplication runModalForWindow:]_block_invoke  (in AppKit) + 126  [0x7fff986336fb]
         2420 -[NSApplication _doModalLoop:peek:]  (in AppKit) + 751  [0x7fff98452ae4]


Aand pulling that thread I've found another repro:
 - Trigger an NSAlert (e.g. chrome://apps/ right-click -> Remove from Chrome..)
 - right-click some text in the title to show a menu
 - click outside the menu to dismiss 

So yah, something about modal dialogs. Possibly we can override -[NSApplication runModalForWindow:] with a scoped class that temporarily disables spying on private runloop modes.

Or maybe there's some kind of "I'm nested" flag in MessagePumpMac that's triggering an odd flow, and we can unwedge this by running the show-modal-dialog loop outside of it (assuming that's a thing..).
Project Member

Comment 11 by bugdroid1@chromium.org, May 25 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/08c4e3028cf0a15630a07874da6eec8694682ce4

commit 08c4e3028cf0a15630a07874da6eec8694682ce4
Author: tapted <tapted@chromium.org>
Date: Thu May 25 10:43:53 2017

Mac: Disable r470769. I.e., Don't pump chrome tasks in private message loop modes.

It interacts badly with NSMenus on the native print dialog.

To fix, we may need to use a scoping class that adds these modes only
for menus that Chrome runs. Defer that to m61.

BUG= 726200 ,  602914 , 640466
TEST=Click the "Print using system dialog..." link in Print Preview,
then select "Save as PDF" via the [PDF] button in the native print
dialog. Chrome shouldn't hang.

Review-Url: https://codereview.chromium.org/2898953006
Cr-Commit-Position: refs/heads/master@{#474621}

[modify] https://crrev.com/08c4e3028cf0a15630a07874da6eec8694682ce4/base/message_loop/message_pump_mac.mm

Components: UI>Browser
Labels: -ReleaseBlock-Beta -M-60 M-61
#c11 (r474621) is in m60 (r474934) so removing release block and setting target milestone.
Blocking: 602914
Project Member

Comment 14 by bugdroid1@chromium.org, Sep 20 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/24ab401b3662d052facf19a169f553ea9a6bf7e1

commit 24ab401b3662d052facf19a169f553ea9a6bf7e1
Author: Trent Apted <tapted@chromium.org>
Date: Wed Sep 20 11:34:22 2017

Re-enable listening on private runloop modes, for a whitelist.

r470769 started observing private AppKit run loop modes to keep
UI and web pages responsive while menus were fading out, but it
interacted badly with app-modal dialogs.

This re-enables r470769, but only in 3 places:
 - Web page context menus
 - Web page <select> menus
 - menus run from toolkit-views UI.

      pause briefly when either the <select> menu or the right-
      click context menu are fading out. (The main menubar and the
      Chrome app/wrench menu still cause a brief pause when dismissed).

Bug:  726200 ,  602914 , 640466, 652007
Test: https://jsfiddle.net/kvmy8q9d/5/ - the animation shouldn't
Change-Id: Idf769c1f830ccb3ddc67205acb9e86aac2ec0460
Reviewed-on: https://chromium-review.googlesource.com/647836
Reviewed-by: Mark Mentovai <mark@chromium.org>
Reviewed-by: Avi Drissman <avi@chromium.org>
Commit-Queue: Trent Apted <tapted@chromium.org>
Cr-Commit-Position: refs/heads/master@{#503112}
[modify] https://crrev.com/24ab401b3662d052facf19a169f553ea9a6bf7e1/base/message_loop/message_pump_mac.h
[modify] https://crrev.com/24ab401b3662d052facf19a169f553ea9a6bf7e1/base/message_loop/message_pump_mac.mm
[modify] https://crrev.com/24ab401b3662d052facf19a169f553ea9a6bf7e1/base/message_loop/message_pump_mac_unittest.cc
[modify] https://crrev.com/24ab401b3662d052facf19a169f553ea9a6bf7e1/chrome/browser/ui/cocoa/renderer_context_menu/render_view_context_menu_mac.mm
[modify] https://crrev.com/24ab401b3662d052facf19a169f553ea9a6bf7e1/content/browser/renderer_host/webmenurunner_mac.mm
[modify] https://crrev.com/24ab401b3662d052facf19a169f553ea9a6bf7e1/ui/views/controls/menu/menu_runner_impl_cocoa.mm

Status: Fixed (was: Started)
This shouldn't come back, and hopefully we can expand it to more use-cases. E.g. the mainMenu -- https://jsfiddle.net/kvmy8q9d/5/ doesn't stutter in Safari when toying with the main menu (it does, however, freeze when any modal dialog like Print is shown though). Issue 640466 and it's blockers exist for follow-up.

Sign in to add a comment