question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Xvfb error while trying to open multiple xvfb screens in single python session

See original GitHub issue

General information:

  • OS name: Ubuntu
  • OS version: 20.04
  • OS architecture: 64 bits
  • Resolutions:
    • Monitor 1: 1920x1080
  • Python version: 3.8.10
  • MSS version: 6.1.0

For GNU/Linux users:

  • Display server protocol and version, if known: Xorg
  • Desktop Environment: Gnome
  • Composite Window Manager name and version: Not sure

Description of the warning/error

The error comes when I try to call mss.mss() in a single python session with two different Xvfb screens.

Full message

XIO: fatal IO error 0 (Success) on X server ":3" after 8 requests (8 known processed) with 0 events remaining.

Other details

Steps to reproduce:

from xvfbwrapper import Xvfb
import mss
import os

xvfb = Xvfb(width=1920, height=1080, colordepth=24)
xvfb.start()

with mss.mss() as sct:
    pass
xvfb.stop()

xvfb = Xvfb(width=1920, height=1080, colordepth=24)
xvfb.start()

with mss.mss() as sct:
    pass

The error pops up exactly on this line

Issue Analytics

  • State:open
  • Created 2 years ago
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
BoboTiGcommented, Jan 20, 2022

Actually those internal details were added for performance and memory leak reasons. Your situation is not so frequent, so I would go with the new function to clear the internal state.

1reaction
BoboTiGcommented, Jan 20, 2022

Could you try to reset that attribute before the second use of MSS?

from mss.linux import MSS

# (...)
xvfb.stop()

MSS._display_dict.clear()

xvfb = Xvfb(width=1920, height=1080, colordepth=24)
# (...)
Read more comments on GitHub >

github_iconTop Results From Across the Web

Two instances of pyvirtualdisplay (xvfb) won't run at the same ...
So I have a small script which uses pyvirtualdisplay to make a virtual display to run some selenium tests. I have tested the...
Read more >
38 How To Run Your Tests Headlessly with Xvfb
Option 1. Start Xvfb on a specific display port and background the process; Tell the terminal session to use the display port; Run...
Read more >
Strange rendering issues when using xvfb-run
I want to run the app inside of a virtual frame buffer, using Xvfb, and access it remotely using a VNC. It may...
Read more >
Install and configure Xserver Virtual Frame Buffer (Xvfb)
If Xvfb is present but not running, proceed to 1.3 Configure automatic start up. If it is not present, proceed to 1.3 Download...
Read more >
xvfbman - PyPI
A python module for managing Xvfb sessions / ensuring DISPLAY through ... The xvfbman module provides an interface to start and manage Xvfb...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found