I’m encountering an intermittent rendering issue that stops the Cesium viewer with a DeveloperError related to memory allocation when updating polylines. This started occurring after upgrading from v1.119.0 to v1.131.0 (and persists when I revert back to v1.119.0).
The Error
The console error is: DeveloperError: Expected offsetInBytes + arrayView.byteLength to be less than or equal to [sizeInBytes], actual value was [largerValue] (See Screenshot 1).
This error occurs within Buffer.js when attempting to call Buffer.prototype.copyFrom or related functions to upload data to the GPU memory.
Application Context
My application allows users to create guide-lines by clicking on the viewer. These guide-lines are implemented as Cesium Polylines.
-
Some guide-lines are single
Polylineentities. -
Others are collections of multiple
Polylineentities, sometimes with different materials (which might implicitly lead to aPolylineCollection).
The error occurs randomly when updating the positions of these polylines, which I’ve attempted using both ConstantProperty and CallbackProperty for the positions property.
Observations from Debugging
Based on the attached screenshots, I’ve made the following observations about where the error occurs:
-
Location: The error consistently happens inside
Buffer.jsduring a memory update operation (copyFromorcopyFromArrayView), specifically whenPolylineCollection.updatecallsPolylineBucket.writeUpdate(Screenshots 1 & 3). -
Logic Failure: The error states that:
offsetInBytes+arrayView.byteLength>sizeInBytes
- Screenshot 3 shows an example:
Expected [...] to be less than or equal to **87364**, actual value was **128448**.
- Screenshot 3 shows an example:
-
Index/Offset Discrepancy: The problem seems related to how the update range is calculated.
-
Screenshot 3 shows the update function calculating
index1andindex2. -
In a failing case (Screenshot 1),
index2is 572 andoffsetis 87264. -
My hypothesis is that when
index2is non-zero, the calculation for theoffsetInBytesor thebyteLengthfor the update range is incorrect, leading to an attempt to write past the allocated buffer size (sizeInBytes).
-
-
Implicit Collections:
-
I have a single
Polylinethat does not use aPolylineCollectionand does not throw this error. -
I have cases where I create a series of polylines, which automatically result in a
PolylineCollection. Even when I reduce this to a single polyline entity, the framework still creates aPolylineCollectioninternally, and this collection sometimes throws the error when its points are updated.
-
Request for Help
Since I cannot reproduce this in Sandcastle, I suspect this may be due to a specific configuration or an interaction with an older polyline structure or entity management.
Any suggestions on what might cause the discrepancy between the expected buffer size (sizeInBytes) and the calculated update range (offsetInBytes + byteLength) would be greatly appreciated.
Thank you!


