donmccurdy / glTF-Transform

glTF 2.0 SDK for JavaScript and TypeScript, on Web and Node.js.
https://gltf-transform.dev
MIT License
1.43k stars 150 forks source link

Resampling fails with `Maximum call stack size exceeded` #1572

Closed 4nte closed 12 hours ago

4nte commented 12 hours ago

Describe the bug

I've tried to resample a glb file with gltf-transform resample, the file contains hundreds of animations (file size ~490mb) Github doesn't allow uploading files larger than 25MB so I uploaded it here: ct_anim.glb.zip

I also tried to increasing node's maximum stack size incrementally up until I reached a hard limit where it would segmentation fault. This makes me suspicious of an infinite loop in the implementation

To Reproduce

  1. run gltf-transform resample animset_ct.glb animset_ct_optimized.glb --verbose
  2. see error: error: Maximum call stack size exceeded

Expected behavior I expect the program to succeed

Versions:

Additional context I have a fairly decent machine (AMD® Ryzen 7 7700x 8-core processor × 16, 64gb ram) so I assume my computer is not the bottleneck.

4nte commented 12 hours ago

This is interesting: When I run sparse before resample, the error doesn't occur. It still requires me to inrcease node's max call stack up to 10000 or it will fail

  1. gltf-transform sparse animset_ct.glb animset_ct_sparse.glb
  2. gltf-transform sparse animset_ct_sparse.glb animset_ct_sparse_resample.glb
donmccurdy commented 2 hours ago

Hm, that error shouldn't happen! Thanks for letting me know – let's keep this open and I'll take a look.