software-jessies-org / jessies

Terminator, Evergreen, lwm and friends
GNU General Public License v2.0
84 stars 19 forks source link

Copy-Paste hangs terminator OL8 #51

Open kaushalruparel opened 2 years ago

kaushalruparel commented 2 years ago

On OL8 copy-paste hangs terminator. Below is the debug messages for it. I am not sure what all information is required, so please let me know and I will provide it.

2022-03-30T11:11:07.475+0000 Terminator: Java 1.8.0_321 (VM 25.321-b07, runtime 1.8.0_321-b07) 2022-03-30T11:11:07.476+0000 Terminator: Linux 5.4.17-2102.203.6.el8uek.x86_64/amd64 x4 2022-03-30T11:11:07.476+0000 Terminator: Package 29.44.7468 2022-03-30T11:11:07.476+0000 Terminator: Revision 7468 (7468) 2022-03-30T11:11:07.476+0000 Terminator: Built 2022-02-20T09:22:53-08:00 2022-03-30T11:11:07.476+0000 Terminator: Created PtyProcess[pid=1898198,fd=46,pty="/dev/pts/2"] and logging to (not logging) 2022-03-30T11:11:07.733+0000 Terminator: echo localhost:46773 > /home/kdrupare/.terminator/terminator-server-port_1 2022-03-30T11:11:16.598+0000 Terminator: (hang #1) event dispatch thread stuck processing event for 1.07s so far: sun.misc.Unsafe.park(Native Method) java.util.concurrent.locks.LockSupport.parkNanos(LockSupport.java:215) java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:2163) sun.awt.SunToolkit.awtLockWait(SunToolkit.java:277) sun.awt.X11.XSelection.waitForSelectionNotify(XSelection.java:179) sun.awt.X11.XSelection.getData(XSelection.java:294) sun.awt.X11.XClipboard.getClipboardData(XClipboard.java:122) sun.awt.datatransfer.ClipboardTransferable.fetchOneFlavor(ClipboardTransferable.java:117) sun.awt.datatransfer.ClipboardTransferable.(ClipboardTransferable.java:97) sun.awt.X11.XClipboard.getContents(XClipboard.java:108) terminator.view.TerminalView.pasteClipboard(TerminalView.java:275) terminator.view.TerminalView.pasteSystemClipboard(TerminalView.java:247) terminator.view.JTerminalPane.doPasteAction(JTerminalPane.java:694) terminator.TerminatorMenuBar$PasteAction.performPaneAction(TerminatorMenuBar.java:444) terminator.TerminatorMenuBar$AbstractPaneAction.actionPerformed(TerminatorMenuBar.java:211) terminator.TerminatorMenuBar$PasteAction.actionPerformed(TerminatorMenuBar.java:435) javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:2022) javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2348) javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:402) javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:259) javax.swing.AbstractButton.doClick(AbstractButton.java:376) javax.swing.AbstractButton.doClick(AbstractButton.java:356) javax.swing.plaf.basic.BasicMenuItemUI$Actions.actionPerformed(BasicMenuItemUI.java:851) javax.swing.SwingUtilities.notifyAction(SwingUtilities.java:1668) javax.swing.JComponent.processKeyBinding(JComponent.java:2882) javax.swing.JMenuBar.processBindingForKeyStrokeRecursive(JMenuBar.java:699) javax.swing.JMenuBar.processBindingForKeyStrokeRecursive(JMenuBar.java:706) javax.swing.JMenuBar.processBindingForKeyStrokeRecursive(JMenuBar.java:706) javax.swing.JMenuBar.processKeyBinding(JMenuBar.java:677) e.gui.EMenuBar.processKeyBinding(EMenuBar.java:49) javax.swing.KeyboardManager.fireBinding(KeyboardManager.java:307) javax.swing.KeyboardManager.fireKeyboardAction(KeyboardManager.java:293) javax.swing.JComponent.processKeyBindingsForAllComponents(JComponent.java:2974) javax.swing.JComponent.processKeyBindings(JComponent.java:2966) javax.swing.JComponent.processKeyEvent(JComponent.java:2845) java.awt.Component.processEvent(Component.java:6316) java.awt.Container.processEvent(Container.java:2239) java.awt.Component.dispatchEventImpl(Component.java:4889) java.awt.Container.dispatchEventImpl(Container.java:2297) java.awt.Component.dispatchEvent(Component.java:4711) java.awt.KeyboardFocusManager.redispatchEvent(KeyboardFocusManager.java:1954) java.awt.DefaultKeyboardFocusManager.dispatchKeyEvent(DefaultKeyboardFocusManager.java:835) java.awt.DefaultKeyboardFocusManager.preDispatchKeyEvent(DefaultKeyboardFocusManager.java:1103) java.awt.DefaultKeyboardFocusManager.typeAheadAssertions(DefaultKeyboardFocusManager.java:974) java.awt.DefaultKeyboardFocusManager.dispatchEvent(DefaultKeyboardFocusManager.java:800) java.awt.Component.dispatchEventImpl(Component.java:4760) java.awt.Container.dispatchEventImpl(Container.java:2297) java.awt.Window.dispatchEventImpl(Window.java:2746) java.awt.Component.dispatchEvent(Component.java:4711) java.awt.EventQueue.dispatchEventImpl(EventQueue.java:760) java.awt.EventQueue.access$500(EventQueue.java:97) java.awt.EventQueue$3.run(EventQueue.java:709) java.awt.EventQueue$3.run(EventQueue.java:703) java.security.AccessController.doPrivileged(Native Method) java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:74) java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:84) java.awt.EventQueue$4.run(EventQueue.java:733) java.awt.EventQueue$4.run(EventQueue.java:731) java.security.AccessController.doPrivileged(Native Method) java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:74) java.awt.EventQueue.dispatchEvent(EventQueue.java:730) e.debug.EventDispatchThreadHangMonitor.dispatchEvent(EventDispatchThreadHangMonitor.java:193) java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:205) java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116) java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105) java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101) java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93) java.awt.EventDispatchThread.run(EventDispatchThread.java:82) 2022-03-30T11:11:25.643+0000 Terminator: Couldn't paste. Associated exception: java.io.IOException: Owner timed out at sun.awt.X11.XSelection.validateDataGetter(XSelection.java:448) at sun.awt.X11.XSelection.getData(XSelection.java:304) at sun.awt.X11.XClipboard.getClipboardData(XClipboard.java:122) at sun.awt.datatransfer.ClipboardTransferable.fetchOneFlavor(ClipboardTransferable.java:117) at sun.awt.datatransfer.ClipboardTransferable.(ClipboardTransferable.java:97) at sun.awt.X11.XClipboard.getContents(XClipboard.java:108) at terminator.view.TerminalView.pasteClipboard(TerminalView.java:275) at terminator.view.TerminalView.pasteSystemClipboard(TerminalView.java:247) at terminator.view.JTerminalPane.doPasteAction(JTerminalPane.java:694) at terminator.TerminatorMenuBar$PasteAction.performPaneAction(TerminatorMenuBar.java:444) at terminator.TerminatorMenuBar$AbstractPaneAction.actionPerformed(TerminatorMenuBar.java:211) at terminator.TerminatorMenuBar$PasteAction.actionPerformed(TerminatorMenuBar.java:435) at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:2022) at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2348) at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:402) at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:259) at javax.swing.AbstractButton.doClick(AbstractButton.java:376) at javax.swing.AbstractButton.doClick(AbstractButton.java:356) at javax.swing.plaf.basic.BasicMenuItemUI$Actions.actionPerformed(BasicMenuItemUI.java:851) at javax.swing.SwingUtilities.notifyAction(SwingUtilities.java:1668) at javax.swing.JComponent.processKeyBinding(JComponent.java:2882) at javax.swing.JMenuBar.processBindingForKeyStrokeRecursive(JMenuBar.java:699) at javax.swing.JMenuBar.processBindingForKeyStrokeRecursive(JMenuBar.java:706) at javax.swing.JMenuBar.processBindingForKeyStrokeRecursive(JMenuBar.java:706) at javax.swing.JMenuBar.processKeyBinding(JMenuBar.java:677) at e.gui.EMenuBar.processKeyBinding(EMenuBar.java:49) at javax.swing.KeyboardManager.fireBinding(KeyboardManager.java:307) at javax.swing.KeyboardManager.fireKeyboardAction(KeyboardManager.java:293) at javax.swing.JComponent.processKeyBindingsForAllComponents(JComponent.java:2974) at javax.swing.JComponent.processKeyBindings(JComponent.java:2966) at javax.swing.JComponent.processKeyEvent(JComponent.java:2845) at java.awt.Component.processEvent(Component.java:6316) at java.awt.Container.processEvent(Container.java:2239) at java.awt.Component.dispatchEventImpl(Component.java:4889) at java.awt.Container.dispatchEventImpl(Container.java:2297) at java.awt.Component.dispatchEvent(Component.java:4711) at java.awt.KeyboardFocusManager.redispatchEvent(KeyboardFocusManager.java:1954) at java.awt.DefaultKeyboardFocusManager.dispatchKeyEvent(DefaultKeyboardFocusManager.java:835) at java.awt.DefaultKeyboardFocusManager.preDispatchKeyEvent(DefaultKeyboardFocusManager.java:1103) at java.awt.DefaultKeyboardFocusManager.typeAheadAssertions(DefaultKeyboardFocusManager.java:974) at java.awt.DefaultKeyboardFocusManager.dispatchEvent(DefaultKeyboardFocusManager.java:800) at java.awt.Component.dispatchEventImpl(Component.java:4760) at java.awt.Container.dispatchEventImpl(Container.java:2297) at java.awt.Window.dispatchEventImpl(Window.java:2746) at java.awt.Component.dispatchEvent(Component.java:4711) at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:760) at java.awt.EventQueue.access$500(EventQueue.java:97) at java.awt.EventQueue$3.run(EventQueue.java:709) at java.awt.EventQueue$3.run(EventQueue.java:703) at java.security.AccessController.doPrivileged(Native Method) at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:74) at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:84) at java.awt.EventQueue$4.run(EventQueue.java:733) at java.awt.EventQueue$4.run(EventQueue.java:731) at java.security.AccessController.doPrivileged(Native Method) at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:74) at java.awt.EventQueue.dispatchEvent(EventQueue.java:730) at e.debug.EventDispatchThreadHangMonitor.dispatchEvent(EventDispatchThreadHangMonitor.java:193) at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:205) at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116) at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105) at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101) at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93) at java.awt.EventDispatchThread.run(EventDispatchThread.java:82) 2022-03-30T11:11:25.645+0000 Terminator: (hang #1) event dispatch thread unstuck after 10.12s.

kaushalruparel commented 2 years ago

This only happens if copy-paste is done from terminator itself. Copy from terminator and pasting elsewhere and copy from elsewhere and pasting in terminator is working fine.

martindorey commented 2 years ago

12 days without any response, sorry, that's unusually poor.

A quick Google query reinforces my suspicion, from "el8", that "OL8" is Oracle's warmed-over RHEL 8, so mainstream, reasonably current Linux. Java 8 but a new build thereof. I failed to reproduce the problem on a new build of Terminator with Java 8u252-b09-1~deb9u1 on Debian Buster. Debian offers a packaging of 8u312 but it wants to upgrade libc6 to Debian Bullseye and I'm not currently willing to let it do that. OK, https://adoptium.net/download gives me an 8u322 that runs out of the box on Debian Buster, giving me:

mad@shuttle:~$ PATH=$(pwd)/jdk8u322-b06-jre/bin:$PATH DEBUGGING_TERMINATOR=y ~/jessies/work/terminator/bin/terminator 2022-04-10T17:52:38.724-0700 Terminator: Java 1.8.0_322 (VM 25.322-b06, runtime 1.8.0_322-b06) 2022-04-10T17:52:38.724-0700 Terminator: Linux 5.10.0-9-amd64/amd64 x8 2022-04-10T17:52:38.724-0700 Terminator: Package 29.44.7468 2022-04-10T17:52:38.724-0700 Terminator: Revision 7468 (7468) 2022-04-10T17:52:38.724-0700 Terminator: Built 2022-04-10T17:52:18-07:00

Middle button paste from Terminator into the same terminal or a different one worked just fine.

Sounds a bit like https://bugs.openjdk.java.net/browse/JDK-7201163 (10 second hang in clipboard API on Linux under certain circumstances), though the "Owner timed out" symptom isn't mentioned and that seems likely important. Shame the original attachment isn't there.

kaushalruparel commented 2 years ago

This one also is very similar : https://bugs.openjdk.java.net/browse/JDK-6340263 Not sure whether there is any w/a though. This issue is stopping me to use terminator as my default terminal for my OL8 instance. BTW if it helps in anyway, I am doing all of this over VNC

kaushalruparel commented 2 years ago

I did some more test after posting the comment above.

  1. The hang occurs only when following sequence is followed. Also only when copy & paste are both from & to terminator Select a piece of text -> press terminator paste shortcut (Alt + V).
  2. Does not happen in below cases (ie. everything is smooth and buttery :) ) Select a piece of text -> press terminator copy shortcut (Alt + C) -> press terminator paste shortcut (Alt + V) Select a piece of text -> press global paste shortcut (Shift + Ins)
