[baseimage] Avoid race condition in sonic-platform-common #3457
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Both python2 and python3 wheels being built out of the same
source directory can interfere with each other when
SONIC_BUILD_JOBS > 1.
Signed-off-by: Greg Paussa greg.paussa@broadcom.com
- What I did
Resolved a build-time race condition between the python2 and python3 targets for the src/sonic-platform-common package. This issue can randomly occur when SONIC_BUILD_JOBS is greater than 1 (I'm using 8), and manifests itself as an error in either of the target/python-wheels/sonic_platform_common-1.0-py2-none-any.whl or target/python-wheels/sonic_platform_common-1.0-py3-none-any.whl targets.
The exact error reported in the corresponding .log file varies, but here is one example:
- How I did it
Added the following _DEPENDS statement to rules/sonic-platform-common.mk, ensuring python3 is built after python2 is complete:
This change is patterned after a similar statement in rules/swsssdk-py3.mk that addressed a previous race condition in that package.
- How to verify it
Note: In steps 3 and 4, substitute whatever target image file name corresponds to the configured .platform.
Without the fix, either py2 or py3 fails to build. With the fix, py2 always builds before py3.
- Description for the changelog
Avoid race condition in src/sonic-platform-common when building multiple sub-targets in parallel.
- A picture of a cute animal (not mandatory but encouraged)