microsoft / microsoft/json-document-transforms

Concurrent transforms with the same source and/or transform file can fail

Open
#21 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
PowerShell
Stars
115
Forks
39
PR merge metrics
No merged PRs in 30d

Description

When using slow cheetah to transform json files we discovered that the transforms would fail intermittently. This was particularly frequent when building a project targeting multiple frameworks (net461 and netcore2.1 in this instance). The parallel build behaviour of msbuild meant it would regularly attempt to perform the same transforms at the same time (once for each target framework).

This would result in msbuild output similar to:

[17:52:50] [Step 6/12]      2>UpdateLocalAppSettings:
[17:52:50] [Step 6/12]          Beginning transformation.
[17:52:50] [Step 6/12]     15>UpdateLocalAppSettings:
[17:52:50] [Step 6/12]          Beginning transformation.
[17:52:50] [Step 6/12]          Transformation failed.

This seems to be caused by the source file being opened with exclusive access for the duration of the transform. The files need to be opened with a FileShare mode of Read to allow concurrent transformations.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Locate the code that opens the source and transform files during JSON transformation, then inspect how parallel MSBuild executions share those handles. Reproduce the issue with a multi-target parallel build and verify that concurrent transformations complete without intermittent failures when files permit shared reads.

Written by the indexing model from the issue text.

Assessment

Tech stack
powershell
Domain
build-system, tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
50/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.