Skip to content

TEZ-4460: Read timed out in shuffle handler - incorrect usage of EMPTY_LAST_CONTENT and channel write - #257

Merged
abstractdog merged 2 commits into
apache:masterfrom
abstractdog:TEZ-4460
Feb 28, 2023
Merged

TEZ-4460: Read timed out in shuffle handler - incorrect usage of EMPTY_LAST_CONTENT and channel write#257
abstractdog merged 2 commits into
apache:masterfrom
abstractdog:TEZ-4460

Conversation

@abstractdog

@abstractdogabstractdog commented Dec 9, 2022

Copy link
Copy Markdown
Contributor
  1. Fixed issues in ShuffleHandler
    actual fixes are "EMPTY_LAST_CONTENT" and "ch.writeAndFlush"
  2. Refactored TestShuffleHandler and introduced a new test case that calls the ShuffleHandler thoroughly

tested with a couple of queries on TPCDS 100GB (which had frequent timeouts before the patch)

@tez-yetus

This comment was marked as outdated.

@tez-yetus

This comment was marked as outdated.

@abstractdog
abstractdogforce-pushed the TEZ-4460 branch 6 times, most recently from 84dd081 to 9ad016bCompareDecember 10, 2022 22:04
@tez-yetus

This comment was marked as outdated.

@tez-yetus

This comment was marked as outdated.

@tez-yetus

This comment was marked as outdated.

@tez-yetus

This comment was marked as outdated.

@tez-yetus

This comment was marked as outdated.

@tez-yetus

This comment was marked as outdated.

@tez-yetus

Copy link
Copy Markdown

🎊 +1 overall

VoteSubsystemRuntimeComment
+0 🆗reexec35m 23sDocker mode activated.
_ Prechecks _
+1 💚dupname0m 0sNo case conflicting files found.
+1 💚@author0m 0sThe patch does not contain any @author tags.
+1 💚test4tests0m 0sThe patch appears to include 1 new or modified test files.
_ master Compile Tests _
+1 💚mvninstall15m 59smaster passed
+1 💚compile0m 30smaster passed with JDK Ubuntu-11.0.17+8-post-Ubuntu-1ubuntu220.04
+1 💚compile0m 28smaster passed with JDK Private Build-1.8.0_352-8u352-ga-1~20.04-b08
+1 💚checkstyle0m 58smaster passed
+1 💚javadoc0m 34smaster passed with JDK Ubuntu-11.0.17+8-post-Ubuntu-1ubuntu220.04
+1 💚javadoc0m 22smaster passed with JDK Private Build-1.8.0_352-8u352-ga-1~20.04-b08
+0 🆗spotbugs1m 9sUsed deprecated FindBugs config; considering switching to SpotBugs.
+1 💚findbugs1m 5smaster passed
_ Patch Compile Tests _
+1 💚mvninstall0m 31sthe patch passed
+1 💚compile0m 22sthe patch passed with JDK Ubuntu-11.0.17+8-post-Ubuntu-1ubuntu220.04
+1 💚javac0m 22sthe patch passed
+1 💚compile0m 18sthe patch passed with JDK Private Build-1.8.0_352-8u352-ga-1~20.04-b08
+1 💚javac0m 17sthe patch passed
-0 ⚠️checkstyle0m 11stez-plugins/tez-aux-services: The patch generated 1 new + 65 unchanged - 2 fixed = 66 total (was 67)
+1 💚whitespace0m 0sThe patch has no whitespace issues.
+1 💚javadoc0m 14sthe patch passed with JDK Ubuntu-11.0.17+8-post-Ubuntu-1ubuntu220.04
+1 💚javadoc0m 13sthe patch passed with JDK Private Build-1.8.0_352-8u352-ga-1~20.04-b08
+1 💚findbugs0m 45sthe patch passed
_ Other Tests _
+1 💚unit3m 4stez-aux-services in the patch passed.
+1 💚asflicense0m 13sThe patch does not generate ASF License warnings.
61m 59s
SubsystemReport/Notes
DockerClientAPI=1.41 ServerAPI=1.41 base: https://ci-hadoop.apache.org/job/tez-multibranch/job/PR-257/6/artifact/out/Dockerfile
GITHUB PR#257
JIRA IssueTEZ-4460
Optional Testsdupname asflicense javac javadoc unit spotbugs findbugs checkstyle compile
unameLinux 510f31b45ab0 4.15.0-200-generic #211-Ubuntu SMP Thu Nov 24 18:16:04 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux
Build toolmaven
Personalitypersonality/tez.sh
git revisionmaster / 34d6810
Default JavaPrivate Build-1.8.0_352-8u352-ga-1~20.04-b08
Multi-JDK versions/usr/lib/jvm/java-11-openjdk-amd64:Ubuntu-11.0.17+8-post-Ubuntu-1ubuntu220.04 /usr/lib/jvm/java-8-openjdk-amd64:Private Build-1.8.0_352-8u352-ga-1~20.04-b08
checkstylehttps://ci-hadoop.apache.org/job/tez-multibranch/job/PR-257/6/artifact/out/diff-checkstyle-tez-plugins_tez-aux-services.txt
Test Resultshttps://ci-hadoop.apache.org/job/tez-multibranch/job/PR-257/6/testReport/
Max. process+thread count1399 (vs. ulimit of 5500)
modulesC: tez-plugins/tez-aux-services U: tez-plugins/tez-aux-services
Console outputhttps://ci-hadoop.apache.org/job/tez-multibranch/job/PR-257/6/console
versionsgit=2.25.1 maven=3.6.3 findbugs=3.0.1
Powered byApache Yetus 0.12.0 https://yetus.apache.org

This message was automatically generated.

@abstractdog

abstractdog commented Dec 11, 2022

Copy link
Copy Markdown
ContributorAuthor

@jteagles : can you please review this? serious bug with shufflehandler, unit test added, tested on cluster

@abstractdog

Copy link
Copy Markdown
ContributorAuthor

@shameersss1 , @rbalamohan : can you take a look at this? serious issue, leftover from netty3->netty4 upgrade
the actual fix is easy, a couple of lines in ShuffleHandler

  • added UT which hangs without my patch (the very-same way as it did on the cluster)

}
int waitCount = this.reduceContext.getMapsToWait().decrementAndGet();
if (waitCount == 0) {
LOG.debug("Finished with all map outputs");

@shameersss1shameersss1Feb 15, 2023

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since this is in the hotpath should we enclose this in
if (LOG.isDebugEnabled()) { } ?

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this happens once per every shuffle request I guess, and logging parameters don't include expensive operations, so LOG.isDebugEnabled vs. LOG.debug is mostly a method call vs. method call, I don't feel we need to be extremely cautious in this case

int waitCount = this.reduceContext.getMapsToWait().decrementAndGet();
if (waitCount == 0) {
LOG.debug("Finished with all map outputs");
ch.writeAndFlush(LastHttpContent.EMPTY_LAST_CONTENT);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we add comment why this is required here.

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ack, this is the most important part of this patch, added a commit with a code comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this issue mainly due to nettty upgrade (4.x?)

@abstractdogabstractdogFeb 21, 2023

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, absolutely, this issue is because of the incorrect usage of netty4 APIs (investigation details are on Jira ticket)
most interestingly, there were no unit tests that showed this issue so far (added one now), which reproduces when we fetch more inputs in the same request: due to this issue, the new UT completely hung, and a real TPCDS query on the cluster became very slow, as composite fetch requests hung and timed out eventually (didn't cause a query failure, just an extremely slow query)

@shameersss1

Copy link
Copy Markdown
Contributor

In general the changes LGTM +1, Let's re-run the tests as well

@tez-yetus

Copy link
Copy Markdown

🎊 +1 overall

VoteSubsystemRuntimeComment
+0 🆗reexec0m 20sDocker mode activated.
_ Prechecks _
+1 💚dupname0m 0sNo case conflicting files found.
+1 💚@author0m 0sThe patch does not contain any @author tags.
+1 💚test4tests0m 0sThe patch appears to include 1 new or modified test files.
_ master Compile Tests _
+1 💚mvninstall15m 33smaster passed
+1 💚compile0m 30smaster passed with JDK Ubuntu-11.0.17+8-post-Ubuntu-1ubuntu222.04
+1 💚compile0m 30smaster passed with JDK Private Build-1.8.0_352-8u352-ga-1~22.04-b08
+1 💚checkstyle1m 0smaster passed
+1 💚javadoc0m 37smaster passed with JDK Ubuntu-11.0.17+8-post-Ubuntu-1ubuntu222.04
+1 💚javadoc0m 25smaster passed with JDK Private Build-1.8.0_352-8u352-ga-1~22.04-b08
+0 🆗spotbugs1m 3sUsed deprecated FindBugs config; considering switching to SpotBugs.
+1 💚findbugs1m 2smaster passed
_ Patch Compile Tests _
+1 💚mvninstall0m 24sthe patch passed
+1 💚compile0m 16sthe patch passed with JDK Ubuntu-11.0.17+8-post-Ubuntu-1ubuntu222.04
+1 💚javac0m 16sthe patch passed
+1 💚compile0m 15sthe patch passed with JDK Private Build-1.8.0_352-8u352-ga-1~22.04-b08
+1 💚javac0m 15sthe patch passed
-0 ⚠️checkstyle0m 10stez-plugins/tez-aux-services: The patch generated 1 new + 65 unchanged - 2 fixed = 66 total (was 67)
+1 💚whitespace0m 0sThe patch has no whitespace issues.
+1 💚javadoc0m 12sthe patch passed with JDK Ubuntu-11.0.17+8-post-Ubuntu-1ubuntu222.04
+1 💚javadoc0m 11sthe patch passed with JDK Private Build-1.8.0_352-8u352-ga-1~22.04-b08
+1 💚findbugs0m 33sthe patch passed
_ Other Tests _
+1 💚unit2m 56stez-aux-services in the patch passed.
+1 💚asflicense0m 15sThe patch does not generate ASF License warnings.
26m 6s
SubsystemReport/Notes
DockerClientAPI=1.42 ServerAPI=1.42 base: https://ci-hadoop.apache.org/job/tez-multibranch/job/PR-257/10/artifact/out/Dockerfile
GITHUB PR#257
JIRA IssueTEZ-4460
Optional Testsdupname asflicense javac javadoc unit spotbugs findbugs checkstyle compile
unameLinux 10ddf931d34a 4.15.0-200-generic #211-Ubuntu SMP Thu Nov 24 18:16:04 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux
Build toolmaven
Personalitypersonality/tez.sh
git revisionmaster / be99489
Default JavaPrivate Build-1.8.0_352-8u352-ga-1~22.04-b08
Multi-JDK versions/usr/lib/jvm/java-11-openjdk-amd64:Ubuntu-11.0.17+8-post-Ubuntu-1ubuntu222.04 /usr/lib/jvm/java-8-openjdk-amd64:Private Build-1.8.0_352-8u352-ga-1~22.04-b08
checkstylehttps://ci-hadoop.apache.org/job/tez-multibranch/job/PR-257/10/artifact/out/diff-checkstyle-tez-plugins_tez-aux-services.txt
Test Resultshttps://ci-hadoop.apache.org/job/tez-multibranch/job/PR-257/10/testReport/
Max. process+thread count1519 (vs. ulimit of 5500)
modulesC: tez-plugins/tez-aux-services U: tez-plugins/tez-aux-services
Console outputhttps://ci-hadoop.apache.org/job/tez-multibranch/job/PR-257/10/console
versionsgit=2.34.1 maven=3.6.3 findbugs=3.0.1
Powered byApache Yetus 0.12.0 https://yetus.apache.org

This message was automatically generated.

@shameersss1shameersss1 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM +1

@abstractdog
abstractdog merged commit 6bd6f9c into apache:masterFeb 28, 2023
@BsoBird

BsoBird commented Nov 8, 2023

Copy link
Copy Markdown

@abstractdog
hi,Could you explain why request.release() was removed? It seems that removing request.release() causes leak in Netty.

 public void channelRead(ChannelHandlerContext ctx, Object message)
throws Exception {
- FullHttpRequest request = (FullHttpRequest) message;
+ HttpRequest request = (HttpRequest) message;
handleRequest(ctx, request);
- request.release();
}

prabhjyotsingh pushed a commit to acceldata-io/tez that referenced this pull request Nov 11, 2024
…Y_LAST_CONTENT and channel write (apache#257) (Laszlo Bodor reviewed by Rajesh Balamohan, Syed Shameerur Rahman)
(cherry picked from commit 6bd6f9c)
prabhjyotsingh pushed a commit to acceldata-io/tez that referenced this pull request Nov 12, 2024
…Y_LAST_CONTENT and channel write (apache#257) (Laszlo Bodor reviewed by Rajesh Balamohan, Syed Shameerur Rahman)
(cherry picked from commit 6bd6f9c)
prabhjyotsingh pushed a commit to acceldata-io/tez that referenced this pull request Nov 12, 2024
…Y_LAST_CONTENT and channel write (apache#257) (Laszlo Bodor reviewed by Rajesh Balamohan, Syed Shameerur Rahman)
(cherry picked from commit 6bd6f9c)
(cherry picked from commit 0c3cbb1)
prabhjyotsingh pushed a commit to acceldata-io/tez that referenced this pull request Nov 12, 2024
…Y_LAST_CONTENT and channel write (apache#257) (Laszlo Bodor reviewed by Rajesh Balamohan, Syed Shameerur Rahman)
(cherry picked from commit 6bd6f9c)
(cherry picked from commit 0c3cbb1)
prabhjyotsingh pushed a commit to acceldata-io/tez that referenced this pull request Nov 12, 2024
…Y_LAST_CONTENT and channel write (apache#257) (Laszlo Bodor reviewed by Rajesh Balamohan, Syed Shameerur Rahman)
(cherry picked from commit 6bd6f9c)
(cherry picked from commit 0c3cbb1)
prabhjyotsingh pushed a commit to acceldata-io/tez that referenced this pull request Nov 12, 2024
…Y_LAST_CONTENT and channel write (apache#257) (Laszlo Bodor reviewed by Rajesh Balamohan, Syed Shameerur Rahman)
(cherry picked from commit 6bd6f9c)
(cherry picked from commit 0c3cbb1)
prabhjyotsingh pushed a commit to acceldata-io/tez that referenced this pull request Nov 12, 2024
…Y_LAST_CONTENT and channel write (apache#257) (Laszlo Bodor reviewed by Rajesh Balamohan, Syed Shameerur Rahman)
(cherry picked from commit 6bd6f9c)
(cherry picked from commit 0c3cbb1)
prabhjyotsingh pushed a commit to acceldata-io/tez that referenced this pull request Nov 20, 2024
…Y_LAST_CONTENT and channel write (apache#257) (Laszlo Bodor reviewed by Rajesh Balamohan, Syed Shameerur Rahman)
(cherry picked from commit 6bd6f9c)
(cherry picked from commit 0c3cbb1)
(cherry picked from commit 798abf2)
prabhjyotsingh added a commit to acceldata-io/tez that referenced this pull request Nov 20, 2024
…ge of EMPTY_LAST_CONTENT and channel write (apache#257) (Laszlo Bodor reviewed by Rajesh Balamohan, Syed Shameerur Rahman) (#22)
shubhluck pushed a commit to acceldata-io/tez that referenced this pull request Nov 21, 2024
…ge of EMPTY_LAST_CONTENT and channel write (apache#257) (Laszlo Bodor reviewed by Rajesh Balamohan, Syed Shameerur Rahman) (#22)
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants

@abstractdog@tez-yetus@shameersss1@BsoBird@rbalamohan