Skip to content

Race condition in directory.createOrOpen #87

@aikoven

Description

@aikoven

When attempting to call directory.createOrOpen for a non-existent directory multiple times in a single transaction in parallel, two different subspaces are created. Only one of them gets referenced by the directory path. The other one becomes orphan.

Reproduction code:

const foundationdb = open();

const [dir1, dir2] = await foundationdb.doTransaction(tn =>
  Promise.all([
    directory.createOrOpen(tn, ['test']),
    directory.createOrOpen(tn, ['test']),
  ]),
);

expect(dir1.content.prefix).toEqual(dir2.content.prefix);  // fails

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions