You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ofbiz.apache.org by "diveshdut (via GitHub)" <gi...@apache.org> on 2026/07/22 05:51:25 UTC
[PR] Mrp requirement status fk [ofbiz-framework]
diveshdut opened a new pull request, #1480:
URL: https://github.com/apache/ofbiz-framework/pull/1480
## Summary
This fixes a timing-dependent foreign-key failure during requirement status creation.
When `createRequirement` runs inside a larger transaction, its async SECA can invoke `createRequirementStatus` before the enclosing transaction has fully committed. In that window, the new `Requirement` row is not yet visible, and the `RequirementStatus` insert can fail with:
`REQ_STTS_REQ: OFBIZ.REQUIREMENT_STATUS FOREIGN KEY(REQUIREMENT_ID) REFERENCES OFBIZ.REQUIREMENT(REQUIREMENT_ID)`
This was observed from the Manufacturing `Run MRP` flow, but the underlying bug is in the order-side requirement status SECA behavior.
## Root Cause
The existing `createRequirement` SECA used `event="commit"` with `mode="async"`.
That is not a safe boundary when `createRequirement` participates in an outer transaction. The async follow-up may run before the outer transaction is committed and globally visible.
This is a race condition rather than a deterministic logic error.
## Changes
- changed the `createRequirement` status SECA to `global-commit-post-run`
- changed the `updateRequirement` status SECA to `global-commit`
- added a focused order-side regression test for the outer-transaction scenario
- registered the regression test in the order test suite
## Why `global-commit-post-run`
`createRequirementStatus` needs the generated `requirementId`.
`global-commit-post-run` ensures:
- the enclosing transaction has committed
- the generated service output is still available to the follow-up async action
## Tests
Added a focused regression test for the outer-transaction timing case:
- `RequirementStatusEcaTests.testCreateRequirementStatusAfterOuterTransactionCommit`
This verifies that:
- `createRequirement` can run inside an outer transaction
- `RequirementStatus` is not created before commit
- `RequirementStatus` is created successfully after commit
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@ofbiz.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] OFBIZ-13461 : Avoid async RequirementStatus FK race after createRequirement [ofbiz-framework]
Posted by "diveshdut (via GitHub)" <gi...@apache.org>.
diveshdut merged PR #1480:
URL: https://github.com/apache/ofbiz-framework/pull/1480
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@ofbiz.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org