Bug 179367 - [GTK] Cannot cut'n'paste between webkit instances
Summary: [GTK] Cannot cut'n'paste between webkit instances
Status: NEW
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKitGTK (show other bugs)
Version: Other
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-11-07 01:42 PST by Bastien Nocera
Modified: 2017-11-09 07:51 PST (History)
4 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Bastien Nocera 2017-11-07 01:42:03 PST
A mail client as a webapp on one side, epiphany on the other.

Nov 07 10:29:09 classic epiphany[2769]: Error writing selection data: Error writing to file descriptor: Broken pipe
Nov 07 10:29:12 classic epiphany[8460]: gdkselection-wayland.c:266: error reading selection buffer: Operation was cancelled
Nov 07 10:29:40 classic epiphany[2769]: Error writing selection data: Error writing to file descriptor: Broken pipe
Nov 07 10:29:58 classic epiphany[8460]: gdkselection-wayland.c:266: error reading selection buffer: Operation was cancelled

When trying to paste a URL from epiphany's URL bar to the mail client, the mail client's UI hangs.

It's also causing other applications to fail to paste:
Nov 07 10:34:09 classic gnome-terminal-[2939]: gdkselection-wayland.c:266: error reading selection buffer: Operation was cancelled

The first bug is that the selection data cannot be written to, the 2nd one would be that the act of requesting the paste data looks like it's synchronous and hangs the main loop.

webkitgtk4-2.18.2-1.fc27.x86_64
epiphany-3.26.1-1.fc27.x86_64
Comment 2 Carlos Garnacho 2017-11-07 04:22:06 PST
(In reply to Bastien Nocera from comment #0)
> A mail client as a webapp on one side, epiphany on the other.
> 
> Nov 07 10:29:09 classic epiphany[2769]: Error writing selection data: Error
> writing to file descriptor: Broken pipe
> Nov 07 10:29:12 classic epiphany[8460]: gdkselection-wayland.c:266: error
> reading selection buffer: Operation was cancelled
> Nov 07 10:29:40 classic epiphany[2769]: Error writing selection data: Error
> writing to file descriptor: Broken pipe
> Nov 07 10:29:58 classic epiphany[8460]: gdkselection-wayland.c:266: error
> reading selection buffer: Operation was cancelled

Hmm, this is funky, these paths in gdk shouldn't be hit during intra-app c&p. I think this is a problem in gtk+/mutter.

> 
> When trying to paste a URL from epiphany's URL bar to the mail client, the
> mail client's UI hangs.

Checking Source/WebKit/WebProcess/WebCoreSupport/WebPlatformStrategies.cpp, it seems the readFromClipboard request is synchronous. This ideally would be made asynchronous, but gets less urgent if the first is fixed. I'll happily review patches though :).
Comment 3 Michael Catanzaro 2017-11-07 07:20:29 PST
(In reply to Carlos Garnacho from comment #2)
> Hmm, this is funky, these paths in gdk shouldn't be hit during intra-app
> c&p. I think this is a problem in gtk+/mutter.

It's really inter-app, because the Ephy web app and browser instance are actually separate processes.

> > When trying to paste a URL from epiphany's URL bar to the mail client, the
> > mail client's UI hangs.
> 
> Checking Source/WebKit/WebProcess/WebCoreSupport/WebPlatformStrategies.cpp,
> it seems the readFromClipboard request is synchronous. This ideally would be
> made asynchronous, but gets less urgent if the first is fixed. I'll happily
> review patches though :).

Fixing this would require modifying a bunch of macOS, iOS, and Windows code, and convincing Ryosuke to allow it. So it's not for the faint of heart.
Comment 4 Michael Catanzaro 2017-11-07 07:21:01 PST
FWIW I cannot reproduce... is the mail client GMail?
Comment 5 Bastien Nocera 2017-11-07 07:30:52 PST
(In reply to Michael Catanzaro from comment #4)
> FWIW I cannot reproduce... is the mail client GMail?

It's Zimbra, but I don't think that the problem is with the mail client. It started happening this morning in my main browser (I can't paste to anything from epiphany).

I can paste to it just fine though.

This is the error message that epiphany throws every time I try to copy something:
Nov 07 03:33:22 classic epiphany[2769]: Error writing selection data: Error writing to file descriptor: Broken pipe
Comment 6 Carlos Garnacho 2017-11-07 07:54:49 PST
(In reply to Michael Catanzaro from comment #3)
> (In reply to Carlos Garnacho from comment #2)
> > Hmm, this is funky, these paths in gdk shouldn't be hit during intra-app
> > c&p. I think this is a problem in gtk+/mutter.
> 
> It's really inter-app, because the Ephy web app and browser instance are
> actually separate processes.

Yeah, but AFAIR wayland is not involved at all, it's all just IPC between ui and web processes. To ephy it's just c&p between 2 widgets, and gtk+ has shortcuts that shouldn't hit windowing requests.
Comment 7 Michael Catanzaro 2017-11-07 10:29:50 PST
(In reply to Carlos Garnacho from comment #6) 
> Yeah, but AFAIR wayland is not involved at all, it's all just IPC between ui
> and web processes. To ephy it's just c&p between 2 widgets, and gtk+ has
> shortcuts that shouldn't hit windowing requests.

No, in Bastien's example it's actually two separate Epiphany processes. The flow is:

Web process #1 -> UI process #1 -> mutter -> UI process #2 -> web process #2

(Of course, that doesn't mean there's not a WebKit bug.)
Comment 8 Bastien Nocera 2017-11-08 01:15:45 PST
(In reply to Michael Catanzaro from comment #7)
> (In reply to Carlos Garnacho from comment #6) 
> > Yeah, but AFAIR wayland is not involved at all, it's all just IPC between ui
> > and web processes. To ephy it's just c&p between 2 widgets, and gtk+ has
> > shortcuts that shouldn't hit windowing requests.
> 
> No, in Bastien's example it's actually two separate Epiphany processes. The
> flow is:
> 
> Web process #1 -> UI process #1 -> mutter -> UI process #2 -> web process #2
> 
> (Of course, that doesn't mean there's not a WebKit bug.)

It also happens when copy/pasting from epiphany to a standard GTK+ app. So the shorter:
Web process #1 -> UI process #1 -> mutter -> UI process #2
Comment 9 Michael Catanzaro 2017-11-08 07:35:01 PST
Any chance you are able to reproduce the problem on a website that doesn't require a login?
Comment 10 Bastien Nocera 2017-11-09 07:51:35 PST
(In reply to Michael Catanzaro from comment #9)
> Any chance you are able to reproduce the problem on a website that doesn't
> require a login?

At the time, I reproduced the problem when copy/pasting from the epiphany URL bar (any site at all), to a terminal or polari.

I rebooted since then, and the problem doesn't happen any more, but my (wild) guess is that ephy takes too long to reply to the selection request, and the request times out.

I think that running some integration tests with no new fds available might be a good idea.