JDK-8280873 : Compile with long and deeply statement is prohibitively slow
  • Type: Bug
  • Component: tools
  • Sub-Component: javac
  • Affected Version: 8-pool
  • Priority: P3
  • Status: Closed
  • Resolution: Duplicate
  • OS: generic
  • CPU: generic
  • Submitted: 2022-01-26
  • Updated: 2022-01-31
  • Resolved: 2022-01-31
Related Reports
Duplicate :  
Description
ADDITIONAL SYSTEM INFORMATION :
jdk8(1.8.0_312, 1.8.0_231) 64bits
any os (win10, mac)
Apache Maven 3.6.3 (cecedd343002696d0abb50b32b541b8a6ba2883f)
Maven home: /Users/liuxun/Documents/apache-maven-3.6.3
Java version: 1.8.0_231, vendor: Oracle Corporation, runtime: /Library/Java/JavaVirtualMachines/jdk1.8.0_231.jdk/Contents/Home/jre
Default locale: zh_CN, platform encoding: UTF-8
OS name: "mac os x", version: "10.16", arch: "x86_64", family: "mac"

A DESCRIPTION OF THE PROBLEM :
please see steps to reproduce below.
see relation issues please refer:
https://github.com/spring-projects/spring-boot/issues/29562
and
https://issues.apache.org/jira/browse/MNG-7398

REGRESSION : Last worked in version 8

STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
1: use this file to repeat it:
https://github.com/spring-projects/spring-boot/files/7934608/build-with-long-statement-is-prohibitively-slow.zip
2: unzip it, and use maven to build it on top of the project: mvn clean package -X
then, it keeped always in processing, no errors, no timeout, no more info, but in processing status.
3: please focus on file: com.chwod.robot.action.general.service.relation.RelationMappingService.java
there is a static block, it's containts a long and deeply statement. if remove it, then rebuild as step 2, it build complete quickly;
4: When the build is stuck in-flight, it looks like javac is busy with:

"main" #1 prio=5 os_prio=31 tid=0x00007f9cf8012000 nid=0x2303 runnable [0x0000700008295000]
   java.lang.Thread.State: RUNNABLE
	at java.lang.Object.hashCode(Native Method)
	at java.util.HashMap.hash(HashMap.java:340)
	at java.util.HashMap.get(HashMap.java:558)

and you can see that javac blocks your machine. In fact, it consumes up to 800% here. Java 11 and 16 compile instantly


EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
compile complete instantly
ACTUAL -
compile complete prohibitively slow

---------- BEGIN SOURCE ----------
empty
---------- END SOURCE ----------

CUSTOMER SUBMITTED WORKAROUND :
no idea

FREQUENCY : always



Comments
Seems like a duplicate if JDK-8078093?
31-01-2022

The issue is reproducible in JDK 8-pool. The compilation freezes with huge CPU usage. It is not reproducible JDK 9 onwards. The bug can be reproduced by using mvn clean package The file com.chwod.robot.action.general.service.relation.RelationMappingService.java has long and deep statements that cause the issue.
28-01-2022