Skip to content

Commit abca892

Browse files
committed
ci(linux): share a single Xvfb across the three test invocations
Run 27441055242 had 3-of-6 Linux jobs fail with "xvfb-run: error: Xvfb failed to start" on the second or third flutter test invocation. The pattern was randomly distributed across python versions (3.12, 3.13, 3.14) and arches (AMD64, ARM64) — the signature of a display-number race when xvfb-run is called back to back: the previous Xvfb hadn't fully released its display before the next xvfb-run tried to claim one. Start one Xvfb on :99 at the top of the test step (with a kill-on-EXIT trap), then run all three test files against the same DISPLAY. Also bumped the post-startup settle from "none" to a fixed 1-second sleep before the first flutter test runs (no xdpyinfo on the runner to do a proper readiness check, and 1s is plenty for Xvfb to start listening).
1 parent 5c7c940 commit abca892

1 file changed

Lines changed: 18 additions & 3 deletions

File tree

.github/workflows/ci.yml

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -363,12 +363,27 @@ jobs:
363363
--platform Linux \
364364
--python-version ${{ matrix.python_version }}
365365
set -o pipefail
366+
367+
# Three back-to-back `xvfb-run` invocations race for display
368+
# numbers — the second/third sometimes trips "Xvfb failed to
369+
# start" because the previous Xvfb's display isn't released yet
370+
# (3-of-6 Linux jobs in run 27441055242 hit this). Start one
371+
# Xvfb up front, share DISPLAY across all three test runs.
372+
Xvfb :99 -screen 0 1280x1024x24 >/tmp/xvfb.log 2>&1 &
373+
XVFB_PID=$!
374+
export DISPLAY=:99
375+
trap 'kill $XVFB_PID 2>/dev/null || true' EXIT
376+
# Brief settle so Xvfb is accepting connections before flutter
377+
# test tries to open the window. xdpyinfo isn't in the ubuntu
378+
# runner's default toolchain; a fixed sleep is sufficient.
379+
sleep 1
380+
366381
# Per-file: `flutter test integration_test` (whole dir) reuses one
367382
# VM session and the second file fails to start the app. See
368383
# bridge_example_macos for the discovery.
369-
xvfb-run flutter test integration_test/interactivity_test.dart -d linux --dart-define=EXPECTED_PYTHON_VERSION=${{ matrix.python_version }} -v 2>&1 | tail -300
370-
xvfb-run flutter test integration_test/throughput_test.dart -d linux --dart-define=EXPECTED_PYTHON_VERSION=${{ matrix.python_version }} -v 2>&1 | tail -300
371-
xvfb-run flutter test integration_test/memory_test.dart -d linux --dart-define=EXPECTED_PYTHON_VERSION=${{ matrix.python_version }} -v 2>&1 | tail -300
384+
flutter test integration_test/interactivity_test.dart -d linux --dart-define=EXPECTED_PYTHON_VERSION=${{ matrix.python_version }} -v 2>&1 | tail -300
385+
flutter test integration_test/throughput_test.dart -d linux --dart-define=EXPECTED_PYTHON_VERSION=${{ matrix.python_version }} -v 2>&1 | tail -300
386+
flutter test integration_test/memory_test.dart -d linux --dart-define=EXPECTED_PYTHON_VERSION=${{ matrix.python_version }} -v 2>&1 | tail -300
372387
373388
- name: Diagnostics on failure
374389
if: failure()

0 commit comments

Comments
 (0)