wayvnc icon indicating copy to clipboard operation
wayvnc copied to clipboard

Cannot reconnect to wayvnc

Open drigoskalwalker opened this issue 1 year ago • 9 comments

I have wayvnc server in my Linux machine.

The first time I connect it works fine. The second the view close.

I'm using UltraVNC Viewer and TigerVNC Viewer on my Windows11 The RealVNC Viewer works, and reconnects normally

But I think it's a problem with wayvnc on reconnections.

drigoskalwalker avatar Sep 15 '24 21:09 drigoskalwalker

It helps if you follow the bug report template. This also needs a more thorough description of how to reproduce the problem.

any1 avatar Sep 15 '24 21:09 any1

I'm sorry. As the bug is simple to replicate, I thought you wanna try yourself.

Here is the trace log. wayvnc-crash.log

WayVNC doens't crash, the viewer just cannot connect to it anymore. Tried UltraVNC Viewer and TigerVNC Viewer

UltraVNC closes after tried to reconnect showing a black screen and then closes. TigerVNC shows a error after tried to reconnect telling "Invalid pixel format" wayvnc-crash_tigervnc.log

Tried the master version of WayVNC and other versions of the viewers with the same behavior.

RealVNC Viewer connect and reconnect normally even after the connection of these two clients cited above. The UltraVNC Viewer and TigerVNC Viewer still cannot reconnect after RealVNC

In resume cannot connect anymore after the first connection.

I'm using Windows 11 in the client.

drigoskalwalker avatar Sep 19 '24 12:09 drigoskalwalker

This is probably a duplicate of #305.

If this was globally and trivially reproducible, it would be fixed already. This is why it helps to have as much information as possible; things such as what compositor you're running and the exact output from wayvnc -V.

any1 avatar Sep 19 '24 17:09 any1

root@darkstar:~# wayvnc -V wayvnc: 0.8.0 neatvnc: 0.8.1 aml: 0.3.0

I'm using LabWC 0.8.0

drigoskalwalker avatar Sep 21 '24 17:09 drigoskalwalker

Does it make a difference if you change the "preferred encoding" in the "compression" options menu in TigerVNC?

I see you're using RSA-AES. Does disabling it and using VeNCrypt (TLS) instead change anything? You can change that in the security menu if you're configured both on the server side.

any1 avatar Sep 21 '24 19:09 any1

It occurs to me that when this happens, wayvnc may be stalled on a blocking system call. If you attach to it using gdb when this happens and get a backtrace, that should tell us where it's stuck. Do you know how to do that?

any1 avatar Sep 27 '24 12:09 any1

@drigoskalwalker: Have you seen the latest @any1 comment?

Neustradamus avatar Sep 30 '24 19:09 Neustradamus

Hi sorry for the absence.. I tried to use GDB but I didn't get anything Do I have to compile with debug enabled?

drigoskalwalker avatar Oct 04 '24 18:10 drigoskalwalker

There is a chance that we don't need debug symbols to figure this out, but they will definitely help. To enable debug symbols, you can pass the --buildtype=debug argument to meson.

After you've reproduced the issue, please issue the following command:

sudo gdb -p $(pidof wayvnc) --batch -ex "thread apply all where"

any1 avatar Oct 04 '24 20:10 any1

Hi sorry for the wait again. Here is the log file. logwayvnc.txt

Thank you

drigoskalwalker avatar Oct 22 '24 02:10 drigoskalwalker

That backtrace looks normal. I did notice a race condition with resizing that trips up tigervnc a couple a weeks ago. Could that be what you're running into?

What happens if you remove this line? https://github.com/any1/wayvnc/blob/master/src/main.c#L937

any1 avatar Oct 23 '24 09:10 any1

Same behavior Both viewers are stuck in this block https://github.com/any1/wayvnc/blob/f5c5fc856355b6e2f62047c7ec375fd8453f08d9/src/main.c#L2102C1-L2108C3

But I think when I try to reconnect the buffer or something that wayvnc is sending is not ordered or not right in the form that ultraVNC could read, so it rejects the connection. TigerVNC shows that the stream is in the wrong format when I try to reconnect. Somehow RealVNC deal with it.

I think neatvnc need to clean the buffer or reset the display on each reconnection.

drigoskalwalker avatar Oct 23 '24 16:10 drigoskalwalker

@drigoskalwalker, Can you try selecting a different "preferred encoding" in TigerVNC?

  • In the connection menu, select "Options..."
  • Select the "Compression" tab
  • Unselect "Auto select"
  • Select "Tight"

You can also play with other parameters and select other encodings if you want.

If that doesn't do anything, maybe try disabling the clipboard:

  • Go to "Input" tab
  • Unselect "Accept clipboard from server"
  • Unselect "Send clipboard to server"

It might also help to know the following:

  • Are you running a clipboard manager?
  • Which wayland compositor are you running? What version?
  • What sort of a GPU do you have?
  • What is the exact command line that you use to run wayvnc?
  • What does your config file look like (with password redacted)?

any1 avatar Nov 09 '24 23:11 any1

Hi thanks for your response.

I tried Tight and several others encoders, same behavior.

I tried to disable clipboard but seems ultravnc doesn't have this option.

Are you running a clipboard manager? - Don't know what you mean. Which wayland compositor are you running? What version? - LabWC 0.8.0 What sort of a GPU do you have? - NVidia RTX 3060 What is the exact command line that you use to run wayvnc? - wayvnc What does your config file look like (with password redacted)?

use_relative_paths=true address=0.0.0.0 port=7900 enable_auth=true username=vnctest password=vnctest

You can have a try. Just install UltraVNC Viewer or other VNC Viewer on Windows To make a connect you have to use Real VNC Viewer as I said before.

the address: abreucorp.ddns.net:65535

drigoskalwalker avatar Nov 11 '24 15:11 drigoskalwalker

Yeah, I can even reproduce the problem by connecting with tigervnc from Linux to your system.

The problem is that NVidia wants to use a 24 bit pixel format. but the clients aren't having it. They want each pixel to be 1, 2, or 4 bytes. We could convert to 32, but technically 24 is not a protocol violation, so I'd say that the clients are wrong.

any1 avatar Nov 11 '24 16:11 any1

By the way, thanks for answering my questions and setting up the server. I really appreciate it!

any1 avatar Nov 11 '24 16:11 any1

I'm glad for your support. There's anything I could do to fix that, or help you with it?

drigoskalwalker avatar Nov 11 '24 16:11 drigoskalwalker

I think I can take it from here. I'll report the issue with TigerVNC and UltraVNC. However, supporting 24 bit buffers might be more work than they're willing to undertake.

any1 avatar Nov 11 '24 16:11 any1

@maztheman, did you never run into this issue?

any1 avatar Nov 11 '24 16:11 any1

I think I can take it from here. I'll report the issue with TigerVNC and UltraVNC. However, supporting 24 bit buffers might be more work than they're willing to undertake.

I really appreciate your effort. What I can't understand is that, the first connection, all clients works. After the first one, onlye RealVNC can connect. But I'm using RealVNC to restart the wayvnc server, as RealVNC is really slow UltraVNC Viewer is the way to go.

Thank you.

drigoskalwalker avatar Nov 11 '24 16:11 drigoskalwalker

@maztheman, did you never run into this issue?

I don't think so. However, it's been awhile..

maztheman avatar Nov 11 '24 23:11 maztheman

@drigoskalwalker, I pushed a fix to neatvnc just now. It should take care of the problem with both the tiger and the ultra.

any1 avatar Nov 12 '24 11:11 any1

@any1: Thanks for your neatvnc fix here:

  • https://github.com/any1/neatvnc/commit/7220c2f04844450c16fad21944c6fb49210a1e7b

Neustradamus avatar Nov 12 '24 14:11 Neustradamus

@any1: Thanks for the path. Now the reconnection works, the viewer don't close anymore. But...I getting a grey screen, RealVNC Viewer is working normally. Captura de tela 2024-11-12 124901

drigoskalwalker avatar Nov 12 '24 15:11 drigoskalwalker

If you connect with RealVNC and then TigerVNC, do you also get a grey screen then?

any1 avatar Nov 12 '24 15:11 any1

Hi, sorry the wait. Everything is working now.

Tested Tiger VNC Viewer 1.14.0 and 1.14.1 - OK. Tested Real VNC Viewer - OK Tested UltraVNC Viewer 1.6 - OK

Thank you again! You did a great job!

drigoskalwalker avatar Nov 13 '24 02:11 drigoskalwalker

@drigoskalwalker: Can you edit your latest comment by the good 1.6.x.x version?

Neustradamus avatar Jun 25 '25 15:06 Neustradamus