COLLADA (.dae) models intermittently fail to load: "Extra content at the end of the document" #35

Closed
opened 2026-11-16 20:44:57 +00:00 by claude · 1 comment
Member

Found while testing #29 headlessly on 2026-11-16.

Symptom: valid .dae files sometimes fail with

Error: Extra content at the end of the document
Error: Failed to load XML document from memory
Load failed in COLLADA DOM
Failed to load 'meshes/ashlar_ledge.dae': ... code 3, using marker_error instead

It's intermittent. In the Game Template the player body meshes/basicplayerbody.dae failed in 2 of 3 runs before the fix, and the byte-identical test box loaded in SCENARIO=mantle but failed in both SCENARIO=camera runs. A failed model falls back to marker_error, which has no collision, so scenario checks that rely on it fail as well.

Cause (as best I can tell): OSG 3.6.5's dae plugin readNode(std::istream&) copies the stream into a buffer with no terminating NUL and passes it to collada-dom, which parses it as a C string. Whatever bytes follow in memory become "extra content". I didn't have the OSG plugin source in the build image to confirm the line, so this is from memory of that code plus the symptoms.

Fix: Resource::loadNonNif in components/resource/scenemanager.cpp now reads a .dae stream into a string, appends a NUL and hands the plugin an istringstream of that. Non-COLLADA formats are unchanged. This is game-neutral and could go upstream.

Acceptance: three SCENARIO=camera runs and a default boot with zero .dae load failures, and the player body renders instead of the error marker.

Found while testing #29 headlessly on 2026-11-16. **Symptom:** valid `.dae` files sometimes fail with ``` Error: Extra content at the end of the document Error: Failed to load XML document from memory Load failed in COLLADA DOM Failed to load 'meshes/ashlar_ledge.dae': ... code 3, using marker_error instead ``` It's intermittent. In the Game Template the player body `meshes/basicplayerbody.dae` failed in 2 of 3 runs before the fix, and the byte-identical test box loaded in `SCENARIO=mantle` but failed in both `SCENARIO=camera` runs. A failed model falls back to `marker_error`, which has no collision, so scenario checks that rely on it fail as well. **Cause (as best I can tell):** OSG 3.6.5's dae plugin `readNode(std::istream&)` copies the stream into a buffer with no terminating NUL and passes it to collada-dom, which parses it as a C string. Whatever bytes follow in memory become "extra content". I didn't have the OSG plugin source in the build image to confirm the line, so this is from memory of that code plus the symptoms. **Fix:** `Resource::loadNonNif` in `components/resource/scenemanager.cpp` now reads a `.dae` stream into a string, appends a NUL and hands the plugin an `istringstream` of that. Non-COLLADA formats are unchanged. This is game-neutral and could go upstream. **Acceptance:** three `SCENARIO=camera` runs and a default boot with zero `.dae` load failures, and the player body renders instead of the error marker.
claude added this to the 1. Baseline milestone 2026-11-16 20:44:57 +00:00
claude added the
type
bug
priority
high
labels 2026-11-16 20:44:57 +00:00
eric closed this issue 2026-11-16 20:45:15 +00:00
Author
Member

Fixed in 76d1796e6c. After the fix: three SCENARIO=camera runs and the default boot had zero .dae load failures, against one or two per run before. The Game Template's player body now renders instead of the error marker. Unit tests pass (1644 and 637). There's no dedicated unit test, because loading a DAE needs the OSG plugin and a scene manager; the scenarios cover it.

Fixed in `76d1796e6c`. After the fix: three `SCENARIO=camera` runs and the default boot had zero `.dae` load failures, against one or two per run before. The Game Template's player body now renders instead of the error marker. Unit tests pass (1644 and 637). There's no dedicated unit test, because loading a DAE needs the OSG plugin and a scene manager; the scenarios cover it.
eric referenced this issue from a commit 2026-11-16 20:45:38 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: Gaming/ashlar#35