melowntech / vts-browser-js

JavaScript WebGL 3D map rendering engine
BSD 2-Clause "Simplified" License
220 stars 42 forks source link

Uncaught RangeError: Offset is outside the bounds of the DataView #170

Closed skazemi closed 4 years ago

skazemi commented 4 years ago

While zooming in/out with mouse I get Uncaught RangeError: Offset is outside the bounds of the DataView on the following line of code: https://github.com/melowntech/vts-browser-js/blob/1f3c4235c5ae4aefbbb64188e93867e89da834c9/src/core/map/metatile.js#L238 after this exception the map freezes.

here is the stack trace: vts-browser.min.js:formatted:20137 Uncaught RangeError: Offset is outside the bounds of the DataView at DataView.getUint8 () at n.parseMetatatile (vts-browser.min.js:formatted:20137) at n.onLoaded (vts-browser.min.js:formatted:20120) at j.processProcessingTasks (vts-browser.min.js:formatted:18504) at j.update (vts-browser.min.js:formatted:18542) at A.onUpdate (vts-browser.min.js:formatted:2423) n.parseMetatatile @ vts-browser.min.js:formatted:20137 n.onLoaded @ vts-browser.min.js:formatted:20120 j.processProcessingTasks @ vts-browser.min.js:formatted:18504 j.update @ vts-browser.min.js:formatted:18542 A.onUpdate @ vts-browser.min.js:formatted:2423 requestAnimationFrame (async) A.onUpdate @ vts-browser.min.js:formatted:2425

skazemi commented 4 years ago

found the cause of issue: sometimes stream.data is empty and accessing first index raises the exception.

davidmtech commented 4 years ago

You are right. It seems to be caused by corrupted data. I can add more checks for data corruption. But unfortunately data can be corrupted in endless ways. Do you have URL of corrupted metatile?

skazemi commented 4 years ago

Thank you for your response. I cant find the URL following the call stack in the debugger.

davidmtech commented 4 years ago

You may try debug (unminified) version of the library

davidmtech commented 4 years ago

https://github.com/melowntech/vts-browser-js/releases/download/v2.22.5/compiled-libraries-and-demos.zip

Library file is stored in build directory.

URL value should in stored in MapMetatile object as .mapLoaderUrl or at least send me .id of the metatile.

skazemi commented 4 years ago

As call stack is started by map.update event, URL is not present in current call stack, (only data related to the URL is passed through this call sequence)

davidmtech commented 4 years ago

In that case I have no way how to replicate this error. Can you send mapConfig URL and map position (or at least lat,lon) where error occur?