Skip to content

[13.x] Roll back to savepoint on concurrency errors in nested transactions - #62248

Merged
taylorotwell merged 1 commit into
laravel:13.xfrom
xurshudyan:nested-transaction-concurrency-savepoint
Oct 30, 2026
Merged

taylorotwell merged 1 commit into
laravel:13.xfrom
xurshudyan:nested-transaction-concurrency-savepoint

Conversation

@xurshudyan

@xurshudyan xurshudyan commented Oct 29, 2026 •

Copy link
Copy Markdown
Contributor

Writes from a nested transaction that hits a lock wait timeout aren't rolled back, so they're committed if the outer transaction catches the exception:

DB::transaction(function () use ($orders) {
    foreach ($orders as $order) {
        try {
            $this->stock->reserve($order); // uses DB::transaction() itself
        } catch (Throwable) {
            $order->markAsFailed();
        }
    }
});

// a lock wait timeout on the third item still commits the first two decrements

Other exceptions in a nested transaction roll back to its savepoint; concurrency errors now do the same.

@taylorotwell
taylorotwell merged commit 974cd80 into laravel:13.x Oct 30, 2026
64 checks passed
binaryfire added a commit to hypervel/components-backup that referenced this pull request Nov 3, 2026
Laravel now rolls back to the savepoint when a nested transaction hits a
concurrency error. Hypervel's handleTransactionException() already wraps
the failure in DeadlockException and rolls back to the savepoint, so only
the test is ported.

Ports the test from laravel/framework#62248 on 13.x at b20bf7f442. Its
driver error is a PDOException, because Hypervel's
ConcurrencyErrorDetector matches driver exceptions rather than the SQL in
a QueryException message.

Tests: testNestedTransactionIsRolledBackToItsSavepointOnConcurrencyError
passes.
PupFuzz added a commit to PupFuzz/mezzanine that referenced this pull request Nov 4, 2026
…rity advisories (closes card#12862) (#423)

* card#12862: update laravel/framework to v13.40.0 past GHSA-63hm-g96r-2m2q

composer update laravel/framework laravel/prompts: v13.36+ requires
laravel/prompts ^0.3.25 (locked v0.3.23). Only these two packages move.

* card#12862: changelog bullet; correct the nested concurrency-error rollback note

laravel/framework v13.40.0 (#62248) rolls a nested concurrency error back
to its savepoint; IngestServerErrorTest's docblock said it did not.

* card#12862: update symfony/mime to v8.1.10 past CVE-2026-45070

composer update symfony/mime; only symfony/mime moves. composer audit
is clean on the resulting lock.

* card#12862: update four Symfony components to v8.1.11 past the 2026-11-04 advisories

composer update symfony/http-foundation symfony/http-kernel symfony/routing
symfony/serializer; only these four move. composer audit is clean on the
resulting lock.

PR #423 description (verbatim):

**`card-12862-laravel-advisory` → `dev`.** Merges the commits this branch carries since `37fdd0c08abd`, which `git log --oneline 37fdd0c..card-12862-laravel-advisory` re-prints.

## Highlights

- `laravel/framework` is locked at v13.40.0 (was v13.34.0), past the low-severity advisory GHSA-63hm-g96r-2m2q in the Concurrency facade's process driver. Only the framework itself references the Concurrency facade, so for Mezzanine this part is preventive. `laravel/prompts` moves with it from v0.3.23 to v0.3.26, which 13.36 and later require.
- `symfony/mime` is locked at v8.1.10 (was v8.1.5), past the medium-severity CVE-2026-45070, an email header injection through MIME parameter names. Mezzanine builds its two-factor reset email with it.
- `symfony/http-foundation`, `symfony/http-kernel`, `symfony/routing` and `symfony/serializer` are locked at v8.1.11, past the nine advisories published for them on 2026-11-04. Two apply to code Mezzanine runs: GHSA-5mx8-mwrp-5693, where a crafted request path can give absolute URLs, such as the two-factor reset email's link, a host the client chose; and GHSA-3h27-hjv7-fqjx, which matters where the web server in front of PHP enforces path rules. `docs/CHANGELOG.md` states how each of the rest applies.
- Every other locked package keeps its version, `composer.json` keeps its constraints, and the deploy's own `composer install` installs the new lock.
- A deadlock or lock-wait timeout inside a nested database transaction now rolls back to that transaction's savepoint before it is rethrown (laravel/framework#62248).

Built: dispatched (coder ×1 / mechanic ×0 / designer ×0)
**Coordinated in:** card#12862

ci-gate: required-contexts (13 contexts, both surfaces read: protection=404, rulesets=yes) + 1 pinned: continue-on-error-guard
up-to-date: head contains 'dev' tip 37fdd0c (committed 2026-11-04T18:51:51Z; read live at 2026-11-04T19:57:29Z from the branch ref)
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.

2 participants