Skip to content
This repository was archived by the owner on Mar 19, 2026. It is now read-only.

fix: fix memory leaks - #406

Merged
lucas-zimerman merged 1 commit into
getsentry:mainfrom
Athorcis:main
Jan 19, 2026
Merged

lucas-zimerman merged 1 commit into
getsentry:mainfrom
Athorcis:main

Conversation

@Athorcis

@Athorcis Athorcis commented Nov 25, 2025

Copy link
Copy Markdown
Contributor

we always should return a result or else cordova is leaking callbacks on the js side
it become visible with numerous calls to addBreadcrumb

we always should return a result or else cordova is leaking callbacks on the js side
try (FileOutputStream out = new FileOutputStream(installation)) {
out.write(bytes);
logger.info("Successfully captured envelope.");
callbackContext.success();

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Why not move it to line 156 so it will always invoke callbackContext.success(); for all the cases?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

just to be sure, you want me to also replace all success plugin results (not in a try block, to avoid double call in case of catched errors) with the invokation at line 156 ?

callbackContext.success();
} catch (Exception e) {
logger.info("Error writing envelope.");
callbackContext.error("Error writing envelope.");

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

might also be a good idea to return false here

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I'm not sure, because as I understand it, the execute method is only supposed to return false if the requested action is not found.
(because when returning false cordova is sending its own plugin result)

@lucas-zimerman

Copy link
Copy Markdown
Contributor

Thank you @Athorcis for spotting this issue! I left a small suggestion on the java code but other than that it looks good!
Thank you again for the PR!

@Athorcis

Copy link
Copy Markdown
Contributor Author

@lucas-zimerman I have questions about the suggestions

@lucas-zimerman lucas-zimerman left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

After a further review, I conclude my comments won't fix anything else, so with that, thank you for the contribution!

@lucas-zimerman
lucas-zimerman merged commit 747b6d0 into getsentry:main Jan 19, 2026
10 of 13 checks passed
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants