Skip to content

async().updateRecord() never validates, so an async update persists a record violating MANDATORY/NOTNULL with no error #7002

Closed

Description

@ruispereira

Summary

async().updateRecord() never calls document.validate(), so an asynchronous update persists a record that violates its schema. The synchronous paths all validate. The record ends up with a MANDATORY, NOTNULL property set to null, and no error reaches the caller or the error callback.

Where (HEAD 8cfac2923)

The synchronous paths validate - engine/src/main/java/com/arcadedb/database/LocalDatabase.java:1150, :1265, :1352:

doc.validate();

engine/src/main/java/com/arcadedb/database/async/DatabaseAsyncUpdateRecord.java has no validate() call at all (grep validate returns nothing).

Repro

Verified at 8cfac2923. Type P with name declared MANDATORY and NOTNULL, one record saved.

Synchronous control - remove the mandatory property and save:

db.transaction(() -> {
  MutableDocument d = rid.asDocument().modify();
  d.set("v", 2); d.remove("name"); d.save();
});
rejeitado: ValidationException          <- correct

The same edit through the async API:

db.begin();
MutableDocument d = rid.asDocument().modify();
d.set("v", 3); d.remove("name");
db.async().updateRecord(d, r -> ...);
db.async().waitCompletion();
db.commit();
erro do callback: (nenhum)
estado final:     {"name":null,"v":3}
MANDATORY 'name' ainda presente? false

So the schema constraint is silently bypassed, an onError handler registered on the executor sees nothing, and the database is left holding a record the synchronous API would have refused to write. A later read through any path that trusts the schema (a NOTNULL assumption in a projection, an index on name) now sees a value the schema says cannot exist.

Suggested fix

Call document.validate() in DatabaseAsyncUpdateRecord before the update, matching the three synchronous sites, and route the resulting ValidationException through the task's existing error callback so the caller learns about it. Worth checking the sibling async task classes for the same omission in the same pass - the pattern here is that each async task re-implements a slice of the synchronous path and can drift from it.

Scope / confidence

High - reproduced, with the synchronous path as the control in the same run.

Activity

  1. added
    engine
    concurrency
    on Sep 1, 2026
  2. added this to the 26.9.1 milestone on Sep 1, 2026
  3. added
    in progress
    on Sep 3, 2026
  4. self-assigned this
    on Sep 3, 2026
  5. lvca commented on Sep 3, 2026

    @lvca
    Member

    Fixed in #7092 (26.9.1). async().updateRecord() now validates the document like the synchronous update: a MANDATORY/NOTNULL violation is rejected, the record is left untouched, and the error reaches both the task's error callback and the executor's onError handler.


    ❤️ Thanks for helping make ArcadeDB better! ArcadeDB is free and open source, sustained by its community. If it's useful to you or your company, please consider becoming a sponsor to keep development going.

  6. removed
    in progress
    on Sep 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugconcurrencyengine

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions