You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
While upgrading En-ROADS to work with the latest published @sdeverywhere/runtime@0.2.4 (which included some refactoring, see #471), I encountered an error in a special case:
model runs once with normal outputs
model runs a second time with a smaller subset of outputs/points
In this scenario, the wasm model will reuse a larger outputs buffer than is needed for the second run, so when storeOutputs is called, it fails when copying the array to the internal buffer because the internal view is smaller than the incoming array.
Here's the error (this is from running in NodeJS; in a browser, it may say source array is too long):
Error [RangeError]: offset is out of bounds
at Float64Array.set (<anonymous>)
at BufferedRunModelParams.storeOutputs ([worker eval]:3:5106)
at BaseRunnableModel.runModel ([worker eval]:3:13145)
at runModel ([worker eval]:3:18439)
at [worker eval]:3:92
In the refactoring in #471, I had added a lot of tests, but in the one relevant integration test (impl-var-access), it happened to use the same number of outputs when testing both declared and impl variables, so this bug was masked.
I need to fix the storeOutputs method in BufferedRunModelParams to handle the case where the incoming array is larger than the internal view.
The text was updated successfully, but these errors were encountered:
While upgrading En-ROADS to work with the latest published
@sdeverywhere/runtime@0.2.4
(which included some refactoring, see #471), I encountered an error in a special case:In this scenario, the wasm model will reuse a larger outputs buffer than is needed for the second run, so when
storeOutputs
is called, it fails when copying the array to the internal buffer because the internal view is smaller than the incoming array.Here's the error (this is from running in NodeJS; in a browser, it may say
source array is too long
):In the refactoring in #471, I had added a lot of tests, but in the one relevant integration test (
impl-var-access
), it happened to use the same number of outputs when testing both declared and impl variables, so this bug was masked.I need to fix the
storeOutputs
method inBufferedRunModelParams
to handle the case where the incoming array is larger than the internal view.The text was updated successfully, but these errors were encountered: