You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@arrow.apache.org by GitBox <gi...@apache.org> on 2022/12/08 01:42:47 UTC
[GitHub] [arrow] lquerel opened a new issue, #14883: [Go] arrow.ipc.writer.compressBodyBuffers leaks memory during compression phase
lquerel opened a new issue, #14883:
URL: https://github.com/apache/arrow/issues/14883
### Describe the bug, including details regarding any error messages, version, and platform.
All my unit tests work with the CheckedAllocator (the one used in the Arrow Go library) but when I added the zstd compression option to the IPC writer my tests turned red.
The issue is located in the file arrow.ipc.writer line 345 (v10.0.1).
```go
compress := func(idx int, codec compressor) error {
if p.body[idx] == nil || p.body[idx].Len() == 0 {
return nil
}
var buf bytes.Buffer
buf.Grow(codec.MaxCompressedLen(p.body[idx].Len()) + arrow.Int64SizeBytes)
if err := binary.Write(&buf, binary.LittleEndian, uint64(p.body[idx].Len())); err != nil {
return err
}
codec.Reset(&buf)
if _, err := codec.Write(p.body[idx].Bytes()); err != nil {
return err
}
if err := codec.Close(); err != nil {
return err
}
p.body[idx] = memory.NewBufferBytes(buf.Bytes()). <-- line 345
return nil
}
```
The previous buffer is replaced by a new one but without:
- releasing the previous one,
- and specifying the current allocator to the new buffer.
### Component(s)
Go
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@arrow.apache.org.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [arrow] zeroshade closed issue #14883: [Go] arrow.ipc.writer.compressBodyBuffers leaks memory during compression phase
Posted by GitBox <gi...@apache.org>.
zeroshade closed issue #14883: [Go] arrow.ipc.writer.compressBodyBuffers leaks memory during compression phase
URL: https://github.com/apache/arrow/issues/14883
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [arrow] lquerel commented on issue #14883: [Go] arrow.ipc.writer.compressBodyBuffers leaks memory during compression phase
Posted by GitBox <gi...@apache.org>.
lquerel commented on issue #14883:
URL: https://github.com/apache/arrow/issues/14883#issuecomment-1344532862
@zeroshade you can uncomment the `replace` statement in my go.mod to point directly to you version of Arrow.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [arrow] zeroshade commented on issue #14883: [Go] arrow.ipc.writer.compressBodyBuffers leaks memory during compression phase
Posted by GitBox <gi...@apache.org>.
zeroshade commented on issue #14883:
URL: https://github.com/apache/arrow/issues/14883#issuecomment-1344531044
@lquerel I believe I figured out the cause of the issue. Gonna see if I can try to run your test with my fix to confirm.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [arrow] lquerel commented on issue #14883: [Go] arrow.ipc.writer.compressBodyBuffers leaks memory during compression phase
Posted by GitBox <gi...@apache.org>.
lquerel commented on issue #14883:
URL: https://github.com/apache/arrow/issues/14883#issuecomment-1344574463
@zeroshade Great
Regarding the extra release, I will fix that. Thanks.
Will it be possible to have this 2 PRs in a v10.0.2?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [arrow] zeroshade commented on issue #14883: [Go] arrow.ipc.writer.compressBodyBuffers leaks memory during compression phase
Posted by GitBox <gi...@apache.org>.
zeroshade commented on issue #14883:
URL: https://github.com/apache/arrow/issues/14883#issuecomment-1344561400
@lquerel Okay, two things:
1. I have a fix for the issue with encoding an empty map, I've opened the PR https://github.com/apache/arrow/pull/14904 to fix it.
2. You have an issue where you're doing extra releases on your builders in that branch. You create a record builder and then you grab the child builders and place them into various objects and then you call release which recursively calls release on your child objects which all release their builders. The issue is that calling release on the record builder will already call release on all of it's child builders and you never call retain on those child builders when you hand them off to your child objects. It's not a big problem, per se, but you can see it if you run your tests with `-tags assert` which turns on the debug asserts in the Arrow module and you'll find the "too many releases" errors. Just figured i'd point that out to you.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [arrow] lquerel commented on issue #14883: [Go] arrow.ipc.writer.compressBodyBuffers leaks memory during compression phase
Posted by GitBox <gi...@apache.org>.
lquerel commented on issue #14883:
URL: https://github.com/apache/arrow/issues/14883#issuecomment-1343279107
The sooner the better, so I will vote for a v10.0.2.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [arrow] zeroshade commented on issue #14883: [Go] arrow.ipc.writer.compressBodyBuffers leaks memory during compression phase
Posted by GitBox <gi...@apache.org>.
zeroshade commented on issue #14883:
URL: https://github.com/apache/arrow/issues/14883#issuecomment-1343166042
@lquerel Please try the branch on the referenced PR and confirm that it fixes your usage. I added a unit test in the PR to test for the memory leak and was able to replicate the `CheckedAllocator` finding the leak before I fixed it, but I want to be sure that it is accurate to your usage.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [arrow] lquerel commented on issue #14883: [Go] arrow.ipc.writer.compressBodyBuffers leaks memory during compression phase
Posted by GitBox <gi...@apache.org>.
lquerel commented on issue #14883:
URL: https://github.com/apache/arrow/issues/14883#issuecomment-1343681681
@zeroshade I tested your commit with my current code which doesn't contain the zstd compression configuration. This code works perfectly with v10.0.1 but doesn't work with your commit or even with v11 head. So, I don't think it's related to your fix.
I got the following error: arrow/ipc: unknown error while writing: runtime error: index out of range [1] with length 1
The error is issued from array.list line 157, higher is the stack the program was in ipc.writer line 674, i.e. in the logic to serialize an arrow map.
I need your help to debug this one :)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [arrow] lquerel commented on issue #14883: [Go] arrow.ipc.writer.compressBodyBuffers leaks memory during compression phase
Posted by GitBox <gi...@apache.org>.
lquerel commented on issue #14883:
URL: https://github.com/apache/arrow/issues/14883#issuecomment-1344596012
@zeroshade Sure I will send an email to request a v10.0.2.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [arrow] zeroshade commented on issue #14883: [Go] arrow.ipc.writer.compressBodyBuffers leaks memory during compression phase
Posted by GitBox <gi...@apache.org>.
zeroshade commented on issue #14883:
URL: https://github.com/apache/arrow/issues/14883#issuecomment-1344469652
Could you share the code you're using to hit that panic? Or potentially boil it down to a small test case I could debug?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [arrow] lquerel commented on issue #14883: [Go] arrow.ipc.writer.compressBodyBuffers leaks memory during compression phase
Posted by GitBox <gi...@apache.org>.
lquerel commented on issue #14883:
URL: https://github.com/apache/arrow/issues/14883#issuecomment-1344621150
@zeroshade email sent.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [arrow] zeroshade commented on issue #14883: [Go] arrow.ipc.writer.compressBodyBuffers leaks memory during compression phase
Posted by GitBox <gi...@apache.org>.
zeroshade commented on issue #14883:
URL: https://github.com/apache/arrow/issues/14883#issuecomment-1342969323
looking into this now
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [arrow] lquerel commented on issue #14883: [Go] arrow.ipc.writer.compressBodyBuffers leaks memory during compression phase
Posted by GitBox <gi...@apache.org>.
lquerel commented on issue #14883:
URL: https://github.com/apache/arrow/issues/14883#issuecomment-1343183938
@zeroshade yes I will check that but the fact that the version number is in the import path doesn't simplify this kind of test. I'm back to the version 10.0.1 and your branch is v11 so a single replace statement in go.mod will not be enough. I need to replace all the import statement in the code. If you have a better option, please let me know.
I should be able to give an answer latter today.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [arrow] zeroshade commented on issue #14883: [Go] arrow.ipc.writer.compressBodyBuffers leaks memory during compression phase
Posted by GitBox <gi...@apache.org>.
zeroshade commented on issue #14883:
URL: https://github.com/apache/arrow/issues/14883#issuecomment-1344576727
I'll merge the two PRs and can you please send an email to the arrow dev mailing list requesting a v10.0.2 release incorporating these two PRs? Discussion about doing so will have to occur on the mailing list.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [arrow] zeroshade commented on issue #14883: [Go] arrow.ipc.writer.compressBodyBuffers leaks memory during compression phase
Posted by GitBox <gi...@apache.org>.
zeroshade commented on issue #14883:
URL: https://github.com/apache/arrow/issues/14883#issuecomment-1343195982
If entirely necessary, we could request on the mailing list to backport this to a 10.0.2 patch release. Or, depending on your timeframe, v11 would be being released around mid-january and you could upgrade to that then. Either of those could work
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [arrow] lquerel commented on issue #14883: [Go] arrow.ipc.writer.compressBodyBuffers leaks memory during compression phase
Posted by GitBox <gi...@apache.org>.
lquerel commented on issue #14883:
URL: https://github.com/apache/arrow/issues/14883#issuecomment-1344528019
You can reproduce this bug with this commit https://github.com/f5/otel-arrow-adapter/pull/66/commits/cdcd8869c286748213eb7769dc825ece5a05db57
The test is located in `pkg\otel\arrow_record\producer_consumer_test.go` func TestProducerConsumerMetrics
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [arrow] lquerel commented on issue #14883: [Go] arrow.ipc.writer.compressBodyBuffers leaks memory during compression phase
Posted by GitBox <gi...@apache.org>.
lquerel commented on issue #14883:
URL: https://github.com/apache/arrow/issues/14883#issuecomment-1344535842
@zeroshade to answer your question:
- len(a.offsets) = 1
- len(a.data.length) = 0
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org