FileLoader with ArrayBuffer high loading frequency leads to DOMException

Description of the problem

#12458 “Fix FileLoader duplicate request issues” seems to have introduced a new problem. When the same file is loaded with high frequency and ArrayBuffers are used then this message is likely to appear:

Uncaught DOMException ... ArrayBuffer at index 0 is already neutered.

You can reproduce this easily with example webgl_loader_obj2_run_director. Select a high worker count; minimum 4 better 8 or 12. Watch the log for the appearance of the error. Due to the DOMException the worker feed gets stalled.

When I revert to r87 the issue is gone. I have a potential fix, but I am not 100%% sure why it works:
https://github.com/kaisalmen/three.js/blob/FileLoaderRegression/src/loaders/FileLoader.js

I made loading a member of FileLoader and I think due to the now existing dependency memory of the two objects is no longer released independently. @takahirox do you mind have a look?

Kai

Three.js version
  • Dev
  • r89
  • r88
Browser
  • All of them
OS
  • All of them
Hardware Requirements (graphics card, VR Device, …)

Author: Fantashit

2 thoughts on “FileLoader with ArrayBuffer high loading frequency leads to DOMException

  1. @takahirox @mrdoob I have a fix available for WorkerSupport / WorkerDirector. You can now set boolean forceWorkerDataCopy. It will copy the ArrayBuffer before it is sent off to the Worker. I made this switchable as it is not always necessary. Nice result of the code review and fix for WorkerSupport / WorkerDirector is that the parallels demo is now able to use 100%% CPU (all eight logical cores on my box 👍 )

    Larger PR for this problem, OBJLoader2 Parser optimization and LoaderSupport clean-up will come later this week. Need to update examples and documentation.

    Edit: PR is here now: #13524

Comments are closed.