[concurrency-interest] _interrupted field visibility bug in OpenJDK 7+

Aleksey Shipilev aleksey.shipilev at oracle.com
Wed Nov 7 19:33:05 EST 2012


This is still a bug; the checking for safepoint guarantees this thread
is responding to VM stop events, but not particularly to interrupt
events. The dissasembly for the plain
Thread.currentThread().isInterrupted()-checking loop rechecks the
interrupt flag as fine.

-Aleksey.

On 11/07/2012 06:44 PM, Vitaly Davidovich wrote:
> So looks like nothing to do with hoisting, eh? It simply enters a busy
> loop checking for safe points?
> 
> Sent from my phone
> 
> On Nov 7, 2012 6:30 PM, "Aleksey Shipilev" <aleksey.shipilev at oracle.com
> <mailto:aleksey.shipilev at oracle.com>> wrote:
> 
>     On 11/07/2012 06:19 PM, Aleksey Shipilev wrote:
>     > On 11/07/2012 05:00 PM, Dr Heinz M. Kabutz wrote:
>     >> As I said, the original code was more involved, but this demonstrates
>     >> the essentials.  I hope some of you might be able to take a look at
>     >> what's going on.
>     >
>     > Successfully reproduced the failure on JDK 7u7, Linux x86_64:
>     >   java version "1.7.0_07"
>     >   Java(TM) SE Runtime Environment (build 1.7.0_07-b10)
>     >   Java HotSpot(TM) 64-Bit Server VM (build 23.3-b01, mixed mode)
>     >
>     > Tests passes with -XX:-Inline. Will look at more detail shortly.
> 
>     This seems to be the miscompilation indeed:
> 
>     # {method} 'think' '()V' in 'InterruptedVisibilityTest'
>       ...
>       0x00007f31890601a3: mov    0x14(%r10),%r11d      // read $interrupted
>       0x00007f31890601a7: test   %r11d,%r11d           // test $interrupted
>       0x00007f31890601aa: jne    0x00007f31890601c9    // exit branch
>       0x00007f31890601ac: mov    %rbp,%r10             // LOOP START
>       0x00007f31890601af: test   %eax,0xb15ee4b(%rip)  // safepoint
>       0x00007f31890601b5: jmp    0x00007f31890601ac    // LOOP END
> 
>     Will raise the appropriate issue against OpenJDK once I finish with a
>     quick errand here. Thanks for the test case!
> 
>     -Aleksey.
> 
>     _______________________________________________
>     Concurrency-interest mailing list
>     Concurrency-interest at cs.oswego.edu
>     <mailto:Concurrency-interest at cs.oswego.edu>
>     http://cs.oswego.edu/mailman/listinfo/concurrency-interest
> 



More information about the Concurrency-interest mailing list