Skip to content

Commit

Permalink
ci: don't do things in parallel
Browse files Browse the repository at this point in the history
We are seeing a failure in CI:

    2025-01-12T17:04:29.4036037Z ============================= test session starts ==============================
    2025-01-12T17:04:29.4041867Z platform linux -- Python 3.10.16, pytest-8.3.4, pluggy-1.5.0
    2025-01-12T17:04:29.4057331Z rootdir: /home/runner/work/xcffib/xcffib
    2025-01-12T17:04:29.4058439Z configfile: pyproject.toml
    2025-01-12T17:04:29.4058973Z plugins: xdist-3.6.1
    2025-01-12T17:04:29.4060410Z created: 4/4 workers
    2025-01-12T17:04:29.4060890Z 4 workers [41 items]
    2025-01-12T17:04:29.4061222Z
    2025-01-12T17:04:30.9148442Z ................................F........                                [100%]
    2025-01-12T17:04:30.9149097Z =================================== FAILURES ===================================
    2025-01-12T17:04:30.9149686Z ______________ TestXcffibTestGenerator.test_XcffibTest_generator _______________
    2025-01-12T17:04:30.9150278Z [gw2] linux -- Python 3.10.16 /home/runner/work/xcffib/xcffib/xcffib-test-api.9CS94gIlPW/bin/python
    2025-01-12T17:04:30.9150624Z
    2025-01-12T17:04:30.9150858Z self = <test.test_python_code.TestXcffibTestGenerator object at 0x7f0503d80a60>
    2025-01-12T17:04:30.9151193Z
    2025-01-12T17:04:30.9151307Z     def test_XcffibTest_generator(self):
    2025-01-12T17:04:30.9151562Z         try:
    2025-01-12T17:04:30.9151807Z             old_display = os.environ["DISPLAY"]
    2025-01-12T17:04:30.9152073Z         except KeyError:
    2025-01-12T17:04:30.9152289Z             old_display = ""
    2025-01-12T17:04:30.9152543Z         # use some non-default width/height
    2025-01-12T17:04:30.9152844Z >       with XcffibTest(width=1001, height=502) as test:
    2025-01-12T17:04:30.9153042Z
    2025-01-12T17:04:30.9153144Z test/test_python_code.py:205:
    2025-01-12T17:04:30.9153420Z _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
    2025-01-12T17:04:30.9153717Z xcffib/testing.py:116: in __enter__
    2025-01-12T17:04:30.9153974Z     self.setUp()
    2025-01-12T17:04:30.9154181Z test/conftest.py:39: in setUp
    2025-01-12T17:04:30.9154417Z     XvfbTest.setUp(self)
    2025-01-12T17:04:30.9154642Z xcffib/testing.py:83: in setUp
    2025-01-12T17:04:30.9155083Z     self.conn = self._connect_to_xvfb()
    2025-01-12T17:04:30.9155406Z _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
    2025-01-12T17:04:30.9155604Z
    2025-01-12T17:04:30.9155763Z self = <test.conftest.XcffibTest object at 0x7f0503db7d90>
    2025-01-12T17:04:30.9155990Z
    2025-01-12T17:04:30.9156084Z     def _connect_to_xvfb(self):
    2025-01-12T17:04:30.9156357Z         # sometimes it takes a while for Xvfb to start
    2025-01-12T17:04:30.9156628Z         for _ in range(100):
    2025-01-12T17:04:30.9156841Z             try:
    2025-01-12T17:04:30.9157066Z                 conn = Connection(os.environ["DISPLAY"])
    2025-01-12T17:04:30.9157330Z                 conn.invalid()
    2025-01-12T17:04:30.9157534Z
    2025-01-12T17:04:30.9157804Z                 # xvfb creates a screen with a default width, and then resizes it.
    2025-01-12T17:04:30.9158215Z                 # we wait here for the resize event, so that the actual test only
    2025-01-12T17:04:30.9158571Z                 # ever sees a screen that is the right size.
    2025-01-12T17:04:30.9158863Z                 setup = conn.get_setup()
    2025-01-12T17:04:30.9159122Z                 screen = setup.roots[0]
    2025-01-12T17:04:30.9159745Z                 if screen.width_in_pixels == self.width and screen.height_in_pixels == self.height:
    2025-01-12T17:04:30.9160150Z                     return conn
    2025-01-12T17:04:30.9160390Z                 conn.disconnect()
    2025-01-12T17:04:30.9160639Z             except ConnectionException:
    2025-01-12T17:04:30.9160896Z                 time.sleep(0.2)
    2025-01-12T17:04:30.9161110Z                 continue
    2025-01-12T17:04:30.9161344Z >       assert False, "couldn't connect to xvfb"
    2025-01-12T17:04:30.9161650Z E       AssertionError: couldn't connect to xvfb
    2025-01-12T17:04:30.9161841Z
    2025-01-12T17:04:30.9161956Z xcffib/testing.py:147: AssertionError
    2025-01-12T17:04:30.9162294Z ----------------------------- Captured stderr call -----------------------------
    2025-01-12T17:04:30.9162744Z _XSERVTransSocketUNIXCreateListener: ...SocketCreateListener() failed
    2025-01-12T17:04:30.9163203Z _XSERVTransMakeAllCOTSServerListeners: server already running
    2025-01-12T17:04:30.9163509Z (EE)
    2025-01-12T17:04:30.9163680Z Fatal server error:
    2025-01-12T17:04:30.9164065Z (EE) Cannot establish any listening sockets - Make sure an X server isn't already running(EE)

In principle this Should Not Happen: we are using flock's LOCK_EX to get
exclusive locks on these files. But it's very possible that with xdist we
are forking, losing the lock, etc. etc.

I played around with open(O_CREAT | O_EXCL), and that didn't fix it either,
so it doesn't seem to be a problem with the locking itself. Maybe we are
starting two copies of xvfb or xephyr or something somehow. In any case,
let's drop some parallelism for now so we can land this other stuff
reliably, since this doesn't seem to be an issue with the binding itself,
and just the test harness.

Signed-off-by: Tycho Andersen <[email protected]>
  • Loading branch information
tych0 committed Jan 13, 2025
1 parent 4e2ef97 commit 2f0ac7e
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,4 @@ jobs:
cabal-version: latest
- run: sudo apt install x11-apps libxcb1-dev libxcb-render0-dev
- run: git clone https://gitlab.freedesktop.org/xorg/proto/xcbproto.git proto && cd proto && git checkout ${{ matrix.xcbver }}
- run: make -j XCBDIR=./proto/src check
- run: make XCBDIR=./proto/src check
2 changes: 1 addition & 1 deletion test/test_mode.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,4 @@ flock xcffib.cabal pip install --no-cache -v .
# we won't pick up the local source xcffib module. the venv dir is as good a
# place as any
python -I -c "import xcffib; print(\"mode is\", xcffib.cffi_mode, \"path is\", xcffib.__file__); assert xcffib.cffi_mode == \"${MODE}\""
python -I -m pytest --durations=3 -n auto
python -I -m pytest --durations=3

0 comments on commit 2f0ac7e

Please sign in to comment.