Skip to content

cfenv function calls are competing to handle the same temporary file #40

@AkihiroKitada

Description

@AkihiroKitada

Please suppose that there are multiple cfenv function calls in the same host at the same time - in the specific cases, for examples, Concourse CI kicks multiple cfenv function calls in the same virtual machine.

Sometimes one of the cfenv function calls fails with the following error.

ENOENT: no such file or directory, rename '/root/.ports.json.tmp' -> '/root/.ports.json'

16 | const service = appEnv.getService(name);
17 | return service && service.credentials;
> 18 | };
| ^
19 | 

at write_json (node_modules/ports/index.js:54:6)
at Object.getPort (node_modules/ports/index.js:40:3)
at getPort (node_modules/cfenv/lib/cfenv.js:224:32)
at new AppEnv (node_modules/cfenv/lib/cfenv.js:45:19)
at Object.<anonymous>.cfenv.getAppEnv (node_modules/cfenv/lib/cfenv.js:23:12)
at Object.<anonymous> (../common/env.ts:18:3)

It seems that one cfenv function call has deleted the temporary json file while another tries to rename the same temporary json file.

Please consider to fix this 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