Skip to content

FileManager.dropFile clears maps before file.drop(), orphans on failure #4711

Description

@ruispereira

Affected version: 26.4.2 (confirmed still present in 26.5.1)
Component: com.arcadedb.engine.FileManager
Severity: LOW

Summary

final ComponentFile file = fileIdMap.remove(fileId);
if (file != null) {
  fileNameMap.remove(file.getComponentName());
  files.set(fileId, null);
  file.drop();                                       // may throw
  …
}

If file.drop() throws, maps are already cleared but the underlying
OS file may still exist (and the PageManager read cache has not been
told).

Code reference

engine/com/arcadedb/engine/FileManager.java:132–148

Impact

Orphan file on disk; future opens of the database see an unexpected
file; recovery may complain about a file id no schema entry references.

Suggested fix

Call file.drop() first, then update maps. On failure, leave the maps
untouched so a retry is possible.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

Fields

No fields configured for Bug.

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions