Skip to content

TEZ-4350: Remove synchronized from DAGAppMaster.serviceInit - #162

Merged
jteagles merged 1 commit into
apache:masterfrom
abstractdog:TEZ-4350
Jan 21, 2022
Merged

TEZ-4350: Remove synchronized from DAGAppMaster.serviceInit#162
jteagles merged 1 commit into
apache:masterfrom
abstractdog:TEZ-4350

Conversation

@abstractdog

Copy link
Copy Markdown
Contributor

No description provided.

@tez-yetus

Copy link
Copy Markdown

💔 -1 overall

VoteSubsystemRuntimeComment
+0 🆗reexec16m 56sDocker mode activated.
_ Prechecks _
+1 💚dupname0m 0sNo case conflicting files found.
+1 💚@author0m 0sThe patch does not contain any @author tags.
-1 ❌test4tests0m 0sThe patch doesn't appear to include any new or modified tests. Please justify why no new tests are needed for this patch. Also please list what manual steps were performed to verify this patch.
_ master Compile Tests _
+1 💚mvninstall13m 32smaster passed
+1 💚compile0m 47smaster passed with JDK Ubuntu-11.0.11+9-Ubuntu-0ubuntu2.20.04
+1 💚compile0m 39smaster passed with JDK Private Build-1.8.0_292-8u292-b10-0ubuntu1~20.04-b10
+1 💚checkstyle1m 6smaster passed
+1 💚javadoc0m 48smaster passed with JDK Ubuntu-11.0.11+9-Ubuntu-0ubuntu2.20.04
+1 💚javadoc0m 34smaster passed with JDK Private Build-1.8.0_292-8u292-b10-0ubuntu1~20.04-b10
+0 🆗spotbugs1m 51sUsed deprecated FindBugs config; considering switching to SpotBugs.
+1 💚findbugs1m 50smaster passed
_ Patch Compile Tests _
+1 💚mvninstall0m 30sthe patch passed
+1 💚compile0m 36sthe patch passed with JDK Ubuntu-11.0.11+9-Ubuntu-0ubuntu2.20.04
+1 💚javac0m 36sthe patch passed
+1 💚compile0m 29sthe patch passed with JDK Private Build-1.8.0_292-8u292-b10-0ubuntu1~20.04-b10
+1 💚javac0m 29sthe patch passed
+1 💚checkstyle0m 22sthe patch passed
+1 💚whitespace0m 0sThe patch has no whitespace issues.
+1 💚javadoc0m 27sthe patch passed with JDK Ubuntu-11.0.11+9-Ubuntu-0ubuntu2.20.04
+1 💚javadoc0m 23sthe patch passed with JDK Private Build-1.8.0_292-8u292-b10-0ubuntu1~20.04-b10
-1 ❌findbugs1m 29stez-dag generated 2 new + 0 unchanged - 0 fixed = 2 total (was 0)
_ Other Tests _
+1 💚unit4m 34stez-dag in the patch passed.
+1 💚asflicense0m 13sThe patch does not generate ASF License warnings.
46m 7s
ReasonTests
FindBugsmodule:tez-dag
Inconsistent synchronization of org.apache.tez.dag.app.DAGAppMaster.dagEventDispatcher; locked 66% of time Unsynchronized access at DAGAppMaster.java:66% of time Unsynchronized access at DAGAppMaster.java:[line 540]
Inconsistent synchronization of org.apache.tez.dag.app.DAGAppMaster.sessionTimeoutInterval; locked 83% of time Unsynchronized access at DAGAppMaster.java:83% of time Unsynchronized access at DAGAppMaster.java:[line 593]
SubsystemReport/Notes
DockerClientAPI=1.41 ServerAPI=1.41 base: https://ci-hadoop.apache.org/job/tez-multibranch/job/PR-162/1/artifact/out/Dockerfile
GITHUB PR#162
JIRA IssueTEZ-4350
Optional Testsdupname asflicense javac javadoc unit spotbugs findbugs checkstyle compile
unameLinux cc83338c7e69 4.15.0-143-generic #147-Ubuntu SMP Wed Apr 14 16:10:11 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux
Build toolmaven
Personalitypersonality/tez.sh
git revisionmaster / f39a51e
Default JavaPrivate Build-1.8.0_292-8u292-b10-0ubuntu1~20.04-b10
Multi-JDK versions/usr/lib/jvm/java-11-openjdk-amd64:Ubuntu-11.0.11+9-Ubuntu-0ubuntu2.20.04 /usr/lib/jvm/java-8-openjdk-amd64:Private Build-1.8.0_292-8u292-b10-0ubuntu1~20.04-b10
findbugshttps://ci-hadoop.apache.org/job/tez-multibranch/job/PR-162/1/artifact/out/new-findbugs-tez-dag.html
Test Resultshttps://ci-hadoop.apache.org/job/tez-multibranch/job/PR-162/1/testReport/
Max. process+thread count178 (vs. ulimit of 5500)
modulesC: tez-dag U: tez-dag
Console outputhttps://ci-hadoop.apache.org/job/tez-multibranch/job/PR-162/1/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.

@jteagles

Copy link
Copy Markdown
Contributor

@abstractdog, the findbugs above is showing the inconsistent synchronization. I am trying to imagine scenarios where the synchronization is needed, but let me describe generally what could happen. In multi-threaded apps, assignments are lazy and in a busy time, java may choose not to immediately propagate value change or assignment across to all threads. Then Other threads accessing will find an outdated value or old or unassigned object. So it's always safer to synchronize all accesses. However, it's rare to have an "init" or initial object assignment not get propagated to all other threads. My knowledge about this might be a little bit incorrect, so correct me if I'm wrong. The question to me is really, what is the cost of having the synchronization there? My guess would be a millisecond max, which in the grand scheme of things, isn't much. Do have think this change will have a bigger impact?

@abstractdog

abstractdog commented Jan 5, 2022

Copy link
Copy Markdown
ContributorAuthor

let me give the background of this change: it was created exactly because of the same inconsistent sync alerts in TEZ-4347 (which I'm about to finish soon too), just because in TEZ-4347 I was accessing some fields, that I don't really worried about from synchronization point of view, e.g. webUIService (alert is here), but it's accessed from serviceInit too, which doesn't need to be synchronized according to comments

this means two ways to solve this:
[1] make every access to every variable synchronized which is accessed from serviceInit (only because serviceInit is synchronized at the moment)
[2] consider removing synchronized from serviceInit if possible

[1] doesn't make sense to me, as serviceInit itself is not supposed to be synchronized
[2] I want to go this way, even if it gave an inconsistent sync alert (that needs to be checked), but in the opposite way as I saw in TEZ-4347, so here I need to revise if every field accessed from serviceInit should be really accessed synchronized every time

so my point is, the goal here is not performance, but going for [2] instead of [1]

@abstractdog

abstractdog commented Jan 17, 2022

Copy link
Copy Markdown
ContributorAuthor

double-checked: AbstractService lifecycle methods are guarded with a lock since YARN-530 (which introduced a strict and robust lifecycle)
that's why serviceInit, serviceStart, serviceStop is not supposed to be guarded in AbstractService subclasses
I also found that this change has let me remove lots of inconsistent sync warnings from findbugs-exclude.xml config (basically: these 3 methods touch a lot of DAGAppMaster fields, by which findbugs thinks that they needs synchronized access during the whole DAGAppMaster lifecycle)

YARN-530 + MAPREDUCE-5298 introduced similar changes to MrAppMaster

@tez-yetus

Copy link
Copy Markdown

💔 -1 overall

VoteSubsystemRuntimeComment
+0 🆗reexec12m 45sDocker mode activated.
_ Prechecks _
+1 💚dupname0m 0sNo case conflicting files found.
+1 💚@author0m 0sThe patch does not contain any @author tags.
-1 ❌test4tests0m 0sThe patch doesn't appear to include any new or modified tests. Please justify why no new tests are needed for this patch. Also please list what manual steps were performed to verify this patch.
_ master Compile Tests _
+1 💚mvninstall13m 56smaster passed
+1 💚compile0m 42smaster passed with JDK Ubuntu-11.0.13+8-Ubuntu-0ubuntu1.20.04
+1 💚compile0m 38smaster passed with JDK Private Build-1.8.0_312-8u312-b07-0ubuntu1~20.04-b07
+1 💚checkstyle1m 11smaster passed
+1 💚javadoc0m 48smaster passed with JDK Ubuntu-11.0.13+8-Ubuntu-0ubuntu1.20.04
+1 💚javadoc0m 37smaster passed with JDK Private Build-1.8.0_312-8u312-b07-0ubuntu1~20.04-b07
+0 🆗spotbugs1m 40sUsed deprecated FindBugs config; considering switching to SpotBugs.
+1 💚findbugs1m 38smaster passed
_ Patch Compile Tests _
+1 💚mvninstall0m 25sthe patch passed
+1 💚compile0m 27sthe patch passed with JDK Ubuntu-11.0.13+8-Ubuntu-0ubuntu1.20.04
+1 💚javac0m 27sthe patch passed
+1 💚compile0m 25sthe patch passed with JDK Private Build-1.8.0_312-8u312-b07-0ubuntu1~20.04-b07
+1 💚javac0m 25sthe patch passed
-0 ⚠️checkstyle0m 19stez-dag: The patch generated 1 new + 52 unchanged - 1 fixed = 53 total (was 53)
+1 💚whitespace0m 0sThe patch has no whitespace issues.
+1 💚xml0m 1sThe patch has no ill-formed XML file.
+1 💚javadoc0m 22sthe patch passed with JDK Ubuntu-11.0.13+8-Ubuntu-0ubuntu1.20.04
+1 💚javadoc0m 21sthe patch passed with JDK Private Build-1.8.0_312-8u312-b07-0ubuntu1~20.04-b07
+1 💚findbugs1m 10sthe patch passed
_ Other Tests _
+1 💚unit4m 29stez-dag in the patch passed.
+1 💚asflicense0m 15sThe patch does not generate ASF License warnings.
41m 22s
SubsystemReport/Notes
DockerClientAPI=1.41 ServerAPI=1.41 base: https://ci-hadoop.apache.org/job/tez-multibranch/job/PR-162/3/artifact/out/Dockerfile
GITHUB PR#162
JIRA IssueTEZ-4350
Optional Testsdupname asflicense xml javac javadoc unit spotbugs findbugs checkstyle compile
unameLinux 0f275da5d0a7 4.15.0-58-generic #64-Ubuntu SMP Tue Aug 6 11:12:41 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux
Build toolmaven
Personalitypersonality/tez.sh
git revisionmaster / 267ca11
Default JavaPrivate Build-1.8.0_312-8u312-b07-0ubuntu1~20.04-b07
Multi-JDK versions/usr/lib/jvm/java-11-openjdk-amd64:Ubuntu-11.0.13+8-Ubuntu-0ubuntu1.20.04 /usr/lib/jvm/java-8-openjdk-amd64:Private Build-1.8.0_312-8u312-b07-0ubuntu1~20.04-b07
checkstylehttps://ci-hadoop.apache.org/job/tez-multibranch/job/PR-162/3/artifact/out/diff-checkstyle-tez-dag.txt
Test Resultshttps://ci-hadoop.apache.org/job/tez-multibranch/job/PR-162/3/testReport/
Max. process+thread count188 (vs. ulimit of 5500)
modulesC: tez-dag U: tez-dag
Console outputhttps://ci-hadoop.apache.org/job/tez-multibranch/job/PR-162/3/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.

@jteaglesjteagles 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.

+1. Reran Tez QA bot to verify findbugs results.

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.

4 participants

@abstractdog@tez-yetus@jteagles@shameersss1