New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 697559 link

Starred by 1 user

Issue metadata

Status: Verified
Owner:
Last visit > 30 days ago
Closed: Apr 2017
EstimatedDays: ----
NextAction: ----
OS: Linux
Pri: 3
Type: Bug



Sign in to add a comment

Crash when selecting text in headless mode using remote-debugging interface

Project Member Reported by zoeclifford@chromium.org, Mar 1 2017

Issue description

Chrome Version: Latest source (58.0.3027.0 (Developer Build) (64-bit))
OS: Ubuntu Linux

What steps will reproduce the problem?
(1) cr run chrome --headless --remote-debugging-port=9222 https://chromium.org
    (Must be in debug mode)
(2) Navigate normal chrome browser to localhost:9222 and click on the chromium.org link.
(3) Click some of the (non-link) text on the page.
(4) Press "CTRL+A" to attempt to select the text.

What is the expected result?
No crash. The text being selected would also be nice.

What happens instead?
Crash with check failure.

Relevant console output:
[0301/101320.619793:FATAL:x11_event_source.cc(124)] Check failed: instance_. 
#0 0x7faef971d89b base::debug::StackTrace::StackTrace()
#1 0x7faef971bf2c base::debug::StackTrace::StackTrace()
#2 0x7faef978a42f logging::LogMessage::~LogMessage()
#3 0x7faee502b8d0 ui::X11EventSource::GetInstance()
#4 0x7faef689c00d ui::SelectionOwner::TakeOwnershipOfSelection()
#5 0x7faef68b5476 ui::ClipboardAuraX11::AuraX11Details::TakeOwnershipOfSelection()
#6 0x7faef68b8dab ui::ClipboardAuraX11::WriteObjects()
#7 0x7faef6886a3f ui::ScopedClipboardWriter::~ScopedClipboardWriter()
#8 0x7faef352ee92 content::RenderWidgetHostViewAura::OnTextSelectionChanged()
#9 0x7faef354985e content::TextInputManager::SelectionChanged()
#10 0x7faef3537a03 content::RenderWidgetHostViewBase::SelectionChanged()
#11 0x7faef34fdb6f content::RenderWidgetHostImpl::SelectionChanged()
#12 0x7faef2f21aa1 content::RenderFrameHostImpl::OnSelectionChanged()
...

It seems like the ClipboardAuraX11 clipboard is used unconditionally on normal Linux builds [1][2]. ClipboardAuraX11 depends on X11EventSource::GetInstance(), but that requires instance_ to be set [3].

In normal non-headless mode instance_ is created through ui::PlatformEventSource::CreateDefault [4], however in Headless mode a dummy PlatformEventSource is created instead which prevents this from happening [5]

[1]
https://cs.chromium.org/chromium/src/ui/base/BUILD.gn?rcl=1509ada89abd69db5100a8ac6b3a193a85d5ac2f&l=616
[2]
https://cs.chromium.org/chromium/src/ui/base/clipboard/clipboard_aurax11.cc?rcl=64816da615023d3bb69a30562d7a27fa10da31c2&l=668
[3]
https://cs.chromium.org/chromium/src/ui/events/platform/x11/x11_event_source.cc?rcl=6ce977e6a10b71919e1aebfbd9fc41c9e2aa7443&l=124
[4]
https://cs.chromium.org/chromium/src/ui/aura/env.cc?rcl=54620e7a10bd00609a7c428a3f734ac121abcacb&l=194
[5]
https://cs.chromium.org/chromium/src/headless/lib/browser/headless_platform_event_source.h?rcl=54620e7a10bd00609a7c428a3f734ac121abcacb&l=13
 
The above crash is linux specific, but I'm not sure what would happen on mac or windows.

One possible solution would be to promote TestClipboard to an actual production clipboard and use that during headless mode on all platforms, I've done a quick and dirty test to verify that selecting text doesn't crash with this approach.

I will send an email to the clipboard people and ask if this is an OK approach.
Owner: zoeclifford@chromium.org
Status: Assigned (was: Available)
This shouldn't be an issue anymore, right?
Status: Verified (was: Assigned)

Sign in to add a comment