[code sync] Merge code from sonic-net/sonic-buildimage:202605 to 202608 - #3142
Merged
Merged
Conversation
mssonicbld
commented
Sep 18, 2026
Collaborator
…atically (#29549) #### Why I did it src/sonic-utilities ``` * 63a3fc57 - (HEAD -> 202605, origin/202605) Merge pull request #4825 from yizhenzha/counterpoll-completion-fix-202605 (2 days ago) [Vaibhav Hemant Dixit] * df2967f5 - [counterpoll] Fix bash tab-completion by not requiring CONFIG_DB at import (2 weeks ago) [Yizhen Zhang] ``` #### How I did it #### How to verify it #### Description for the changelog
…lly (#29600) Signed-off-by: mssonicbld <sonicbld@microsoft.com>
…#29526)
#### Why I did it
Follow-up to #25121, which bumped the fixed delay in `waitForAllInstanceDatabaseConfigJsonFilesReady()` from 1s to 5s to work around:
```
sonic-db-cli: :- parseDatabaseConfig: Sonic database config file syntax error >> [json.exception.parse_error.101] parse error at line 1, column 1: syntax error while parsing value - unexpected end of input; expected '[', '{', or a literal
```
We are still seeing this failure on some devices even after the 5 second delay, since a fixed sleep only narrows the race window rather than eliminating it.
**Root cause**: `docker-database-init.sh` renders `database_config.json` / `database_global.json` with:
```
jinjanate template.j2 > $REDIS_DIR/sonic-db/database_config.json
```
The `>` redirect truncates/creates the destination file *before* the renderer produces any output. `waitForAllInstanceDatabaseConfigJsonFilesReady()` only checks `[ -f $file ]`, so it can observe the file as "ready" while it's still empty or partially written, causing the JSON parse error. A longer sleep just makes the window rarer, not impossible.
#### How I did it
1. `dockers/docker-database/docker-database-init.sh`: render `database_config.json` and `database_global.json` to a `.tmp` file first, then atomically `mv` into place. Readers can never observe a truncated/partial file.
2. `files/build_templates/docker_image_ctl.j2`: replace the fixed `sleep 5` with `waitForFileToBeValidJson()`, which polls (0.2s interval, 30s cap) until each file exists **and** parses as valid JSON, rather than assuming a fixed delay is long enough. This removes the wasted delay on fast devices and removes the failure on slow devices.
#### How to verify it
Built and booted a multi-ASIC image with an artificially slowed-down j2 render (`sleep` inserted before the template renders) and confirmed `database.sh`/`sonic-db-cli` no longer log the JSON parse error, and that the wait exits as soon as the files are valid instead of always waiting the full delay.
#### Which release branch to backport (provide reason below if selected)
- [ ] 202411
- [ ] 202505
- [ ] 202511
Backport reason: fixes an intermittent syslog error on slow-NPU devices seen on release branches after #25121.
Signed-off-by: Sonic Build Admin <sonicbld@microsoft.com>
…530) #### Why I did it Commit 2909a8a (#23978) adds an explicit `"fec": "rs"` to every port entry generated from `platform.json` / `hwsku.json` whose speed per lane is at least 50G. On Mellanox platforms the generated port configuration should not carry a FEC mode, so exclude them from that change while keeping the current behavior for every other platform. ##### Work item tracking - Microsoft ADO **(number only)**: N/A #### How I did it Added one condition to the existing check in `BreakoutCfg.get_config()` in `src/sonic-config-engine/portconfig.py`, so the `fec` key is skipped when the `asic_type` read from `/etc/sonic/sonic_version.yml` is `mellanox`. When that file is not present, as in the build and unit test container, the current behavior is kept, so the tests added by #23978 are unaffected. #### How to verify it On a Mellanox switch, generate the port table from the device files: ``` sonic-cfggen -k <hwsku> -p platform.json -S hwsku.json --print-data ``` No port carries a `fec` key, and `config interface breakout` produces child ports without one. On any other platform the output is unchanged and still contains `"fec": "rs"`. Checked on an SN5640: 0 of 514 ports carry `fec` with the change, against 512 of 514 without it, and no other field differs. #### Which release branch to backport (provide reason below if selected) - [ ] 202205 - [ ] 202211 - [ ] 202305 - [ ] 202311 - [ ] 202405 - [ ] 202411 - [ ] 202505 - [ ] 202511 - [x] 202605 #### Description for the changelog Exclude Mellanox from the default FEC mode in the generated port configuration. Signed-off-by: Sonic Build Admin <sonicbld@microsoft.com>
|
Azure Pipelines: There may be pipelines that require an authorized user to comment /azp run to run. |
Collaborator
Author
|
/azp run |
|
Azure Pipelines: Successfully started running 1 pipeline(s). |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.