[英]Xvfb x11vnc | Different Displaynumber specified but when connecting, its the same
So.所以。 I've build myself a custom Selenium-Chrome-Node Docker image, which's purpose is to host a node, a virtual display and also a x11vnc Server to connect to the display.
我已经为自己构建了一个自定义 Selenium-Chrome-Node Docker 映像,其目的是托管一个节点、一个虚拟显示器以及一个 x11vnc 服务器以连接到显示器。
My docker image has enviroment variables to it, so I can easily create two containers with two seperate virtual display to have a backup node, when running selenium tests.我的 docker 映像具有环境变量,因此在运行 selenium 测试时,我可以轻松地创建两个具有两个单独虚拟显示器的容器以拥有一个备份节点。
The Selenium side is working fine, but when I start the xvfb virtual display, they both end up on the same display. Selenium 端工作正常,但是当我启动 xvfb 虚拟显示器时,它们最终都在同一个显示器上。 eg :91
例如:91
Here is what I run + the output it gives, which would indicate they are two seperate display.这是我运行的+它给出的输出,这表明它们是两个单独的显示。 Its one docker-compose file, so I will sort the code per node for easier readability.
它是一个 docker-compose 文件,因此我将对每个节点的代码进行排序以便于阅读。 In line 9 and 10 you can see what commands are run.
在第 9 行和第 10 行中,您可以看到运行了哪些命令。
Node 1节点 1
snode_postgres_1 | Node IP: 192.168.56.103
snode_postgres_1 | Node Port: 5555
snode_postgres_1 | NODE Application Name: dsnjen_postgres
snode_postgres_1 | Hub IP: 192.168.56.104
snode_postgres_1 | Hub Port: 4444
snode_postgres_1 | Display Number: :90
snode_postgres_1 | x11vnc Port: 5900
snode_postgres_1 | Now running:
snode_postgres_1 | Xvfb :90 -screen 0 1920x1080x24 -nolisten tcp
snode_postgres_1 | x11vnc -create -env X11VNC_FINDDISPLAY_ALWAYS_FAILS=1 -env debug=1 -display :90 -env X11VNC_CREATE_GEOM=./startnode.sh -gone killall Xvfb -nopw -rfbport 5900 -forever -shared
snode_postgres_1 | 21/06/2022 07:56:20 passing arg to libvncserver: -rfbport
snode_postgres_1 | 21/06/2022 07:56:20 passing arg to libvncserver: 5900
snode_postgres_1 | 21/06/2022 07:56:20 x11vnc version: 0.9.16 lastmod: 2019-01-05 pid: 12
snode_postgres_1 | 21/06/2022 07:56:20 Using X display :90
snode_postgres_1 | 21/06/2022 07:56:20 rootwin: 0x50e reswin: 0x200001 dpy: 0x54c79400
snode_postgres_1 | 21/06/2022 07:56:20
snode_postgres_1 | 21/06/2022 07:56:20 ------------------ USEFUL INFORMATION ------------------
snode_postgres_1 | 21/06/2022 07:56:20 X DAMAGE available on display, using it for polling hints.
snode_postgres_1 | 21/06/2022 07:56:20 To disable this behavior use: '-noxdamage'
snode_postgres_1 | 21/06/2022 07:56:20
snode_postgres_1 | 21/06/2022 07:56:20 Most compositing window managers like 'compiz' or 'beryl'
snode_postgres_1 | 21/06/2022 07:56:20 cause X DAMAGE to fail, and so you may not see any screen
snode_postgres_1 | 21/06/2022 07:56:20 updates via VNC. Either disable 'compiz' (recommended) or
snode_postgres_1 | 21/06/2022 07:56:20 supply the x11vnc '-noxdamage' command line option.
snode_postgres_1 | 21/06/2022 07:56:20
snode_postgres_1 | 21/06/2022 07:56:20 Wireframing: -wireframe mode is in effect for window moves.
snode_postgres_1 | 21/06/2022 07:56:20 If this yields undesired behavior (poor response, painting
snode_postgres_1 | 21/06/2022 07:56:20 errors, etc) it may be disabled:
snode_postgres_1 | 21/06/2022 07:56:20 - use '-nowf' to disable wireframing completely.
snode_postgres_1 | 21/06/2022 07:56:20 - use '-nowcr' to disable the Copy Rectangle after the
snode_postgres_1 | 21/06/2022 07:56:20 moved window is released in the new position.
snode_postgres_1 | 21/06/2022 07:56:20 Also see the -help entry for tuning parameters.
snode_postgres_1 | 21/06/2022 07:56:20 You can press 3 Alt_L's (Left "Alt" key) in a row to
snode_postgres_1 | 21/06/2022 07:56:20 repaint the screen, also see the -fixscreen option for
snode_postgres_1 | 21/06/2022 07:56:20 periodic repaints.
snode_postgres_1 | 21/06/2022 07:56:20
snode_postgres_1 | 21/06/2022 07:56:20 XFIXES available on display, resetting cursor mode
snode_postgres_1 | 21/06/2022 07:56:20 to: '-cursor most'.
snode_postgres_1 | 21/06/2022 07:56:20 to disable this behavior use: '-cursor arrow'
snode_postgres_1 | 21/06/2022 07:56:20 or '-noxfixes'.
snode_postgres_1 | 21/06/2022 07:56:20 using XFIXES for cursor drawing.
snode_postgres_1 | 21/06/2022 07:56:20 GrabServer control via XTEST.
snode_postgres_1 | 21/06/2022 07:56:20
snode_postgres_1 | 21/06/2022 07:56:20 Scroll Detection: -scrollcopyrect mode is in effect to
snode_postgres_1 | 21/06/2022 07:56:20 use RECORD extension to try to detect scrolling windows
snode_postgres_1 | 21/06/2022 07:56:20 (induced by either user keystroke or mouse input).
snode_postgres_1 | 21/06/2022 07:56:20 If this yields undesired behavior (poor response, painting
snode_postgres_1 | 21/06/2022 07:56:20 errors, etc) it may be disabled via: '-noscr'
snode_postgres_1 | 21/06/2022 07:56:20 Also see the -help entry for tuning parameters.
snode_postgres_1 | 21/06/2022 07:56:20 You can press 3 Alt_L's (Left "Alt" key) in a row to
snode_postgres_1 | 21/06/2022 07:56:20 repaint the screen, also see the -fixscreen option for
snode_postgres_1 | 21/06/2022 07:56:20 periodic repaints.
snode_postgres_1 | 21/06/2022 07:56:20
snode_postgres_1 | 21/06/2022 07:56:20 XKEYBOARD: number of keysyms per keycode 7 is greater
snode_postgres_1 | 21/06/2022 07:56:20 than 4 and 51 keysyms are mapped above 4.
snode_postgres_1 | 21/06/2022 07:56:20 Automatically switching to -xkb mode.
snode_postgres_1 | 21/06/2022 07:56:20 If this makes the key mapping worse you can
snode_postgres_1 | 21/06/2022 07:56:20 disable it with the "-noxkb" option.
snode_postgres_1 | 21/06/2022 07:56:20 Also, remember "-remap DEAD" for accenting characters.
snode_postgres_1 | 21/06/2022 07:56:20
snode_postgres_1 | 21/06/2022 07:56:20 X FBPM extension not supported.
snode_postgres_1 | Xlib: extension "DPMS" missing on display ":90".
snode_postgres_1 | 21/06/2022 07:56:20 X display is not capable of DPMS.
snode_postgres_1 | 21/06/2022 07:56:20 --------------------------------------------------------
snode_postgres_1 | 21/06/2022 07:56:20
snode_postgres_1 | 21/06/2022 07:56:20 Default visual ID: 0x21
snode_postgres_1 | 21/06/2022 07:56:20 Read initial data from X display into framebuffer.
snode_postgres_1 | 21/06/2022 07:56:20 initialize_screen: fb_depth/fb_bpp/fb_Bpl 24/32/7680
snode_postgres_1 | 21/06/2022 07:56:20
snode_postgres_1 | 21/06/2022 07:56:20 X display :90 is 32bpp depth=24 true color
snode_postgres_1 | 21/06/2022 07:56:20
snode_postgres_1 | 21/06/2022 07:56:20 Listening for VNC connections on TCP port 5900
snode_postgres_1 | 21/06/2022 07:56:20 rfbListenOnTCP6Port: error in bind IPv6 socket: Address already in use
snode_postgres_1 | 21/06/2022 07:56:20 listen6: bind: Address already in use
snode_postgres_1 | 21/06/2022 07:56:20 Not listening on IPv6 interface.
snode_postgres_1 | 21/06/2022 07:56:20
snode_postgres_1 | 21/06/2022 07:56:20 Xinerama is present and active (e.g. multi-head).
snode_postgres_1 | 21/06/2022 07:56:20 Xinerama: number of sub-screens: 1
snode_postgres_1 | 21/06/2022 07:56:20 Xinerama: no blackouts needed (only one sub-screen)
snode_postgres_1 | 21/06/2022 07:56:20
snode_postgres_1 | 21/06/2022 07:56:20 fb read rate: 2475 MB/sec
snode_postgres_1 | 21/06/2022 07:56:20 fast read: reset -wait ms to: 10
snode_postgres_1 | 21/06/2022 07:56:20 fast read: reset -defer ms to: 10
snode_postgres_1 | 21/06/2022 07:56:20 The X server says there are 10 mouse buttons.
snode_postgres_1 | 21/06/2022 07:56:20 screen setup finished.
snode_postgres_1 | 21/06/2022 07:56:20
snode_postgres_1 |
snode_postgres_1 | The VNC desktop is: lcmadmin-virtualbox:0
snode_postgres_1 | PORT=5900
snode_postgres_1 |
snode_postgres_1 | ******************************************************************************
snode_postgres_1 | Have you tried the x11vnc '-ncache' VNC client-side pixel caching feature yet?
snode_postgres_1 |
snode_postgres_1 | The scheme stores pixel data offscreen on the VNC viewer side for faster
snode_postgres_1 | retrieval. It should work with any VNC viewer. Try it by running:
snode_postgres_1 |
snode_postgres_1 | x11vnc -ncache 10 ...
snode_postgres_1 |
snode_postgres_1 | One can also add -ncache_cr for smooth 'copyrect' window motion.
snode_postgres_1 | More info: http://www.karlrunge.com/x11vnc/faq.html#faq-client-caching
Node 2节点 2
snode_postgres_2 | Node IP: 192.168.56.103
snode_postgres_2 | Node Port: 5556
snode_postgres_2 | NODE Application Name: dsnjen_postgres
snode_postgres_2 | Hub IP: 192.168.56.104
snode_postgres_2 | Hub Port: 4444
snode_postgres_2 | Display Number: :91
snode_postgres_2 | x11vnc Port: 5901
snode_postgres_2 | Now running:
snode_postgres_2 | Xvfb :91 -screen 0 1920x1080x24 -nolisten tcp
snode_postgres_2 | x11vnc -create -env X11VNC_FINDDISPLAY_ALWAYS_FAILS=1 -env debug=1 -display :91 -env X11VNC_CREATE_GEOM=./startnode.sh -gone killall Xvfb -nopw -rfbport 5901 -forever -shared
snode_postgres_2 | 21/06/2022 07:56:20 passing arg to libvncserver: -rfbport
snode_postgres_2 | 21/06/2022 07:56:20 passing arg to libvncserver: 5901
snode_postgres_2 | 21/06/2022 07:56:20 x11vnc version: 0.9.16 lastmod: 2019-01-05 pid: 12
snode_postgres_2 | 21/06/2022 07:56:20 Using X display :91
snode_postgres_2 | 21/06/2022 07:56:20 rootwin: 0x50e reswin: 0x200001 dpy: 0x6c60b400
snode_postgres_2 | 21/06/2022 07:56:20
snode_postgres_2 | 21/06/2022 07:56:20 ------------------ USEFUL INFORMATION ------------------
snode_postgres_2 | 21/06/2022 07:56:20 X DAMAGE available on display, using it for polling hints.
snode_postgres_2 | 21/06/2022 07:56:20 To disable this behavior use: '-noxdamage'
snode_postgres_2 | 21/06/2022 07:56:20
snode_postgres_2 | 21/06/2022 07:56:20 Most compositing window managers like 'compiz' or 'beryl'
snode_postgres_2 | 21/06/2022 07:56:20 cause X DAMAGE to fail, and so you may not see any screen
snode_postgres_2 | 21/06/2022 07:56:20 updates via VNC. Either disable 'compiz' (recommended) or
snode_postgres_2 | 21/06/2022 07:56:20 supply the x11vnc '-noxdamage' command line option.
snode_postgres_2 | 21/06/2022 07:56:20
snode_postgres_2 | 21/06/2022 07:56:20 Wireframing: -wireframe mode is in effect for window moves.
snode_postgres_2 | 21/06/2022 07:56:20 If this yields undesired behavior (poor response, painting
snode_postgres_2 | 21/06/2022 07:56:20 errors, etc) it may be disabled:
snode_postgres_2 | 21/06/2022 07:56:20 - use '-nowf' to disable wireframing completely.
snode_postgres_2 | 21/06/2022 07:56:20 - use '-nowcr' to disable the Copy Rectangle after the
snode_postgres_2 | 21/06/2022 07:56:20 moved window is released in the new position.
snode_postgres_2 | 21/06/2022 07:56:20 Also see the -help entry for tuning parameters.
snode_postgres_2 | 21/06/2022 07:56:20 You can press 3 Alt_L's (Left "Alt" key) in a row to
snode_postgres_2 | 21/06/2022 07:56:20 repaint the screen, also see the -fixscreen option for
snode_postgres_2 | 21/06/2022 07:56:20 periodic repaints.
snode_postgres_2 | 21/06/2022 07:56:20
snode_postgres_2 | 21/06/2022 07:56:20 XFIXES available on display, resetting cursor mode
snode_postgres_2 | 21/06/2022 07:56:20 to: '-cursor most'.
snode_postgres_2 | 21/06/2022 07:56:20 to disable this behavior use: '-cursor arrow'
snode_postgres_2 | 21/06/2022 07:56:20 or '-noxfixes'.
snode_postgres_2 | 21/06/2022 07:56:20 using XFIXES for cursor drawing.
snode_postgres_2 | 21/06/2022 07:56:20 GrabServer control via XTEST.
snode_postgres_2 | 21/06/2022 07:56:20
snode_postgres_2 | 21/06/2022 07:56:20 Scroll Detection: -scrollcopyrect mode is in effect to
snode_postgres_2 | 21/06/2022 07:56:20 use RECORD extension to try to detect scrolling windows
snode_postgres_2 | 21/06/2022 07:56:20 (induced by either user keystroke or mouse input).
snode_postgres_2 | 21/06/2022 07:56:20 If this yields undesired behavior (poor response, painting
snode_postgres_2 | 21/06/2022 07:56:20 errors, etc) it may be disabled via: '-noscr'
snode_postgres_2 | 21/06/2022 07:56:20 Also see the -help entry for tuning parameters.
snode_postgres_2 | 21/06/2022 07:56:20 You can press 3 Alt_L's (Left "Alt" key) in a row to
snode_postgres_2 | 21/06/2022 07:56:20 repaint the screen, also see the -fixscreen option for
snode_postgres_2 | 21/06/2022 07:56:20 periodic repaints.
snode_postgres_2 | 21/06/2022 07:56:20
snode_postgres_2 | 21/06/2022 07:56:20 XKEYBOARD: number of keysyms per keycode 7 is greater
snode_postgres_2 | 21/06/2022 07:56:20 than 4 and 51 keysyms are mapped above 4.
snode_postgres_2 | 21/06/2022 07:56:20 Automatically switching to -xkb mode.
snode_postgres_2 | 21/06/2022 07:56:20 If this makes the key mapping worse you can
snode_postgres_2 | 21/06/2022 07:56:20 disable it with the "-noxkb" option.
snode_postgres_2 | 21/06/2022 07:56:20 Also, remember "-remap DEAD" for accenting characters.
snode_postgres_2 | 21/06/2022 07:56:20
snode_postgres_2 | 21/06/2022 07:56:20 X FBPM extension not supported.
snode_postgres_2 | Xlib: extension "DPMS" missing on display ":91".
snode_postgres_2 | 21/06/2022 07:56:20 X display is not capable of DPMS.
snode_postgres_2 | 21/06/2022 07:56:20 --------------------------------------------------------
snode_postgres_2 | 21/06/2022 07:56:20
snode_postgres_2 | 21/06/2022 07:56:20 Default visual ID: 0x21
snode_postgres_2 | 21/06/2022 07:56:20 Read initial data from X display into framebuffer.
snode_postgres_2 | 21/06/2022 07:56:20 initialize_screen: fb_depth/fb_bpp/fb_Bpl 24/32/7680
snode_postgres_2 | 21/06/2022 07:56:20
snode_postgres_2 | 21/06/2022 07:56:20 X display :91 is 32bpp depth=24 true color
snode_postgres_2 | 21/06/2022 07:56:20
snode_postgres_2 | 21/06/2022 07:56:20 Listening for VNC connections on TCP port 5901
snode_postgres_2 | 21/06/2022 07:56:20 Listening for VNC connections on TCP6 port 5900
snode_postgres_2 | 21/06/2022 07:56:20 Listening also on IPv6 port 5901 (socket 10)
snode_postgres_2 | 21/06/2022 07:56:20
snode_postgres_2 | 21/06/2022 07:56:20 Xinerama is present and active (e.g. multi-head).
snode_postgres_2 | 21/06/2022 07:56:20 Xinerama: number of sub-screens: 1
snode_postgres_2 | 21/06/2022 07:56:20 Xinerama: no blackouts needed (only one sub-screen)
snode_postgres_2 | 21/06/2022 07:56:20
snode_postgres_2 | 21/06/2022 07:56:20 fb read rate: 2485 MB/sec
snode_postgres_2 | 21/06/2022 07:56:20 fast read: reset -wait ms to: 10
snode_postgres_2 | 21/06/2022 07:56:20 fast read: reset -defer ms to: 10
snode_postgres_2 | 21/06/2022 07:56:20 The X server says there are 10 mouse buttons.
snode_postgres_2 | 21/06/2022 07:56:20 screen setup finished.
snode_postgres_2 | 21/06/2022 07:56:20
snode_postgres_2 |
snode_postgres_2 | The VNC desktop is: lcmadmin-virtualbox:1
snode_postgres_2 | PORT=5901
snode_postgres_2 |
snode_postgres_2 | ******************************************************************************
snode_postgres_2 | Have you tried the x11vnc '-ncache' VNC client-side pixel caching feature yet?
snode_postgres_2 |
snode_postgres_2 | The scheme stores pixel data offscreen on the VNC viewer side for faster
snode_postgres_2 | retrieval. It should work with any VNC viewer. Try it by running:
snode_postgres_2 |
snode_postgres_2 | x11vnc -ncache 10 ...
snode_postgres_2 |
snode_postgres_2 | One can also add -ncache_cr for smooth 'copyrect' window motion.
snode_postgres_2 | More info: http://www.karlrunge.com/x11vnc/faq.html#faq-client-caching
snode_postgres_2 |
In the logs I found both entries, which tell me, the correct displays are used:在日志中,我找到了两个条目,它们告诉我,使用了正确的显示:
snode_postgres_1 | 21/06/2022 07:56:20 Using X display :90
snode_postgres_2 | 21/06/2022 07:56:20 Using X display :91
But when I connect to the displays via Vinagre, they both share the same display-number and also show the same content.但是当我通过 Vinagre 连接到显示器时,它们都共享相同的显示编号并显示相同的内容。 I cant seem to find the error, as the logs also show the correct displays are used.
我似乎找不到错误,因为日志还显示使用了正确的显示器。
How can I fix this so that two virtual displays are used..?我该如何解决这个问题,以便使用两个虚拟显示器..?
EDIT So I split the docker-compose file into two different files and now it seems to work.编辑所以我将 docker-compose 文件分成两个不同的文件,现在它似乎可以工作了。 Can anyone explain to me please, why this is happening?
谁能给我解释一下,为什么会这样?
Here is my docker-compose file:这是我的 docker-compose 文件:
# docker-compose.yml
version: "3.7"
services:
selenium_1:
image: selenium_c:latest
network_mode: host
container_name: snode_postgres_1
stdin_open: true
privileged: true
tty: true
restart: always
expose:
- 5555
- 5900
ports:
- 5555:5555
- 5900:5900
environment:
- NODE_IP=192.168.56.103
- NODE_PORT=5555
- NODE_APP_NAME=dsnjen_postgres
- HUB_IP=192.168.56.104
- HUB_PORT=4444
- XVBF_DISPLAY_NUMBER=:90
- DISPLAY=:90
- X11VNC_PORT=5900
volumes:
- /dev/shm:/dev/shm
selenium_2:
image: selenium_c:latest
network_mode: host
container_name: snode_postgres_2
stdin_open: true
privileged: true
tty: true
restart: always
expose:
- 5556
- 5901
ports:
- 5556:5556
- 5901:5901
environment:
- NODE_IP=192.168.56.103
- NODE_PORT=5556
- NODE_APP_NAME=dsnjen_postgres
- HUB_IP=192.168.56.104
- HUB_PORT=4444
- XVBF_DISPLAY_NUMBER=:91
- DISPLAY=:91
- X11VNC_PORT=5901
volumes:
- /dev/shm:/dev/shm
Seems like in the compose file, when two containers start up at the same time, they mix up their variables etc..似乎在撰写文件中,当两个容器同时启动时,它们会混淆它们的变量等。
Making the second container wait until the other has started, fixed the problem for me.让第二个容器等到另一个容器启动,为我解决了这个问题。
to the second service I just added:我刚刚添加的第二项服务:
depends_on: - "selenium_1"依赖:-“selenium_1”
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.