Assets from file not loaded under certain network/browser conditions

Hi all,
I developed all locally with a node.js simple webserver where all worked fine. Then I moved it to my remote server and the following root page loads well on Firefox but not on Chrome.

ERROR:
logger.ts:103 BJS - [23:39:31]: Unable to load from https://nostromophoto.com/virtual/root.babylon: loadAssets of undefined from undefined version: undefined, exporter version: undefinedimportScene has failed JSON parse

Link:
https://nostromophoto.com/virtual/virtual_gallery.html

The error happens under the call to:
BABYLON.SceneLoader.LoadAssetContainer

Any help will be highly appreciated,
LB

EDITED:
It seems the issue of the browser is not really at the root cause. Loading a large asset file (.babylon) with slower networks causes the connection to finish prematurely and triggering the BJS error

looks like it works for me in Chrome:

How do you repro ?

Sorry, dont know what you mean by repro :face_with_raised_eyebrow:
Actually you are right, tried from my another laptop and it loaded with chrome. Checked with a colleague having the same software setup and for her it did not work out. Any clue how to make sense of this?

I use Version 108.0.5359.99 (Official Build) (64-bit) but i dont think that would make much of a difference

I noticed too that if you get in the “pakistan” gallery it will trigger the same error as well for Firefox and Safari.

It does not seem environment related weirdly :frowning: Maybe @RaananW would have some ideas ?

Do you see anything else on the console ?

Nothing else. This is the whole stack info:

babylon.js:1 BJS - [21:05:48]: Unable to load from https://nostromophoto.com/virtual/root.babylon: loadAssets of undefined from undefined version: undefined, exporter version: undefinedimportScene has failed JSON parse
e._LogEnabled @ babylon.js:1
h @ babylon.js:1
dm @ babylon.js:1
loadAssetContainer @ babylon.js:1
(anonymous) @ babylon.js:1
p @ babylon.js:1
(anonymous) @ babylon.js:1
e @ babylon.js:1
XMLHttpRequest.send (async)
e.send @ babylon.js:1
f @ babylon.js:1
h @ babylon.js:1
oi @ babylon.js:1
ri @ babylon.js:1
t._loadFile @ babylon.js:1
g @ babylon.js:1
e @ babylon.js:1
yr.OfflineProviderFactory @ babylon.js:1
e._LoadData @ babylon.js:1
e.LoadAssetContainer @ babylon.js:1
(anonymous) @ virtual_gallery.html:55
loadAsset @ virtual_gallery.html:54
galleryManager @ virtual_gallery.html:134
window.initFunction @ virtual_gallery.html:188
await in window.initFunction (async)
(anonymous) @ virtual_gallery.html:192

Hi all,
I did a bit more of research on the browser dev tools. It seems that the failure happens when the .babylon file download ends prematurely. The status code is fine but the transfer size is smaller than what is should.

Chrome shows some message of this kind:
[Violation] ‘readystatechange’ handler took 352ms

Firefox shows nothing.

Questions would be:

  1. does it look like an issue in the server side or the client one?
  2. having a loading bar or a managed loading progress would prevent this problem?

If I can provide something more concrete from the console or alike let me know.
Cheers
LB

Unfortunately, I guess only a repro could help going further here :frowning:

Hi @sebavan. If the issue depends on particular network conditions it might be difficult to recreate. Yet those with good knowledge of the internals of babylon could figure out if things are working as expected. The relatively large babylon files (between 10-60 MB) have proper Content-length file size in the http headers, however the actual transfer size (depending on browser and network) is sometimes, hence triggering the error shown at the begining of this thread.

I will try to verify if this is some sort of a packet loss. In that’s the case, babylon (or babylon and supporting libraries) does not seem to handle or even detect it. If I download from the browser the large files, they are downloaded without issues.

any clues on how to compile further info?
ps. i have edited the title and first message to better represent what I’ve learnt on the issue so far

Hello! I can report that I had the same issue:

The loaders are using XMLHTTPRequest for compatibility reasons, so I wonder if the result would be different using fetch. Could you try loading the json string through fetch and then loading the data string into Babylon? Loading Any File Type | Babylon.js Documentation (babylonjs.com)

Me too with Chromium saying

So the browser can not seem to be able to do what it should in some cases. It does not seem to be babylon specific here

As a summary. The server side seems to be the one cutting off the connection. I put the files on a different server and the issues were gone. Download of large asset may be a problem in some proxy environments too.

However, if there is a Content-length response babylon could try to resume the download of the remaining assets.