Commit 76b129a
committed
fix: Resolve race condition in concurrent Transaction initialization
Implement a double-checked locking pattern in and methods.
When multiple threads attempt to use a lazy transaction simultaneously, they race to acquire the lock.
Previously, losing threads would acquire the lock and blindly send another 'begin transaction' request,
ignoring that the winner had already initialized the transaction ID.
This change ensures that threads re-check after acquiring the lock.
If the ID is present, they skip the initialization request and use the established ID.1 parent 133ead1 commit 76b129a
2 files changed
+10
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
638 | 638 | | |
639 | 639 | | |
640 | 640 | | |
| 641 | + | |
| 642 | + | |
| 643 | + | |
| 644 | + | |
641 | 645 | | |
642 | 646 | | |
643 | 647 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
512 | 512 | | |
513 | 513 | | |
514 | 514 | | |
| 515 | + | |
| 516 | + | |
| 517 | + | |
515 | 518 | | |
516 | 519 | | |
517 | 520 | | |
| |||
670 | 673 | | |
671 | 674 | | |
672 | 675 | | |
| 676 | + | |
| 677 | + | |
| 678 | + | |
673 | 679 | | |
674 | 680 | | |
675 | 681 | | |
| |||
0 commit comments