Workaround for JRE bug freezing the PDE #4079

Merged
merged 3 commits into from Feb 13, 2016

Conversation

Projects
None yet
2 participants
@JakubValtar
Contributor

JakubValtar commented Oct 30, 2015

Because of a JRE bug, code completion will occasionally freeze the PDE. Never seen this one before, however, it happened to me three times in a row while I was giving a lecture today and I had to kill the PDE and write all the code again. I can reproduce it back to beta 7. It is caused by JIT compiler, workaround is to disable it for this particular method. See https://bugs.openjdk.java.net/browse/JDK-8060036 and http://kingsfleet.blogspot.com.br/2014/11/but-thats-impossible-or-finding-out.html

JakubValtar added some commits Oct 30, 2015

Workaround for JRE bug freezing the PDE
Because of a JRE bug, code completion will occasionally freeze the PDE.
Never seen this one before, however, it happened to me three times in a
row while I was giving a lecture today and I had to kill the PDE and
write all the code again. I can reproduce it back to beta 7. It is
caused by JIT compiler, workaround is to disable it for this particular
method. See https://bugs.openjdk.java.net/browse/JDK-8060036 and
http://kingsfleet.blogspot.com.br/2014/11/but-thats-impossible-or-finding-out.html
Make CompletionCandidate immutable
This one goes from ASTGenerator on a background thread to the JList
which displays code suggestions. Until refactored, I'm making it
immutable with convenience methods returning mutated copies to prevent
possible threading issues.
@benfry

This comment has been minimized.

Show comment
Hide comment
@benfry

benfry Nov 1, 2015

Member

Is this only on Windows?

Member

benfry commented Nov 1, 2015

Is this only on Windows?

@JakubValtar

This comment has been minimized.

Show comment
Hide comment
@JakubValtar

JakubValtar Nov 1, 2015

Contributor

@benfry JDK bug is os generic. It's difficult to reproduce on demand, because it depends on when JIT compiles javax.swing.text.GlyphView#getBreakSpot method.

I can sometimes reproduce it by typing (not pasting) this line:

PFont.list();

then starting the sketch and then clicking between l and i and invoking suggestions with CTRL+Space. If the bug was triggered, no suggestions will show and PDE will start freezing and glitching out in a few seconds. Sometimes you will get just

Exception in thread "AWT-EventQueue-0" java.lang.ArrayIndexOutOfBoundsException

and PDE will remain operational.

When the bug happens, it looks like this:
glitch

Contributor

JakubValtar commented Nov 1, 2015

@benfry JDK bug is os generic. It's difficult to reproduce on demand, because it depends on when JIT compiles javax.swing.text.GlyphView#getBreakSpot method.

I can sometimes reproduce it by typing (not pasting) this line:

PFont.list();

then starting the sketch and then clicking between l and i and invoking suggestions with CTRL+Space. If the bug was triggered, no suggestions will show and PDE will start freezing and glitching out in a few seconds. Sometimes you will get just

Exception in thread "AWT-EventQueue-0" java.lang.ArrayIndexOutOfBoundsException

and PDE will remain operational.

When the bug happens, it looks like this:
glitch

@JakubValtar

This comment has been minimized.

Show comment
Hide comment
@JakubValtar

JakubValtar Dec 13, 2015

Contributor

Friend was asking me if it's normal that Processing is freezing regularly. Replacing processing.exe launcher by the one which uses this workaround solved it for her. She also uses Windows.

Contributor

JakubValtar commented Dec 13, 2015

Friend was asking me if it's normal that Processing is freezing regularly. Replacing processing.exe launcher by the one which uses this workaround solved it for her. She also uses Windows.

benfry added a commit that referenced this pull request Feb 13, 2016

Merge pull request #4079 from JakubValtar/jit-bug-workaround
Workaround for JRE bug freezing the PDE

@benfry benfry merged commit eb4e558 into processing:master Feb 13, 2016

@JakubValtar JakubValtar deleted the JakubValtar:jit-bug-workaround branch Apr 8, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment