Skip to content

fix file related race conditions - #6

Merged
Ryanf55 merged 2 commits into
ArduPilot:masterfrom
tpwrules:pr/temp-race
Sep 4, 2025
Merged

Ryanf55 merged 2 commits into
ArduPilot:masterfrom
tpwrules:pr/temp-race

Conversation

@tpwrules

@tpwrules tpwrules commented Sep 4, 2025 •

Copy link
Copy Markdown

Please see commits for details.

Tested with the ArduPilot codebase that everything works and is reliable. This should fix the DDS CI.

The temporary names used as preprocessor output are not unique, so if
another generator instance is running, one can be writing into a file
while the other is reading it. This usually manifests as an error like
`<some_file.idl>:1:0: error: mismatched input '<EOF>' expecting <etc>`.

Fix by randomly generating a unique directory, plus being nice and
cleaning it up if it is unlikely to be useful.

Note that specifying a temporary directory is not actually implemented,
despite a flag to do so being listed in the help.
Two generators may be working in the same directory and writing the same
dependent file. There is no guarantee that two programs opening the same
path and writing into it will produce a coherent result.

Fix by writing into a temporary file, then atomically renaming over the
destination, so one complete file always exists.

This has not been tested on Windows, and may not work right if two
generators are intending to write different contents to the file.
@Ryanf55
Ryanf55 merged commit f5b9677 into ArduPilot:master Sep 4, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants