-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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
Memory tracking issue: worker OOM in DictionaryValuesWriter #21745
Comments
@davseitsev image attachment links above are not working |
Uploaded images again, should be ok now |
@davseitsev thanks for reporting this |
I will port the fix and test it on the same query. |
Thank you, @raunaqmorarka, it looks good, there are no more heap buffers. The difference between allocated size and actual retained heap is much smaller. The query select
sum(cast(o.this['encodedValues.currentSlabPos'] as int) + retainedSize(o.this['encodedValues.slabs'])) as total_allocated_size,
sum(retainedSize(o.this)) total_retained_size
from "org.apache.parquet.column.values.dictionary.DictionaryValuesWriter$PlainBinaryDictionaryValuesWriter" o Returns
As I can see |
Thanks for verifying, |
Under the load some Trino workers experience memory starvation. On the graph it looks like horizontal line at the top.
OOM doesn't happen but the worker disappears from the cluster and running queries fail. It happends due to long Major GC.
This behaviour persists after Trino upgrade from 409 to 444.
Heap dump looks ok there is no obvious memory leak issue. So probably the issue is in memory accouning in memory context.
I looked over the biggest objects and found something interesting.
DictionaryValuesWriter
collects heap byte buffers which backing bytes size is much bigger that logical size. As you can see on the screen, logical size of the buffer is 199 bytes when it's backing bytes size is almost 200K. We collect such buffers in dictionary and do not account their "extra" bytes. As you can see on the screen,DictionaryFallbackValuesWriter
accepted 620K of raw data, but actually it takes 122MB of heap space.I went over all instances of
PlainBinaryDictionaryValuesWriter
and calculated how many extra bytes they take:Results:
There are about 7.5GB of data in "extra" bytes. I followed thought the source code and I didn't find any other place where we take these bytes into account in memory context. So it can cause OOM workers.
Also as far as I can see,
PlainBinaryDictionaryValuesWriter
does not take into account the size ofbinaryDictionaryContent
map in the methodgetAllocatedSize()
at all.The text was updated successfully, but these errors were encountered: