CesiumGS/obj2gltf

Lines keep processing after Normal index 2412 is out of bounds Error causing Socket hanging

Apidcloud opened this issue · 0 comments

Hello!

Uploading the file attached below ends up making the server hang. After a few seconds there's an actual error "Normal index 2412 is out of bounds Error", but it still hangs the whole server -- so future requests never complete. Might be related to #287

Here's a minimum reproduction repo:
https://github.com/Apidcloud/nestjs-sigbus-example/tree/obj-hanging

To test it:

  • clone or download the repo (in obj-hanging branch) above
  • npm ci
  • npm run start:dev
  • curl localhost:3000/hello -- to check the server is running locally and you are able to reach it
  • curl localhost:3000 -- after a few seconds this will reply with the error "Normal index 2412 is out of bounds Error"
  • curl localhost:3000/hello -- never completes because the server is completely hanging

From what I can understand, even after the error is thrown, the lines keep being processed:
image

And actually even before that is thrown, the reject keeps being called interchangeably with also this error "Expected cartesian to be typeof object, actual typeof was undefined":

Error: 
    at new DeveloperError (/Users/ee/workspace/Git/Gitlab/sigbus-nestjs-example/node_modules/cesium/Build/CesiumUnminified/index.cjs:15553:11)
    at Object.Check.typeOf.object (/Users/ee/workspace/Git/Gitlab/sigbus-nestjs-example/node_modules/cesium/Build/CesiumUnminified/index.cjs:15647:11)
    at Function.Cartesian3.normalize (/Users/ee/workspace/Git/Gitlab/sigbus-nestjs-example/node_modules/cesium/Build/CesiumUnminified/index.cjs:17104:24)
    at Object.CoplanarPolygonGeometryLibrary.computeProjectTo2DArguments (/Users/ee/workspace/Git/Gitlab/sigbus-nestjs-example/node_modules/cesium/Build/CesiumUnminified/index.cjs:117378:22)
    at addFace (/Users/ee/workspace/Git/Gitlab/sigbus-nestjs-example/node_modules/obj2gltf/lib/loadObj.js:381:40)
    at parseLine (/Users/ee/workspace/Git/Gitlab/sigbus-nestjs-example/node_modules/obj2gltf/lib/loadObj.js:480:11)
    at Interface.callbackWrapper (/Users/ee/workspace/Git/Gitlab/sigbus-nestjs-example/node_modules/obj2gltf/lib/readLines.js:32:11)
    at Interface.emit (node:events:517:28)
    at Interface.[_onLine] [as _onLine] (node:internal/readline/interface:423:12)
    at Interface.[_normalWrite] [as _normalWrite] (node:internal/readline/interface:617:22)
    at ReadStream.ondata (node:internal/readline/interface:250:23)
    at ReadStream.emit (node:events:517:28)
    at addChunk (node:internal/streams/readable:335:12)
    at readableAddChunk (node:internal/streams/readable:308:9)
    at ReadStream.Readable.push (node:internal/streams/readable:245:10)
    at node:internal/fs/streams:277:14 {
  message: 'Expected cartesian to be typeof object, actual typeof was undefined'
}

The very first error shows up at normal 2412 (and you can see it keeps reading and rejecting):
image

faulty.obj.zip