Bug 1119308 - java-1.8.0-openjdk: Infinite recursion in java.util.regex.Pattern
Summary: java-1.8.0-openjdk: Infinite recursion in java.util.regex.Pattern
Alias: None
Product: Fedora
Classification: Fedora
Component: java-1.8.0-openjdk
Version: 21
Hardware: Unspecified
OS: Unspecified
Target Milestone: ---
Assignee: Deepak Bhole
QA Contact: Fedora Extras Quality Assurance
Depends On:
Blocks: 1111827
TreeView+ depends on / blocked
Reported: 2014-07-14 13:28 UTC by Mikolaj Izdebski
Modified: 2014-07-14 18:20 UTC (History)
4 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Last Closed: 2014-07-14 18:14:01 UTC

Attachments (Terms of Use)
Full build.log (73.38 KB, text/x-log)
2014-07-14 13:29 UTC, Mikolaj Izdebski
no flags Details

Description Mikolaj Izdebski 2014-07-14 13:28:43 UTC
Description of problem:
There seems to be infinite recursion in the following call:
	at java.util.regex.Pattern$GroupTail.match(Pattern.java:4717)
	at java.util.regex.Pattern$BranchConn.match(Pattern.java:4568)
	at java.util.regex.Pattern$CharProperty.match(Pattern.java:3777)
	at java.util.regex.Pattern$Branch.match(Pattern.java:4604)
	at java.util.regex.Pattern$GroupHead.match(Pattern.java:4658)
	at java.util.regex.Pattern$Loop.match(Pattern.java:4785)

Version-Release number of selected component (if applicable):

How reproducible:
on Koji on i686. Not reproducible locally on x86_64.

Steps to Reproduce:
koji build --scratch f21 'git://pkgs.fedoraproject.org/jflex?#558dccaeb2000d132b209a27d2b24cea42971ea3'

Actual results:
Build fails with java.lang.StackOverflowError: null
There is infinite recursion in java.util.regex.Pattern

Expected results:
No stach overflow

Comment 1 Mikolaj Izdebski 2014-07-14 13:29:09 UTC
Created attachment 917823 [details]
Full build.log

Comment 2 Deepak Bhole 2014-07-14 18:14:01 UTC
This is not a problem with the JDK.

The pattern that the system ultimately tries to compile/search during the test is in Emitter.java:

      = Pattern.compile
          (".*/\\*\\*(.*)\\*/"               // javadoc comment, embedded '*/' disallowed
          +"(?:\\s*@[a-z][a-z0-9_]*(?:\\.[a-z][a-z0-9_]*)*"        // @[p.ack.age.]AnnotationClass
          +"   (?:\\s*\\(\\s*(?:\"(?:\\\"|[^\"])*\""               // ignore close parens in double quotes
          +"                   |'(?:[^']|\\\\(?:'|u[0-9a-f]{4}))'" // ignore close parens in single quotes
          +"                   |[^)])+\\))?"                       // optional annotation params
          +")*\\s*",                         // zero or more annotations, followed by optional whitespace
           Pattern.DOTALL | Pattern.CASE_INSENSITIVE | Pattern.COMMENTS);

That seems like a very complicated pattern that likely needs revision.

The reason why this is happening on only x86 is because on x86, the default stack size is smaller (320k) compared to x86_64 where the stack size is 1024k.

Patterns can always be created such that they will caused a stack overflow. Either the pattern needs to be updated or the stack size needs to be changed.

Running the test with stack size 1024k (-Xss1024k) allows it to pass on i686 where it otherwise fails.

See also: http://bugs.java.com/bugdatabase/view_bug.do?bug_id=5050507

Comment 3 Mikolaj Izdebski 2014-07-14 18:20:00 UTC
Thank you for quick reply.
I will go with increasing stack size for running tests.

Note You need to log in before you can comment on or make changes to this bug.