Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix JS client leaking exported references, clarify dh.Widget API #4939

Merged
merged 9 commits into from
Dec 12, 2023

Conversation

niloc132
Copy link
Member

This PR is an update to #4909.

JsPartitionedTable, JsFigure, PandasTable were previously being leaked even with correct usage, ensure that those are released when client code calls close(). Additionally, partitioned tables would be re-exported unnecessarily, but only the re-export was released, leaking the original reference.

Widget and WidgetExportedObject had documentation indicating how to consume exported objects, but these rules were not enforced. The rules have changed to be more consistent and are enforced, which should avoid later confusion, and new documentation added to propose potential patterns to follow when authoring plugins.

Fixes #4903

@niloc132 niloc132 added documentation Improvements or additions to documentation jsapi NoDocumentationNeeded plug-ins ReleaseNotesNeeded Release notes are needed labels Dec 12, 2023
@niloc132 niloc132 added this to the November 2023 milestone Dec 12, 2023
@niloc132 niloc132 self-assigned this Dec 12, 2023
Copy link
Member

@mofojed mofojed left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor doc correction, couple of questions/comments.

req.setSourceId(ticket.getTicket());
req.setResultId(reexportedTicket);
connection.sessionServiceClient().exportFromTicket(req, connection.metadata(), c::apply);
}).then(success -> {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The downside of this is the extra round trip (not a TicketAndPromise), but it is a lot cleaner this way.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh right - I can make it less clean and less round trippy....

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm. I can, but then there will be zero round trips, and we would be ignoring failure (if any) from the exportFromTIcket call, and would only find out after trying to use the resulting object.

In that case, we could stop returning promise entirely.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm indifferent. Could file a ticket to optimize this in the future?

@niloc132 niloc132 merged commit 5fab992 into deephaven:main Dec 12, 2023
18 checks passed
@github-actions github-actions bot locked and limited conversation to collaborators Dec 12, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
documentation Improvements or additions to documentation jsapi NoDocumentationNeeded plug-ins ReleaseNotesNeeded Release notes are needed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Widgets cause leaks, do not release all resources
3 participants