Commit 782a9c6
[ddev] Atomic config swap to avoid autodiscovery deregister race
The `--config-file` path of `ddev env agent` previously renamed the original
config away before writing the override, leaving a window in which the
mounted conf.d directory had no config for the integration. Agent
autodiscovery rescans on file events; if it scanned during that window it
deregistered the check, and the immediately-following `agent check <name>`
returned "no valid check found".
This is the actual SNMP master.yml flake fingerprint: agent runs cleanly for
10+ minutes (20-30 successful check cycles), then a single test using
`dd_agent_check` (which goes through this code path) hits the race and
fails. Two of the last three master.yml SNMP failures match it exactly.
Switch to read-modify-restore in place. `EnvData.write_config` now writes
via tmp + os.replace so the file is never transiently absent.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent 996b3d5 commit 782a9c6
2 files changed
Lines changed: 17 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
71 | 71 | | |
72 | 72 | | |
73 | 73 | | |
74 | | - | |
75 | | - | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
76 | 81 | | |
77 | 82 | | |
78 | 83 | | |
79 | 84 | | |
80 | | - | |
| 85 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
42 | 42 | | |
43 | 43 | | |
44 | 44 | | |
| 45 | + | |
| 46 | + | |
45 | 47 | | |
46 | 48 | | |
47 | 49 | | |
48 | 50 | | |
49 | 51 | | |
50 | 52 | | |
51 | | - | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
52 | 60 | | |
53 | 61 | | |
54 | 62 | | |
| |||
0 commit comments