Skip to content

Race condition because zen push db creates a temporal file with a fixed name #2491

@jesus-gomez-aetonix

Description

@jesus-gomez-aetonix

Description and expected behavior
zen push db creates a temporal file named ~schema.prisma. Running that command in parallel cause a race condition.

Simulation

$ echo `line 1` > zenstack/~schema.prisma # Process 1
$ zen db push # Process 2
$ echo `line 2` >> zenstack/~schema.prisma # Process 1
$ cat zenstack/~schema.prisma

The output is:

line 2

The expected output was:

line 1
line 2

Environment (please complete the following information):

  • ZenStack version: 3.4.6
  • Database type: PostgreSQL
  • Node.js/Bun version: v22.17.1
  • Package manager: yarn

Additional context
We run parallel tests with parallel containers for the databases. But the test runner itself is running in the same single shell, so it causes the race condition.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions