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

WSL2 cb copy + host Windows regular paste = destination hang #94

Closed
lukasz-mitka opened this issue Feb 20, 2023 · 4 comments
Closed

WSL2 cb copy + host Windows regular paste = destination hang #94

lukasz-mitka opened this issue Feb 20, 2023 · 4 comments
Labels
bug Something isn't working

Comments

@lukasz-mitka
Copy link

lukasz-mitka commented Feb 20, 2023

Describe the bug
When pasting the content copied by cb outside of WSL2 the receiving app crashes hangs

To Reproduce

  1. Use WSL2
  2. Install cb with brew (not sure if has anything to do with it)
  3. copy echo test | cb
  4. paste on host OS (e.g. VSCode, Chrome)
  5. Observe the destination hang

Expected behavior
Shouldn't hang app outside of WSL

Screenshots
N/A

Additional context
N/A

@lukasz-mitka lukasz-mitka added the bug Something isn't working label Feb 20, 2023
@Slackadays
Copy link
Owner

I just did some testing and although I wasn't able to get anything to crash, Firefox did hang completely. I installed WSL2/Brew/Clipboard and tried your setup. At first, copying the text seemed to work. But I had a very similar issue to Firefox/Chrome when using Clipboard again to see that copied text. It just seemed to hang and do nothing. However, what did work though is accessing the text through the virt-manager Windows VM that I'm doing all of this in. This didn't make much sense, so I compiled Clipboard manually. This time, copying text worked as before, but now I was able to see it by using Clipboard again. This was a Debug build so I had all the logs available. It turns out what's happening is when Clipboard copies something, the X11 daemon immediately provides some content to what I think is wslg https://github.com/microsoft/wslg which then goes to the Windows clipboard. However, some issue prevented the Brew version from providing more data. The compiled version did work here though, but only for Clipboard itself. Firefox still wouldn't work and Notepad just wouldn't see anything. Then I tried using the Windows version of Clipboard. After invoking it and showing the WSL2 content, pasting into Firefox and Notepad somehow started working. Clipboard now served up all the X11 requests that wslg needed.

So, the moral of the story here is that there is some funky issue that's fixed in the latest commit, but that issue only involves getting the content using Clipboard. The Chrome/VSCode/Firefox issue seems to be fixable by using Clipboard on Windows once, but otherwise it looks to be a WSL2 bug.

@Slackadays
Copy link
Owner

@lukasz-mitka So from here, it looks like you might want to make an issue in https://github.com/microsoft/WSL to see if it's a WSL2 problem because there are a few similar issues there that have to do with the clipboard.

@lukasz-mitka lukasz-mitka changed the title WSL2 cb copy + host Windows regular paste = destination crash WSL2 cb copy + host Windows regular paste = destination hang Feb 22, 2023
@lukasz-mitka
Copy link
Author

@Slackadays
wow. Thanks for quick and thorough investigation!

I stand corrected, it only hangs, no crash.

It's too much for me to comprehend to create viable issue in https://github.com/microsoft/WSL so I'm not going to do that. I'm leaving it up to you if you're interested. Sorry.

One more thing. I think I've seen brew installing wayland together with clipboard, maybe that has something to do with it.

@Slackadays
Copy link
Owner

Slackadays commented Feb 22, 2023

@lukasz-mitka I just tried this again, and I can't seem to make Clipboard cause this behavior. I was going to try xclip and see if it does the same thing, but now that the issue fixed itself at least on my end, I can only guess what happened there. However, it may have been a simple shutdown/startup/reboot that fixed it as I did all the initial testing in one session, so see if this fixes things on your end as well.

Does xclip have the same behavior for you? See if you can try out the latest Clipboard commit (Brew might have updated it for you already) because it may be fixed there for you.

Otherwise, I can close this issue as even with the behavior, it looks to be WSL's fault for not coping with X11 messages which isn't something Clipboard can fix. However, we can reopen this if there's more info on the underlying issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants