Repository navigation
Description
Affected module
Backend
Describe the bug
When an assets/add for a Data Product races the DELETE of that same Data Product, a row describing the product's relationship to the asset can survive in entity_relationship with no backing entity at the fromId end -- the delete tears the entity down while the concurrent add writes the edge just after. The dangling row is:
- not returned by
GET /api/v1/dataProducts/{id}(404), - not returned even with
?include=deleted(404 -- so the entity is genuinely gone, not soft-deleted), - not listable or deletable through any API surface we could find,
- yet still resolvable enough that any
PUT /api/v1/dataProducts/{fqn}/assets/addinvolving the linked asset fails with an opaquenot_foundnaming the deleted product's UUID.
We call these "ghost" data products. Because the only way to observe one is to have a bulk asset-add fail against it, they accumulate silently, and the only remediation we have found is a direct DELETE FROM entity_relationship against the database.
Concrete instance (OM 1.12.8, Postgres):
- Ghost data product UUID
ca3fc4f7-23e7-467e-9456-04bdba4af9a5. GET /api/v1/dataProducts/ca3fc4f7-.../->404 {"code":404,"message":"HTTP 404 Not Found"}.GET /api/v1/dataProducts/ca3fc4f7-.../?include=deleted->404(entity fully gone, notdeleted=true).- The relationship poisoned
assets/add280 times before we built tooling to identify it. - Adding the linked asset makes OM resolve the relationship, find no entity at
fromId, and returnnot_foundfor the ghost UUID. No get/list/delete API surface exposes the edge.
Impact: a single ghost poisons every asset linked to its dangling edge; the bulk add returns those assets as rejected with a not_found for a UUID the caller cannot resolve, list, or delete. There is no API-driven detection or remediation, and the error gives no signal that it is an orphaned relationship rather than a transient failure.
Repro lab & repro case: https://gist.github.com/jamiejackson/83102f25a66e882ec97b1b18b1c6e142
Related cleanup feature request: #33742
To Reproduce
The orphan is born from a race between assets/add and DELETE of the same Data Product, not from any particular delete mode. We reproduced it deterministically in a single-node Docker lab (prebuilt images, Postgres backend): concurrent add + delete orphaned the asset edge on 8/8 iterations. A plain soft delete in isolation, and hardDelete=true&recursive=true in isolation, were both clean -- so the trigger is the overlap, not the flag.
Setup notes for 1.12.x (so the steps actually run):
CreateDataProducttakesdomains: [<name>](plural array), notdomain.- An asset only attaches if it already shares the Data Product's domain (a "Data Product Domain Validation" rule rejects the add otherwise), so set the asset's domain first.
Steps:
- Create a domain, a database service/database/schema, and one table in that domain.
- Create a Data Product in the same domain.
- Fire
PUT /api/v1/dataProducts/{fqn}/assets/add(adding the table) andDELETE /api/v1/dataProducts/{id}concurrently (a soft delete is enough). - Repeat a handful of times.
- Observe an orphan: a row in
entity_relationshipwithfromEntity='dataProduct'for whichdata_product_entityhas no row. That id then 404s onGET, onGET ?include=deleted, onGET ?include=all, and onDELETE ?hardDelete=true-- yet any laterassets/addtouching the linked asset fails with an opaquenot_foundnaming that id.
This matches our production trigger: a client that fans assets/add out over parallel workers while a create-rollback DELETE can land in the same window (which is exactly what our bulk-add client does).
Expected behavior
No relationship row should outlive the entity on either end. Deleting a Data Product must not leave an entity_relationship row behind, and a concurrent assets/add must not be able to write an edge for a Data Product that is being (or has been) deleted -- the delete and the add need to be serialized or the add rejected, so no edge lands after the entity is gone. Failing that, asset-add resolution should skip a relationship whose entity no longer resolves instead of returning an opaque not_found, and a bulk add should never be blockable by a reference the API itself cannot resolve.
OS
Docker
Python version
No response
OpenMetadata version
1.12.8, 1.12.14
OpenMetadata Ingestion package version
No response
Additional context
Backend is Postgres. Note hardDelete=true&recursive=true does not prevent this -- in the lab it is clean only absent the race; a concurrent add still orphans the edge. So a "always hard-delete" client contract is not the fix; the fix is on the concurrency/ordering path (or reaping edges whose entity is gone). Operability follow-up filed separately (link the enhancement issue here once opened).
Pre-submission checklist
- I searched for duplicate issues.
- I removed credentials, hostnames, emails, and other sensitive data from logs and config.
Activity
zhang-arvin commentedon Sep 22, 2026
Hi @zhang-arvin here — I'd like to work on this.
The dangling
entity_relationshiprow is the classic delete-vs-add race: theDELETEtears the entity down while the concurrentassets/addwrites the edge just after, with no FK/liveness check onfromId. Plan: re-validate thefromIdentity under the same lock/transaction as the edge write (and drop the edge instead of persisting it when the entity is gone), plus a cleanup path so already-orphaned rows become reachable or removable rather than poisoningassets/addwith an opaquenot_found.Please assign this to me if that's convenient.
jamiejackson commentedon Oct 5, 2026
@zhang-arvin , could you give a lay explanation of the status of the fix, please? (Either here or in the fix thread.)
The existing responses in the fix thread are confusing since they deal with peculiarities of the pipeline that I'm not familiar with.
Fix open-metadata#33741: never persist entity_relationship edges for …
Revert the guarded relationship insert for open-metadata#33741
Fixes open-metadata#33741: lock the data product so a concurrent asse…
Fixes open-metadata#33741: lock the data product so a concurrent asse…
Fixes #33741: lock the data product so a concurrent assets/add cannot…