ARROW-4086: [Java] Add apis to debug memory alloc failures#4369
ARROW-4086: [Java] Add apis to debug memory alloc failures#4369pravindra wants to merge 1 commit intoapache:masterfrom
Conversation
|
@praveenbingo can you please review ? |
There was a problem hiding this comment.
small nit, would it make sense to construct the OOM with reservation and outcome instead of string formatting here?
There was a problem hiding this comment.
this one is slightly different - the allocation is failing when allocating the reservation. The other failures happen when allocating a buffer. Also, we throw the same exception if the allocator's metrics satisfy the request, but netty doesn't have available memory (can happen due to fragmentation).
so, i think it's better to leave the string be constructed as per the context.
There was a problem hiding this comment.
you can avoid the second comparison (compiler might optimize it away anyways) if you return the new allocation inside the if block above and return SUCCESS_INSANCE here.
There was a problem hiding this comment.
nit: what do you think about adding /foo=/true, /bar=/ false it would make this more readable outside and IDE
There was a problem hiding this comment.
i made the change but it looks a bit ugly inside an IDE - intellij shows me the field name twice now.
There was a problem hiding this comment.
nit: nested ternary operators are a little hard to read.
There was a problem hiding this comment.
do we have any standard policy for changing the public API in Java?
There was a problem hiding this comment.
None so far, the changes i've seen so far are backward incompatible..they should not be though :)
There was a problem hiding this comment.
assert something about the OOM message?
There was a problem hiding this comment.
it might be clearer to call this something like failureAtParentLimit
There was a problem hiding this comment.
renamed to failureAtParentLimitOutcomeDetails
There was a problem hiding this comment.
renamed to failureAtRootLimitOutcomeDetails
There was a problem hiding this comment.
why isn't clear necessary anymore?
There was a problem hiding this comment.
because allocateNew is already doing the same. please see line 410..
There was a problem hiding this comment.
it seems like it might be cleaner to overload. Is there a reason not to so?
There was a problem hiding this comment.
added an overloaded fn - but i'm not sure that's what you meant. please take a look.
There was a problem hiding this comment.
None so far, the changes i've seen so far are backward incompatible..they should not be though :)
There was a problem hiding this comment.
Use optional instead ?
There was a problem hiding this comment.
is there no concurrent identity hash map..might prefer that since it will prevent future bugs..
(or) might create a synchronized map that wraps the identity map..
There was a problem hiding this comment.
done - created a synchronized map wrapper over the identity map
There was a problem hiding this comment.
nice work consolidating this..
There was a problem hiding this comment.
because allocateNew is already doing the same. please see line 410..
Codecov Report
@@ Coverage Diff @@
## master #4369 +/- ##
==========================================
+ Coverage 88.32% 89.38% +1.06%
==========================================
Files 781 639 -142
Lines 98540 88864 -9676
Branches 1251 0 -1251
==========================================
- Hits 87031 79434 -7597
+ Misses 11273 9430 -1843
+ Partials 236 0 -236
Continue to review full report at Codecov.
|
|
@emkornfield +1 LGTM..Please merge if you are ok with the changes. |
emkornfield
left a comment
There was a problem hiding this comment.
Two minor comments but otherwise looks good.
There was a problem hiding this comment.
Simpler to just do: new HashSet<>(childAlloactors.keySet()) https://docs.oracle.com/javase/7/docs/api/java/util/HashSet.html#HashSet(java.util.Collection)
There was a problem hiding this comment.
This needs a javadoc or CI will fail.
- On failures, capture state for each allocator in chain and add the details to the exception. - add APIs to get parent/child allocators - Do not mask the original exception when allocating from vectors
- On failures, capture state for each allocator in chain and add the details to the exception. - add APIs to get parent/child allocators - Do not mask the original exception when allocating from vectors Author: Pindikura Ravindra <ravindra@dremio.com> Closes apache#4369 from pravindra/memdebug and squashes the following commits: 92a269b <Pindikura Ravindra> ARROW-4086 : Add apis to debug memory alloc failures
details to the exception.