martindorey commented 2 years ago

Select a piece of text -> press terminator paste shortcut (Alt + V).

That's pasting whatever was in the clipboard, not what was selected in Terminator. Point 2 says that whatever was in the clipboard wasn't put there by Terminator, because that works, so what, I wonder, is supplying the clipboard in the problem case, 1?

kaushalruparel commented 2 years ago

Some clarification: Select a piece of text from terminator and pasting anywhere else (say in vim with Shift + Ins) puts what was selected in terminator into it. So selection in terminator is copying stuff to clipboard. The same thing stands for windows terminator with cygwin. For eg: Command not found <<< This is pasted here from terminator by just selecting the text over VNC.

Regarding supplying clipboard for point 1, I do not know how to do that. If there is any command for getting that, I would be glad to provide that. Thanks

martindorey commented 2 years ago

So selection in terminator is copying stuff to clipboard

I'm afraid it's not quite that simple. X11 has two commonly used things that behave similarly to eg Windows's clipboard. The four lines from https://github.com/astrand/xclip/blob/master/README#L100 explain. When you select text in Terminator, it becomes available as XA_PRIMARY. It's only if you do Alt + C that we change XA_CLIPBOARD.

Hmm, your mentions of VNC. I bet that's going to be relevant somehow, because it's going to be trying to synchronize the clipboard or the selection or both with your client. I wonder what the VNC server and client programs are. When I've looked into such problems before, yon xclip program has been useful, in particular this sort of invocation:

mad@shuttle:~/jessies/work$ xclip -o -target TARGETS -selection CLIPBOARD
UTF8_STRING
TEXT
STRING
text/plain;charset=UTF-16
text/plain;charset=UTF-8
text/plain;charset=UTF-16BE
text/plain;charset=UTF-16LE
text/plain;charset=ISO-8859-1
text/plain;charset=US-ASCII
text/plain
text/plain;charset=unicode
mad@shuttle:~/jessies/work$ xclip -o -target TARGETS -selection PRIMARY
TIMESTAMP
TARGETS
SAVE_TARGETS
MULTIPLE
STRING
UTF8_STRING
TEXT
text/plain
text/plain;charset=utf-8
mad@shuttle:~/jessies/work$ 

The clipboard there was set by Terminator, where the selection was set by Chrome. I didn't have any remote desktop involved. I wonder what program had set the clipboard in scenario 1.

kaushalruparel commented 2 years ago

Sorry for late followup. Here is the output from xclip:

Output after I select some text in terminator (Case 1)

bash-4.4$ xclip -o -target TARGETS -selection PRIMARY
UTF8_STRING
TEXT
STRING
text/plain;charset=UTF-16
text/plain;charset=UTF-8
text/plain;charset=UTF-16BE
text/plain;charset=UTF-16LE
text/plain;charset=ISO-8859-1
text/plain;charset=US-ASCII
text/plain

bash-4.4$ xclip -o -target TARGETS -selection CLIPBOARD
TARGETS
TIMESTAMP
STRING
TEXT
UTF8_STRING

Below is after I press Alt + C (Case 2)

bash-4.4$ xclip -o -target TARGETS -selection PRIMARY
UTF8_STRING
TEXT
STRING
text/plain;charset=UTF-16
text/plain;charset=UTF-8
text/plain;charset=UTF-16BE
text/plain;charset=UTF-16LE
text/plain;charset=ISO-8859-1
text/plain;charset=US-ASCII
text/plain
bash-4.4$ xclip -o -target TARGETS -selection CLIPBOARD
UTF8_STRING
TEXT
STRING
text/plain;charset=UTF-16
text/plain;charset=UTF-8
text/plain;charset=UTF-16BE
text/plain;charset=UTF-16LE
text/plain;charset=ISO-8859-1
text/plain;charset=US-ASCII
text/plain
text/plain;charset=unicode
martindorey commented 2 years ago

That shows that the clipboard - the thing that Terminator will paste with Alt + V - doesn’t look like it was set by Terminator if you don’t do Alt + C, just as I’d expect. So what did own it and why wouldn’t it give its content to Terminator without timing out? Will it give its content, say its UTF8_STRING, to xclip? https://www.uninformativ.de/blog/postings/2017-04-02/0/POSTING-en.html has some code for working out which window opens the clipboard.

kaushalruparel commented 2 years ago

When I select something in terminator and then do xowners (small C program from https://www.uninformativ.de/blog/postings/2017-04-02/0/POSTING-en.html) I get below

bash-4.4$ ./xowners

Owner of 'PRIMARY': 0x240000F
Owner of 'SECONDARY': 0x0
Owner of 'CLIPBOARD': 0x52F
Owner of 'FOOBAR': 0x0

bash-4.4$ xwininfo -id 0x52F

xwininfo: Window id: 0x52f (has no name)

  Absolute upper-left X:  0
  Absolute upper-left Y:  0
  Relative upper-left X:  0
  Relative upper-left Y:  0
  Width: 100
  Height: 100
  Depth: 0
  Visual: 0x21
  Visual Class: TrueColor
  Border width: 0
  Class: InputOnly
  Colormap: 0x0 (not installed)
  Bit Gravity State: ForgetGravity
  Window Gravity State: NorthWestGravity
  Backing Store State: NotUseful
  Save Under State: no
  Map State: IsUnMapped
  Override Redirect State: no
  Corners:  +0+0  -1180+0  -1180-557  +0-557
  -geometry 100x100+0+0

bash-4.4$ xwininfo -id 0x240000F

xwininfo: Window id: 0x240000f "Terminator"

  Absolute upper-left X:  1
  Absolute upper-left Y:  1
  Relative upper-left X:  1
  Relative upper-left Y:  1
  Width: 1
  Height: 1
  Depth: 0
  Visual: 0x21
  Visual Class: TrueColor
  Border width: 0
  Class: InputOnly
  Colormap: 0x0 (not installed)
  Bit Gravity State: ForgetGravity
  Window Gravity State: NorthWestGravity
  Backing Store State: NotUseful
  Save Under State: no
  Map State: IsUnMapped
  Override Redirect State: no
  Corners:  +1+1  -1278+1  -1278-655  +1-655
  -geometry 1x1+1+1

I can send the UTF8_STRING of Primary (Primary is the one which is set on selection) to xclip successfully.