deephaven / deephaven-core

Deephaven Community Core
Other
255 stars 80 forks source link

Snapshot messages over 100MB throw in JS API #4563

Open mattrunyon opened 1 year ago

mattrunyon commented 1 year ago

Description

This happened when downsampling a plot with nulls. At a certain size, the message from the server exceeds 100MB and the JS API throws an error as it receives 2 different payloads, but doesn't think there could be a 2nd payload after the 1st snapshot payload.

Steps to reproduce

  1. Run this Python in the web IDE
from deephaven import empty_table
from deephaven.plot.figure import Figure

t = empty_table(4000000).update(["Timestamp=epochMillisToInstant(i)","x=(double)i", "y=i%12==11?null:Math.sin(i)"])
f = Figure().plot_xy(series_name="Hello", t=t, x="Timestamp", y="y").show()

Expected results

  1. JS API emits a downsample finished event. Plot shows up

Actual results

  1. Plot shows an indefinite loader. JS console has a failed class cast exception and failed assertion. JS API never emits downsample finished/failed event.

Additional details and attachments

In WorkerConnection, the assertion ofnextDeltaUpdatesinappendAndMaybeFlushis what fails. It seemsstartAndMaybeFlushis called w/isSnapshot=trueand then another message arrives and callsappendAndMaybeFlushfrom thestream.onData`

The reason this snapshot gets so big is when downsampling w/ nulls, nulls must be preserved. I'll open another ticket to add some way to limit the downsample output size (downsampling 4M pts to 1M is still awful for the web UI to try to plot in addition to the data transferred).

Versions

niloc132 commented 1 year ago

188 will "fix" this, though if the web UI is subscribing in cases where they need bigger payloads, something else is probably wrong.