Skip to content

Give each run its own browser instead of a machine-wide one - #65

Merged
PrestaEdit merged 1 commit into
devfrom
fix/checkout-page-closed
Sep 25, 2026
Merged

PrestaEdit merged 1 commit into
devfrom
fix/checkout-page-closed

Conversation

@PrestaEdit

Copy link
Copy Markdown
Contributor

Two PrestaFlow processes running at the same time on one machine closed each other's Chrome.

Root cause

  • A run finds its browser through a socket file. Its path was the same for the whole machine: $TMPDIR/prestaflow-.browser. Every process read and wrote it.
  • At the end of a run, ExecuteSuite::execute() closed the browser named in that file, then deleted the file.
  • Any run that finished, even a suite without a browser, therefore closed the Chrome of a run still in progress.

Symptoms

  • The page was closed and is not available anymore, at the first step of GuestCheckout.
  • When the close happened between two steps, a fresh Chrome was started and the session lost, so the checkout failed later ("Option France not found").
  • It looked version-specific (1.7.8.11 / 9.0.0) only because other runs happened to be going on at the time.

Proof

Checkout on 9.0.0, then psflowdemo's browser-free Smoke started 1.4 s later in another process:

  • the Checkout run failed ;
  • temporary logs showed the other process closing the browser 2 ms before the exception ;
  • right after, Target.getTargets returned nothing.

Fix

  • ExecuteSuite scopes the socket and options files to its own run (run-<pid>-<random>), via TestsSuite::scopeBrowserFilesTo().
  • At the end, releaseBrowser() closes only that browser and deletes only those files.
  • Code that uses TestsSuite without ExecuteSuite keeps the shared path, and with it reconnection to an existing browser.

Verified

  • tests/Unit/Command/BrowserOwnershipTest.php, without a browser: 2 of its 4 tests fail without the fix. Full suite: OK (336 tests, 764 assertions).
  • On fresh Flashlight shops, with psflowdemo's Checkout and its payment init-script:
    • 1.7.8.11, 8.1.7 and 9.0.0: 4/4 each ;
    • with a second run started in parallel: 4/4 on 1.7.8.11 and three times on 9.0.0, where the same setup failed before the fix.

🤖 Generated with Claude Code

The keepAlive browser was found again through a socket file at one fixed
path per machine ($TMPDIR/prestaflow-.browser), shared by every PrestaFlow
process. A run reconnected to whatever Chrome that file named, and
ExecuteSuite ended every run by closing that browser and deleting the file.

So any run that finished while another was in flight, even a browser-free
one such as a smoke suite, closed the other run's Chrome under it. The
victim failed with "The page was closed and is not available anymore",
typically on its first navigation, or silently lost its session when it
relaunched a browser between two steps (an emptied cart, a checkout that
no longer matches). Whether it happened depended on what else was running
on the machine, not on the PrestaShop version under test.

ExecuteSuite now scopes the socket and options files to the run (pid plus
a random token) before it starts and releases only that browser at the end.
Callers outside ExecuteSuite keep the shared path, and the reconnection
they may rely on.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@PrestaEdit
PrestaEdit merged commit 94d3697 into dev Sep 25, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant