Commit 133cd4f
fix: use update_file() instead of full scan() on single-file writes (#508)
script_create, script_patch, and filesystem write_text each triggered a full
recursive EditorInterface.get_resource_filesystem().scan() per write. Under
concurrent file creation (e.g. multiple MCP clients, or a stress run) these
scans stack: the editor re-enqueues the update_scripts_classes /
update_script_paths_documentation WorkerThreadPool tasks while a previous scan
is still pending, emitting "Task '...' already exists" / Condition
"!tasks.has(p_task)" is true, and the global-class registry is left
inconsistent. The next idle filesystem scan can then SIGABRT in
ScriptServer::remove_global_class_by_path() — a hard editor crash.
Switch all three sites to EditorFileSystem.update_file(path), the single-file
registration call the rest of the plugin already uses (material/theme handlers,
filesystem reimport, resource_io). It registers just the written file without
the recursive scan-action batch, so the duplicate-task race can't occur.
Validated with a concurrency stress harness:
- before (full scan): 5x "Task ... already exists" + 5x "!tasks.has(p_task)"
per run, intermittently escalating to the SIGABRT (3 crash reports).
- after (update_file): 0 of those engine errors across heavier runs, no crash.
- create -> immediate attach still settles (import_settled=true), so the #261
import-settle behaviour is preserved.
- GDScript script (38) + filesystem (16) suites pass; Python import-settle (6)
+ script/filesystem unit tests (67) pass.
Engine-side record of the underlying abort: dsarno/godot#6.
Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>1 parent 782397f commit 133cd4f
2 files changed
Lines changed: 21 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
57 | 57 | | |
58 | 58 | | |
59 | 59 | | |
60 | | - | |
61 | | - | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
62 | 67 | | |
63 | 68 | | |
64 | 69 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
50 | 50 | | |
51 | 51 | | |
52 | 52 | | |
53 | | - | |
54 | | - | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
55 | 63 | | |
56 | 64 | | |
57 | 65 | | |
| |||
206 | 214 | | |
207 | 215 | | |
208 | 216 | | |
209 | | - | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
210 | 221 | | |
211 | 222 | | |
212 | 223 | | |
| |||
0 commit comments