-
Notifications
You must be signed in to change notification settings - Fork 193
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: check if handle has been initialized before closing #1554
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1554 +/- ##
============================================
+ Coverage 56.12% 58.38% +2.25%
- Complexity 976 985 +9
============================================
Files 119 122 +3
Lines 11743 12217 +474
Branches 2251 2280 +29
============================================
+ Hits 6591 7133 +542
+ Misses 4012 3951 -61
+ Partials 1140 1133 -7 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Native.closeRecordBatchReader(this.handle); | ||
if (handle > 0) { | ||
Native.closeRecordBatchReader(this.handle); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And should we set handle to zero after being closed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, that makes sense to me.
Is it possible to add a unit test for this? |
if (handle > 0) { | ||
Native.closeRecordBatchReader(this.handle); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: we refer to both handle
and this.handle
. I assume they are the same thing but it would be nice to make them consistent
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, changed
Do we need to add a error test case for this obvious anomaly? |
It's not necessary. I just wanted to see in what condition the NativeBatchReader can be called after close has been called. Just in case there is a fundamental error that we are overlooking. |
The scenario I encountered was not NativeBatchReader called after close, but an exception occurred during NativeBatchReader initialization and close was called. You can see some information in the first screenshot of description of #1553 |
Ah. Thanks for clarifying |
Which issue does this PR close?
Part of #1553
Rationale for this change
Check that the handle is initialized before closing to avoid native thread panic.
What changes are included in this PR?
How are these changes tested?
before this:

after this:
