You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@drill.apache.org by adeneche <gi...@git.apache.org> on 2016/03/26 20:43:20 UTC
[GitHub] drill pull request: DRILL-3317: when ProtobufLengthDecoder couldn'...
GitHub user adeneche opened a pull request:
https://github.com/apache/drill/pull/446
DRILL-3317: when ProtobufLengthDecoder couldn't allocate a new DrillB…
…uf, this error is just logged and nothing else is done
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/adeneche/incubator-drill DRILL-3317
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/drill/pull/446.patch
To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:
This closes #446
----
commit aaf7f5b9267818f03025062c851cf1efebd19e26
Author: adeneche <ad...@gmail.com>
Date: 2016-03-26T06:43:28Z
DRILL-3317: when ProtobufLengthDecoder couldn't allocate a new DrillBuf, this error is just logged and nothing else is done
----
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] drill pull request: DRILL-3317: when ProtobufLengthDecoder couldn'...
Posted by jacques-n <gi...@git.apache.org>.
Github user jacques-n commented on the pull request:
https://github.com/apache/drill/pull/446#issuecomment-213159458
+1 on this. Can you just confirm the behavior you're expecting in the out of memory situation?
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] drill pull request: DRILL-3317: when ProtobufLengthDecoder couldn'...
Posted by adeneche <gi...@git.apache.org>.
Github user adeneche commented on a diff in the pull request:
https://github.com/apache/drill/pull/446#discussion_r57518713
--- Diff: exec/rpc/src/main/java/org/apache/drill/exec/rpc/ProtobufLengthDecoder.java ---
@@ -82,15 +79,7 @@ protected void decode(ChannelHandlerContext ctx, ByteBuf in, List<Object> out) t
} else {
// need to make buffer copy, otherwise netty will try to refill this buffer if we move the readerIndex forward...
// TODO: Can we avoid this copy?
- ByteBuf outBuf;
- try {
- outBuf = allocator.buffer(length);
- } catch (OutOfMemoryException e) {
- logger.warn("Failure allocating buffer on incoming stream due to memory limits. Current Allocation: {}.", allocator.getAllocatedMemory());
- in.resetReaderIndex();
- outOfMemoryHandler.handle();
- return;
- }
+ ByteBuf outBuf = allocator.buffer(length);
--- End diff --
I will look into that. So far, when I was trying to reproduce the issue through Sqlline I would get an OutOfMemory error in a different place (earlier ?) of the RPC layer.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] drill pull request: DRILL-3317: when ProtobufLengthDecoder couldn'...
Posted by adeneche <gi...@git.apache.org>.
Github user adeneche commented on a diff in the pull request:
https://github.com/apache/drill/pull/446#discussion_r57524389
--- Diff: exec/rpc/src/main/java/org/apache/drill/exec/rpc/ProtobufLengthDecoder.java ---
@@ -82,15 +79,7 @@ protected void decode(ChannelHandlerContext ctx, ByteBuf in, List<Object> out) t
} else {
// need to make buffer copy, otherwise netty will try to refill this buffer if we move the readerIndex forward...
// TODO: Can we avoid this copy?
- ByteBuf outBuf;
- try {
- outBuf = allocator.buffer(length);
- } catch (OutOfMemoryException e) {
- logger.warn("Failure allocating buffer on incoming stream due to memory limits. Current Allocation: {}.", allocator.getAllocatedMemory());
- in.resetReaderIndex();
- outOfMemoryHandler.handle();
- return;
- }
+ ByteBuf outBuf = allocator.buffer(length);
--- End diff --
So I was looking at how we are using `ProtobufLengthDecoder` in our code, and we use in the control, server and user tunnels both on the client and server side.
If I am not mistaken, the only derived class from ProtobufLengthDecoder that actually uses an rpc allocator is UserProtobufLengthDecoder and only on the server side of the user tunnel. All other implementations use the root allocator.
This may actually explain why I wasn't able to reproduce this issue no matter how much I reduced the "rpc:bit-data" max allocation.
am I missing something ?
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] drill pull request: DRILL-3317: when ProtobufLengthDecoder couldn'...
Posted by jacques-n <gi...@git.apache.org>.
Github user jacques-n commented on the pull request:
https://github.com/apache/drill/pull/446#issuecomment-212587912
Thanks for trying to put together a test.
Can you include the fix to correct the issue about the root allocator as well. I haven't had a chance to look at that but it would explain why those numbers have been as low as they have been.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] drill pull request: DRILL-3317: when ProtobufLengthDecoder couldn'...
Posted by adeneche <gi...@git.apache.org>.
Github user adeneche commented on a diff in the pull request:
https://github.com/apache/drill/pull/446#discussion_r57676038
--- Diff: exec/rpc/src/main/java/org/apache/drill/exec/rpc/ProtobufLengthDecoder.java ---
@@ -82,15 +79,7 @@ protected void decode(ChannelHandlerContext ctx, ByteBuf in, List<Object> out) t
} else {
// need to make buffer copy, otherwise netty will try to refill this buffer if we move the readerIndex forward...
// TODO: Can we avoid this copy?
- ByteBuf outBuf;
- try {
- outBuf = allocator.buffer(length);
- } catch (OutOfMemoryException e) {
- logger.warn("Failure allocating buffer on incoming stream due to memory limits. Current Allocation: {}.", allocator.getAllocatedMemory());
- in.resetReaderIndex();
- outOfMemoryHandler.handle();
- return;
- }
+ ByteBuf outBuf = allocator.buffer(length);
--- End diff --
@jacques-n can you confirm it's indeed the case ? thanks
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] drill pull request: DRILL-3317: when ProtobufLengthDecoder couldn'...
Posted by adeneche <gi...@git.apache.org>.
Github user adeneche commented on the pull request:
https://github.com/apache/drill/pull/446#issuecomment-212488188
So I spent more time looking at ways to create a unit test for this, and I don't think it's possible:
First, current implementation of ProtobufLengthDecoder for the data tunnel uses the root allocator, which is weird and changing the rpc max allocation won't help in this case.
Second, even after I changed the implementation and made sure ProtobufLengthDecoder uses the rpc allocator, this same allocator is used by netty too and you can't control where it will run out of memory, in most of my experiments it run out of memory in ByteToMessageDecoder, so writing a unit test using this won't be reliable as it won't consistently reproduce the issue.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] drill pull request: DRILL-3317: when ProtobufLengthDecoder couldn'...
Posted by adeneche <gi...@git.apache.org>.
Github user adeneche commented on the pull request:
https://github.com/apache/drill/pull/446#issuecomment-213644219
This is indeed what happens
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] drill pull request: DRILL-3317: when ProtobufLengthDecoder couldn'...
Posted by jacques-n <gi...@git.apache.org>.
Github user jacques-n commented on the pull request:
https://github.com/apache/drill/pull/446#issuecomment-213640690
To confirm, the expectation is the exception is caught by the rpc handler and propagated back to the sender via the coordination id, right?
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] drill pull request: DRILL-3317: when ProtobufLengthDecoder couldn'...
Posted by jacques-n <gi...@git.apache.org>.
Github user jacques-n commented on the pull request:
https://github.com/apache/drill/pull/446#issuecomment-213647541
Does this get propated as a connection level failure or an RpcRemoteException. (E.g. do we break connection once this happens?) Seems like it would be better to generate a RpcRemoteException on the sending side to ensure that the connection is maintained.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] drill pull request: DRILL-3317: when ProtobufLengthDecoder couldn'...
Posted by jacques-n <gi...@git.apache.org>.
Github user jacques-n commented on the pull request:
https://github.com/apache/drill/pull/446#issuecomment-213647142
Great, thanks!
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] drill pull request: DRILL-3317: when ProtobufLengthDecoder couldn'...
Posted by adeneche <gi...@git.apache.org>.
Github user adeneche commented on the pull request:
https://github.com/apache/drill/pull/446#issuecomment-212651103
Done.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] drill pull request: DRILL-3317: when ProtobufLengthDecoder couldn'...
Posted by adeneche <gi...@git.apache.org>.
Github user adeneche commented on the pull request:
https://github.com/apache/drill/pull/446#issuecomment-213614554
I was not able to reproduce an out of memory from the ProtobufLengthDecoder. But I whenever I got an out of memory from ByteToMessageDecoder the query would fail properly, thanks to the fix for DRILL-3714
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] drill pull request: DRILL-3317: when ProtobufLengthDecoder couldn'...
Posted by jacques-n <gi...@git.apache.org>.
Github user jacques-n commented on a diff in the pull request:
https://github.com/apache/drill/pull/446#discussion_r57518531
--- Diff: exec/rpc/src/main/java/org/apache/drill/exec/rpc/ProtobufLengthDecoder.java ---
@@ -82,15 +79,7 @@ protected void decode(ChannelHandlerContext ctx, ByteBuf in, List<Object> out) t
} else {
// need to make buffer copy, otherwise netty will try to refill this buffer if we move the readerIndex forward...
// TODO: Can we avoid this copy?
- ByteBuf outBuf;
- try {
- outBuf = allocator.buffer(length);
- } catch (OutOfMemoryException e) {
- logger.warn("Failure allocating buffer on incoming stream due to memory limits. Current Allocation: {}.", allocator.getAllocatedMemory());
- in.resetReaderIndex();
- outOfMemoryHandler.handle();
- return;
- }
+ ByteBuf outBuf = allocator.buffer(length);
--- End diff --
Can you confirm that this has a consistent failure behavior by adding a test and create a very small rpc allocator (maybe add a config option to set the max for allocator (not just reservation)).
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---