Array length: behaves like a metadata or a field?

classic Classic list List threaded Threaded
31 messages Options
12
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Array length: behaves like a metadata or a field?

Aleksey Shipilev-3
Hi,

I need to think out loud about this, because I want to put down some jcstress
tests that assert the expected behavior.

Start with a simple test like this:

@JCStressTest
class ArrayElement {
    Object arr;

    @Actor
    public void actor1() {
        arr = new int[1];
    }

    @Actor
    public void actor2(I_Result r) {
        int[] a = arr;
        if (a != null) {
          r.r1 = a[0];
        } else {
          r.r1 = -1;
        }
    }
}

Would you say (r1) = (0) is allowed? JMM allows this, because the array is
published via the race.

Now to a little trickier example:

@JCStressTest
class ArrayClass {
    Object arr;

    @Actor
    public void actor1() {
        arr = new int[1];
    }

    @Actor
    public void actor2(Z_Result r) {
        Object a = arr;
        if (a != null) {
          r.r1 = (a.getClass() == int[].class);
        } else {
          r.r1 = true;
        }
    }
}

...would you say (r1) = (false) is allowed?

The spec is murky at this point, because you don't know what getClass() invoke
sequence is doing, and what getClass() does inside. At least in Hotspot, the
invocation reads the klassptr from the object to figure out the vtbl to call the
method off, and then getClass() itself returns the Java mirror of that klassptr.
Machine-wise it is reading at the object offset, like a regular field access does.

So it should be false,  otherwise the call to getClass would probably crash the
JVM, trying to call the virtual method off the broken vtbl pointer. We can say
that object metadata is so important for JVM that it protects it from the races.
(This is one of the reasons why final-by-default mechanics can be cheap: we
"only" need to extend those guarantees to all field writes, not only the header)

Now, a trickiest question of all: what about array.length?

E.g.:

@JCStressTest
class ArrayLength {
    Object arr;

    @Actor
    public void actor1() {
        arr = new int[1];
    }

    @Actor
    public void actor2(I_Result r) {
        Object a = arr;
        if (a != null) {
          r.r1 = ((int[])a).length;
        } else {
          r.r1 = -1;
        }
    }
}

Would you say the result (r1) = (0) is plausible? In other words, do we expect
the arraylength to act like a field (thus allowing 0), or act like a metadata
(thus disallowing 0)?

Thanks,
-Aleksey


_______________________________________________
Concurrency-interest mailing list
[hidden email]
http://cs.oswego.edu/mailman/listinfo/concurrency-interest

signature.asc (836 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Array length: behaves like a metadata or a field?

Aleksey Shipilev-3
On 03/28/2017 02:11 PM, Aleksey Shipilev wrote:

> Start with a simple test like this:
>
> @JCStressTest
> class ArrayElement {
>     Object arr;
>
>     @Actor
>     public void actor1() {
>         arr = new int[1];
>     }
>
>     @Actor
>     public void actor2(I_Result r) {
>         int[] a = arr;
>         if (a != null) {
>           r.r1 = a[0];
>         } else {
>           r.r1 = -1;
>         }
>     }
> }
>
> Would you say (r1) = (0) is allowed? JMM allows this, because the array is
> published via the race.
Yes, actor1() should also do arr[0] = 1, but you know what I mean.

-Aleksey



_______________________________________________
Concurrency-interest mailing list
[hidden email]
http://cs.oswego.edu/mailman/listinfo/concurrency-interest

signature.asc (836 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Array length: behaves like a metadata or a field?

Alex Otenko
In reply to this post by Aleksey Shipilev-3
Object class and array length should behave like a final: once you observe the object, you should never observe the class or length change.

Alex

> On 28 Mar 2017, at 13:11, Aleksey Shipilev <[hidden email]> wrote:
>
> Hi,
>
> I need to think out loud about this, because I want to put down some jcstress
> tests that assert the expected behavior.
>
> Start with a simple test like this:
>
> @JCStressTest
> class ArrayElement {
>    Object arr;
>
>    @Actor
>    public void actor1() {
>        arr = new int[1];
>    }
>
>    @Actor
>    public void actor2(I_Result r) {
>        int[] a = arr;
>        if (a != null) {
>          r.r1 = a[0];
>        } else {
>          r.r1 = -1;
>        }
>    }
> }
>
> Would you say (r1) = (0) is allowed? JMM allows this, because the array is
> published via the race.
>
> Now to a little trickier example:
>
> @JCStressTest
> class ArrayClass {
>    Object arr;
>
>    @Actor
>    public void actor1() {
>        arr = new int[1];
>    }
>
>    @Actor
>    public void actor2(Z_Result r) {
>        Object a = arr;
>        if (a != null) {
>          r.r1 = (a.getClass() == int[].class);
>        } else {
>          r.r1 = true;
>        }
>    }
> }
>
> ...would you say (r1) = (false) is allowed?
>
> The spec is murky at this point, because you don't know what getClass() invoke
> sequence is doing, and what getClass() does inside. At least in Hotspot, the
> invocation reads the klassptr from the object to figure out the vtbl to call the
> method off, and then getClass() itself returns the Java mirror of that klassptr.
> Machine-wise it is reading at the object offset, like a regular field access does.
>
> So it should be false,  otherwise the call to getClass would probably crash the
> JVM, trying to call the virtual method off the broken vtbl pointer. We can say
> that object metadata is so important for JVM that it protects it from the races.
> (This is one of the reasons why final-by-default mechanics can be cheap: we
> "only" need to extend those guarantees to all field writes, not only the header)
>
> Now, a trickiest question of all: what about array.length?
>
> E.g.:
>
> @JCStressTest
> class ArrayLength {
>    Object arr;
>
>    @Actor
>    public void actor1() {
>        arr = new int[1];
>    }
>
>    @Actor
>    public void actor2(I_Result r) {
>        Object a = arr;
>        if (a != null) {
>          r.r1 = ((int[])a).length;
>        } else {
>          r.r1 = -1;
>        }
>    }
> }
>
> Would you say the result (r1) = (0) is plausible? In other words, do we expect
> the arraylength to act like a field (thus allowing 0), or act like a metadata
> (thus disallowing 0)?
>
> Thanks,
> -Aleksey
>
> _______________________________________________
> Concurrency-interest mailing list
> [hidden email]
> http://cs.oswego.edu/mailman/listinfo/concurrency-interest

_______________________________________________
Concurrency-interest mailing list
[hidden email]
http://cs.oswego.edu/mailman/listinfo/concurrency-interest
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Array length: behaves like a metadata or a field?

Viktor Klang
In reply to this post by Aleksey Shipilev-3
I would say 0 is allowed.

--
Cheers,

On Mar 28, 2017 2:21 PM, "Aleksey Shipilev" <[hidden email]> wrote:
On 03/28/2017 02:11 PM, Aleksey Shipilev wrote:
> Start with a simple test like this:
>
> @JCStressTest
> class ArrayElement {
>     Object arr;
>
>     @Actor
>     public void actor1() {
>         arr = new int[1];
>     }
>
>     @Actor
>     public void actor2(I_Result r) {
>         int[] a = arr;
>         if (a != null) {
>           r.r1 = a[0];
>         } else {
>           r.r1 = -1;
>         }
>     }
> }
>
> Would you say (r1) = (0) is allowed? JMM allows this, because the array is
> published via the race.

Yes, actor1() should also do arr[0] = 1, but you know what I mean.

-Aleksey



_______________________________________________
Concurrency-interest mailing list
[hidden email]
http://cs.oswego.edu/mailman/listinfo/concurrency-interest


_______________________________________________
Concurrency-interest mailing list
[hidden email]
http://cs.oswego.edu/mailman/listinfo/concurrency-interest
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Array length: behaves like a metadata or a field?

Aleksey Shipilev-3
For array length? See the ArrayLength example, not ArrayElement.
I agree "0" is allowed in ArrayElement.

-Aleksey

On 03/28/2017 02:24 PM, Viktor Klang wrote:

> I would say 0 is allowed.
>
> --
> Cheers,
> √
>
> On Mar 28, 2017 2:21 PM, "Aleksey Shipilev" <[hidden email]
> <mailto:[hidden email]>> wrote:
>
>     On 03/28/2017 02:11 PM, Aleksey Shipilev wrote:
>     > Start with a simple test like this:
>     >
>     > @JCStressTest
>     > class ArrayElement {
>     >     Object arr;
>     >
>     >     @Actor
>     >     public void actor1() {
>     >         arr = new int[1];
>     >     }
>     >
>     >     @Actor
>     >     public void actor2(I_Result r) {
>     >         int[] a = arr;
>     >         if (a != null) {
>     >           r.r1 = a[0];
>     >         } else {
>     >           r.r1 = -1;
>     >         }
>     >     }
>     > }
>     >
>     > Would you say (r1) = (0) is allowed? JMM allows this, because the array is
>     > published via the race.
>
>     Yes, actor1() should also do arr[0] = 1, but you know what I mean.
>
>     -Aleksey
>
>
>
>     _______________________________________________
>     Concurrency-interest mailing list
>     [hidden email] <mailto:[hidden email]>
>     http://cs.oswego.edu/mailman/listinfo/concurrency-interest
>     <http://cs.oswego.edu/mailman/listinfo/concurrency-interest>
>

_______________________________________________
Concurrency-interest mailing list
[hidden email]
http://cs.oswego.edu/mailman/listinfo/concurrency-interest

signature.asc (836 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Array length: behaves like a metadata or a field?

Aleksey Shipilev-3
In reply to this post by Alex Otenko
On 03/28/2017 02:23 PM, Alex Otenko wrote:
> Object class and array length should behave like a final: once you observe
> the object, you should never observe the class or length change.

Let me play Devil's Advocate here.

"Should" reads as something that is guaranteed by spec, right? I cannot find
anything in the spec text that requires reading object class or array length
consistently.

I can whip up the argument that non-visible object class in a racy access is the
recipe for JVM crash, and so it should be protected in practical
implementations. I cannot stretch that argument to arraylength, because 0 length
does not look something that leads to VM crash. Is there a practical argument
for protecting arraylength -- which shows that failing to do this we have a
serious problem?

-Aleksey


_______________________________________________
Concurrency-interest mailing list
[hidden email]
http://cs.oswego.edu/mailman/listinfo/concurrency-interest

signature.asc (836 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Array length: behaves like a metadata or a field?

Viktor Klang
For ArrayLength:

If nothing else, if length is the only "technical" field in an array, and it is final, there ought to be a store-barrier at the end of its "constructor"?

For ArrayClass I'd answer the same as the answer above.

Would be intrigued to learn I was wrong tho.

--
Cheers,

On Mar 28, 2017 2:39 PM, "Aleksey Shipilev" <[hidden email]> wrote:
On 03/28/2017 02:23 PM, Alex Otenko wrote:
> Object class and array length should behave like a final: once you observe
> the object, you should never observe the class or length change.

Let me play Devil's Advocate here.

"Should" reads as something that is guaranteed by spec, right? I cannot find
anything in the spec text that requires reading object class or array length
consistently.

I can whip up the argument that non-visible object class in a racy access is the
recipe for JVM crash, and so it should be protected in practical
implementations. I cannot stretch that argument to arraylength, because 0 length
does not look something that leads to VM crash. Is there a practical argument
for protecting arraylength -- which shows that failing to do this we have a
serious problem?

-Aleksey


_______________________________________________
Concurrency-interest mailing list
[hidden email]
http://cs.oswego.edu/mailman/listinfo/concurrency-interest



_______________________________________________
Concurrency-interest mailing list
[hidden email]
http://cs.oswego.edu/mailman/listinfo/concurrency-interest
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Array length: behaves like a metadata or a field?

Alex Otenko
In reply to this post by Aleksey Shipilev-3
Object class and array length are fixed by language spec, so observing different values violates language semantics. No one codes expecting object class or array length to change, like no one codes expecting String.charAt return different results for the same index.


Alex


> On 28 Mar 2017, at 13:33, Aleksey Shipilev <[hidden email]> wrote:
>
> On 03/28/2017 02:23 PM, Alex Otenko wrote:
>> Object class and array length should behave like a final: once you observe
>> the object, you should never observe the class or length change.
>
> Let me play Devil's Advocate here.
>
> "Should" reads as something that is guaranteed by spec, right? I cannot find
> anything in the spec text that requires reading object class or array length
> consistently.
>
> I can whip up the argument that non-visible object class in a racy access is the
> recipe for JVM crash, and so it should be protected in practical
> implementations. I cannot stretch that argument to arraylength, because 0 length
> does not look something that leads to VM crash. Is there a practical argument
> for protecting arraylength -- which shows that failing to do this we have a
> serious problem?
>
> -Aleksey
>

_______________________________________________
Concurrency-interest mailing list
[hidden email]
http://cs.oswego.edu/mailman/listinfo/concurrency-interest
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Array length: behaves like a metadata or a field?

David Holmes-6
In reply to this post by Aleksey Shipilev-3
> -----Original Message-----
> From: Concurrency-interest [mailto:concurrency-interest-
> [hidden email]] On Behalf Of Aleksey Shipilev
> Sent: Tuesday, March 28, 2017 10:34 PM
> To: Alex Otenko <[hidden email]>
> Cc: [hidden email]
> Subject: Re: [concurrency-interest] Array length: behaves like a metadata
or
> a field?
>
> On 03/28/2017 02:23 PM, Alex Otenko wrote:
> > Object class and array length should behave like a final: once you
observe
> > the object, you should never observe the class or length change.
>
> Let me play Devil's Advocate here.
>
> "Should" reads as something that is guaranteed by spec, right? I cannot
find
> anything in the spec text that requires reading object class or array
length
> consistently.

As others have pointed out the array length is treated as a final field.

For getClass() it returns the Class object of which the target is an
instance. There is no "best effort" here, it can't fail and it can't produce
an arbitrary value "out of thin air".

David
------------
 
> I can whip up the argument that non-visible object class in a racy access
is the
> recipe for JVM crash, and so it should be protected in practical
> implementations. I cannot stretch that argument to arraylength, because 0
> length
> does not look something that leads to VM crash. Is there a practical
argument
> for protecting arraylength -- which shows that failing to do this we have
a
> serious problem?
>
> -Aleksey


_______________________________________________
Concurrency-interest mailing list
[hidden email]
http://cs.oswego.edu/mailman/listinfo/concurrency-interest
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Array length: behaves like a metadata or a field?

Alex Otenko
In reply to this post by Aleksey Shipilev-3
Devil’s Prosecutor: is it allowed for array.class to be java.lang.Object then? Would that crash the JVM? Why? Is it because the JVM expected it to be an array? :)

Alex

> On 28 Mar 2017, at 13:33, Aleksey Shipilev <[hidden email]> wrote:
>
> On 03/28/2017 02:23 PM, Alex Otenko wrote:
>> Object class and array length should behave like a final: once you observe
>> the object, you should never observe the class or length change.
>
> Let me play Devil's Advocate here.
>
> "Should" reads as something that is guaranteed by spec, right? I cannot find
> anything in the spec text that requires reading object class or array length
> consistently.
>
> I can whip up the argument that non-visible object class in a racy access is the
> recipe for JVM crash, and so it should be protected in practical
> implementations. I cannot stretch that argument to arraylength, because 0 length
> does not look something that leads to VM crash. Is there a practical argument
> for protecting arraylength -- which shows that failing to do this we have a
> serious problem?
>
> -Aleksey
>

_______________________________________________
Concurrency-interest mailing list
[hidden email]
http://cs.oswego.edu/mailman/listinfo/concurrency-interest
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Array length: behaves like a metadata or a field?

Aleksey Shipilev-3
In reply to this post by Alex Otenko
On 03/28/2017 02:59 PM, Alex Otenko wrote:
> Object class and array length are fixed by language spec, so observing
> different values violates language semantics.

Oh, that's the way out: with plain fields, we have a default initialization that
you can observe under the race, but for object class and array length there is
no such "zero" init.

In other words, memory model rules govern what is visible across threads, and
the rest of language spec defines what is the value domain of the observable
values. For metadata there is no "default" values to see.

> No one codes expecting object class or array length to change, like no one
> codes expecting String.charAt return different results for the same index.

What users expect is not something that is guaranteed :)

-Aleksey


_______________________________________________
Concurrency-interest mailing list
[hidden email]
http://cs.oswego.edu/mailman/listinfo/concurrency-interest

signature.asc (836 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Array length: behaves like a metadata or a field?

Aleksey Shipilev-3
In reply to this post by David Holmes-6
On 03/28/2017 03:02 PM, David Holmes wrote:
> As others have pointed out the array length is treated as a final field.

I was struggling to find how specification guarantees that. "No default init for
array length" seems to be the answer.

> For getClass() it returns the Class object of which the target is an
> instance. There is no "best effort" here, it can't fail and it can't produce
> an arbitrary value "out of thin air".

Yes. Except that for getClass() virtual call you can _theoretically_ fail when
performing the invocation if klassptr is broken, thus the getClass() internals
are irrelevant. This was my argument for ArrayClass case: you need klassptr to
perform virtual calls.

I realized that there is a similar arraylength argument: without it, the array
published under the race would set up GC which can try to copy it for heap
corruption and eventual crash.

Thanks,
-Aleksey


_______________________________________________
Concurrency-interest mailing list
[hidden email]
http://cs.oswego.edu/mailman/listinfo/concurrency-interest

signature.asc (836 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Array length: behaves like a metadata or a field?

Aleksey Shipilev-3
In reply to this post by Aleksey Shipilev-3
On 03/28/2017 02:11 PM, Aleksey Shipilev wrote:

> @JCStressTest
> class ArrayLength {
>     Object arr;
>
>     @Actor
>     public void actor1() {
>         arr = new int[1];
>     }
>
>     @Actor
>     public void actor2(I_Result r) {
>         Object a = arr;
>         if (a != null) {
>           r.r1 = ((int[])a).length;
>         } else {
>           r.r1 = -1;
>         }
>     }
> }
>
> Would you say the result (r1) = (0) is plausible? In other words, do we expect
> the arraylength to act like a field (thus allowing 0), or act like a metadata
> (thus disallowing 0)?
Valentin Kovalenko gives the link to authoritative answer to this:

"The semantics of operations other than inter-thread actions, such as reads of
array lengths (§10.7), executions of checked casts (§5.5, §15.16), and
invocations of virtual methods (§15.12), are not directly affected by data
races. Therefore, a data race cannot cause incorrect behavior such as returning
the wrong length for an array."
 https://docs.oracle.com/javase/specs/jls/se8/html/jls-17.html#jls-17.4.5

So the arraylength cannot be observed inconsistently.

Silly me, I paged out that part of the spec from my head.

-Aleksey


_______________________________________________
Concurrency-interest mailing list
[hidden email]
http://cs.oswego.edu/mailman/listinfo/concurrency-interest

signature.asc (836 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Array length: behaves like a metadata or a field?

Nathan & Ila Reynolds
Perhaps this is a concern but perhaps GC is well protected.  The GC threads have to see the proper array length and object type.  As pointed out earlier, if GC does not see the proper array length, then heap corruption will happen.  If GC does not see the proper object type, then references will be missed and objects may be prematurely collected.

-Nathan

-----Original Message-----
From: Concurrency-interest [mailto:[hidden email]] On Behalf Of Aleksey Shipilev
Sent: Tuesday, March 28, 2017 7:39 AM
To: [hidden email]; Valentin Kovalenko <[hidden email]>
Subject: Re: [concurrency-interest] Array length: behaves like a metadata or a field?

On 03/28/2017 02:11 PM, Aleksey Shipilev wrote:

> @JCStressTest
> class ArrayLength {
>     Object arr;
>
>     @Actor
>     public void actor1() {
>         arr = new int[1];
>     }
>
>     @Actor
>     public void actor2(I_Result r) {
>         Object a = arr;
>         if (a != null) {
>           r.r1 = ((int[])a).length;
>         } else {
>           r.r1 = -1;
>         }
>     }
> }
>
> Would you say the result (r1) = (0) is plausible? In other words, do
> we expect the arraylength to act like a field (thus allowing 0), or
> act like a metadata (thus disallowing 0)?

Valentin Kovalenko gives the link to authoritative answer to this:

"The semantics of operations other than inter-thread actions, such as reads of array lengths (§10.7), executions of checked casts (§5.5, §15.16), and invocations of virtual methods (§15.12), are not directly affected by data races. Therefore, a data race cannot cause incorrect behavior such as returning the wrong length for an array."
 https://docs.oracle.com/javase/specs/jls/se8/html/jls-17.html#jls-17.4.5

So the arraylength cannot be observed inconsistently.

Silly me, I paged out that part of the spec from my head.

-Aleksey


_______________________________________________
Concurrency-interest mailing list
[hidden email]
http://cs.oswego.edu/mailman/listinfo/concurrency-interest
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Array length: behaves like a metadata or a field?

David Holmes-6
In reply to this post by Aleksey Shipilev-3
> Aleksey Shipilev writes:
> On 03/28/2017 03:02 PM, David Holmes wrote:
> > As others have pointed out the array length is treated as a final field.
>
> I was struggling to find how specification guarantees that. "No default
init for
> array length" seems to be the answer.

JLS 10.7 states it is a final field. Default init doesn't come into it
because you can't publish an array in the middle of construction.
 
> > For getClass() it returns the Class object of which the target is an
> > instance. There is no "best effort" here, it can't fail and it can't
produce
> > an arbitrary value "out of thin air".
>
> Yes. Except that for getClass() virtual call you can _theoretically_ fail
when
> performing the invocation if klassptr is broken, thus the getClass()
internals
> are irrelevant. This was my argument for ArrayClass case: you need
klassptr
> to
> perform virtual calls.

If the getClass() implementation is broken that is  a bug. The behavioural
specification of getClass() is quite clear. It is up to the implementors to
realize what they need to do to ensure that in a concurrent world.

Cheers,
David

 
> I realized that there is a similar arraylength argument: without it, the
array
> published under the race would set up GC which can try to copy it for heap
> corruption and eventual crash.
>
> Thanks,
> -Aleksey


_______________________________________________
Concurrency-interest mailing list
[hidden email]
http://cs.oswego.edu/mailman/listinfo/concurrency-interest
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

hold lock thread in thread dump

Gang Yan
In reply to this post by Aleksey Shipilev-3
Hi all:

I have a problem:

75 threads wait same lock, but not found hold lock thread from thread dump. someone recommend add option" -XX:+PrintConcurrentLocks" but affect performance. How to find out who hold lock ?

"[STUCK] ExecuteThread: '20' for queue: 'weblogic.kernel.Default (self-tuning)'" id=571 idx=0x2f8 tid=19406 prio=1 alive, parked, native_blocked, daemon
         -- Parking to wait for: java/util/concurrent/locks/ReentrantReadWriteLock$NonfairSync@0x8646d730
         at jrockit/vm/Locks.park0(J)V(Native Method)
         at jrockit/vm/Locks.park(Locks.java:2230)[inlined]
         at jrockit/proxy/sun/misc/Unsafe.park(Unsafe.java:616)[inlined]
         at java/util/concurrent/locks/LockSupport.park(LockSupport.java:156)[inlined]
         at java/util/concurrent/locks/AbstractQueuedSynchronizer.parkAndCheckInterrupt(AbstractQueuedSynchronizer.java:811)[inlined]
         at java/util/concurrent/locks/AbstractQueuedSynchronizer.doAcquireShared(AbstractQueuedSynchronizer.java:941)[inlined]
         at java/util/concurrent/locks/AbstractQueuedSynchronizer.acquireShared(AbstractQueuedSynchronizer.java:1261)[inlined]
         at java/util/concurrent/locks/ReentrantReadWriteLock$ReadLock.lock(ReentrantReadWriteLock.java:695)[optimized]
         at oracle/security/jps/az/common/util/JpsLock.lock(JpsLock.java:81)
         at oracle/security/jps/az/internal/runtime/service/PDPServiceImpl.getApplicationPolicy(PDPServiceImpl.java:850)
         at oracle/security/jps/az/internal/runtime/service/PDPServiceImpl.getApplicationPolicy(PDPServiceImpl.java:810)
         at oracle/security/jps/internal/policystore/PolicyUtil.getGrantedAppRoles(PolicyUtil.java:3042)
         at oracle/security/jps/internal/policystore/PolicyUtil.getJpsAppRoles(PolicyUtil.java:1977)
         at oracle/security/jps/internal/policystore/PolicyUtil.getJpsAppRoles(PolicyUtil.java:1922)
         at oracle/security/jps/internal/core/util/SubjectResolverComputor$1.run(SubjectResolverComputor.java:152)
         at oracle/security/jps/internal/core/util/SubjectResolverComputor$1.run(SubjectResolverComputor.java:143)
         at jrockit/vm/AccessController.doPrivileged(AccessController.java:254)[inlined]
         at jrockit/vm/AccessController.doPrivileged(AccessController.java:268)[optimized]
         at oracle/security/jps/internal/core/util/SubjectResolverComputor.getAppRoles(SubjectResolverComputor.java:143)
         at oracle/security/jps/internal/core/util/SubjectResolverComputor.compute(SubjectResolverComputor.java:123)
         at oracle/security/jps/internal/core/util/SubjectResolverCacheImpl.computeJpsSubject(SubjectResolverCacheImpl.java:207)
         at oracle/security/jps/az/internal/runtime/service/PDPServiceImpl.computeJpsSubject(PDPServiceImpl.java:2396)
         at oracle/security/jps/internal/jaas/JpsAbsSubjectResolver.resolveJpsSubject(JpsAbsSubjectResolver.java:216)
         at oracle/security/jps/internal/jaas/JpsAbsSubjectResolver.resolveSubject(JpsAbsSubjectResolver.java:175)
         at oracle/security/jps/ee/ejb/JpsAbsInterceptor.intercept(JpsAbsInterceptor.java:123)
         at oracle/security/jps/ee/ejb/JpsInterceptor.intercept(JpsInterceptor.java:113)
         at sun/reflect/GeneratedMethodAccessor1293.invoke(Ljava/lang/Object;[Ljava/lang/Object;)Ljava/lang/Object;(Unknown Source)
         at sun/reflect/DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)[optimized]
         at java/lang/reflect/Method.invoke(Method.java:597)[optimized]
         at com/bea/core/repackaged/springframework/aop/support/AopUtils.invokeJoinpointUsingReflection(AopUtils.java:310)
         at com/oracle/pitchfork/intercept/JeeInterceptorInterceptor.invoke(JeeInterceptorInterceptor.java:68)
         at com/bea/core/repackaged/springframework/aop/framework/ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
         at com/bea/core/repackaged/springframework/aop/support/DelegatingIntroductionInterceptor.doProceed(DelegatingIntroductionInterceptor.java:131)
         at com/bea/core/repackaged/springframework/aop/support/DelegatingIntroductionInterceptor.invoke(DelegatingIntroductionInterceptor.java:119)
         at com/bea/core/repackaged/springframework/aop/framework/ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
         at com/oracle/pitchfork/spi/MethodInvocationVisitorImpl.visit(MethodInvocationVisitorImpl.java:34)
        at weblogic/ejb/container/injection/EnvironmentInterceptorCallbackImpl.callback(EnvironmentInterceptorCallbackImpl.java:54)
         at com/oracle/pitchfork/spi/EnvironmentInterceptor.invoke(EnvironmentInterceptor.java:42)
         at com/bea/core/repackaged/springframework/aop/framework/ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
         at com/bea/core/repackaged/springframework/aop/interceptor/ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:89)
         at com/bea/core/repackaged/springframework/aop/framework/ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
         at com/bea/core/repackaged/springframework/aop/support/DelegatingIntroductionInterceptor.doProceed(DelegatingIntroductionInterceptor.java:131)
         at com/bea/core/repackaged/springframework/aop/support/DelegatingIntroductionInterceptor.invoke(DelegatingIntroductionInterceptor.java:119)
         at com/bea/core/repackaged/springframework/aop/framework/ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
         at com/bea/core/repackaged/springframework/aop/framework/JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
         at com/sun/proxy/$Proxy344.destroyWorkflowContext(Loracle/bpel/services/workflow/verification/IWorkflowContext;)V(Unknown Source)
         at oracle/bpel/services/workflow/query/ejb/TaskQueryService_oz1ipg_EOImpl.__WL_invoke(Ljava/lang/Object;[Ljava/lang/Object;I)Ljava/lang/Object;(Unknown Source)
         at weblogic/ejb/container/internal/SessionRemoteMethodInvoker.invoke(SessionRemoteMethodInvoker.java:40)
         at oracle/bpel/services/workflow/query/ejb/TaskQueryService_oz1ipg_EOImpl.destroyWorkflowContext(Loracle/bpel/services/workflow/verification/IWorkflowContext;)V(Unknown Source)
         at oracle/bpel/services/workflow/query/ejb/TaskQueryService_oz1ipg_EOImpl_WLSkel.invoke(ILweblogic/rmi/spi/InboundRequest;Lweblogic/rmi/spi/OutboundResponse;Ljava/lang/Object;)Lweblogic/rmi/spi/OutboundResponse;(Unknown Source)
         at weblogic/rmi/internal/BasicServerRef.invoke(BasicServerRef.java:674)[optimized]
         at weblogic/rmi/cluster/ClusterableServerRef.invoke(ClusterableServerRef.java:230)
         at weblogic/rmi/internal/BasicServerRef$1.run(BasicServerRef.java:526)[inlined]
         at weblogic/security/acl/internal/AuthenticatedSubject.doAs(AuthenticatedSubject.java:363)[inlined]
         at weblogic/security/service/SecurityManager.runAs(SecurityManager.java:146)[inlined]
         at weblogic/rmi/internal/BasicServerRef.handleRequest(BasicServerRef.java:523)[inlined]
         at weblogic/rmi/internal/wls/WLSExecuteRequest.run(WLSExecuteRequest.java:118)[optimized]
         at weblogic/work/ExecuteThread.execute(ExecuteThread.java:268)[optimized]
         at weblogic/work/ExecuteThread.run(ExecuteThread.java:226)
         at jrockit/vm/RNI.c2java(JJJJJ)V(Native Method)
_______________________________________________
Concurrency-interest mailing list
[hidden email]
http://cs.oswego.edu/mailman/listinfo/concurrency-interest
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: hold lock thread in thread dump

Alex Otenko
The holder may have moved on. Watch for stack overflows in history. When hard errors occur, the behaviour of the JVM is not guaranteed, and stack unwinding can miss finally statements, thus miss lock releases.

Alex

> On 30 Mar 2017, at 06:28, Gang Yan <[hidden email]> wrote:
>
> Hi all:
>
> I have a problem:
>
> 75 threads wait same lock, but not found hold lock thread from thread dump. someone recommend add option" -XX:+PrintConcurrentLocks" but affect performance. How to find out who hold lock ?
>
> "[STUCK] ExecuteThread: '20' for queue: 'weblogic.kernel.Default (self-tuning)'" id=571 idx=0x2f8 tid=19406 prio=1 alive, parked, native_blocked, daemon
>         -- Parking to wait for: java/util/concurrent/locks/ReentrantReadWriteLock$NonfairSync@0x8646d730
>         at jrockit/vm/Locks.park0(J)V(Native Method)
>         at jrockit/vm/Locks.park(Locks.java:2230)[inlined]
>         at jrockit/proxy/sun/misc/Unsafe.park(Unsafe.java:616)[inlined]
>         at java/util/concurrent/locks/LockSupport.park(LockSupport.java:156)[inlined]
>         at java/util/concurrent/locks/AbstractQueuedSynchronizer.parkAndCheckInterrupt(AbstractQueuedSynchronizer.java:811)[inlined]
>         at java/util/concurrent/locks/AbstractQueuedSynchronizer.doAcquireShared(AbstractQueuedSynchronizer.java:941)[inlined]
>         at java/util/concurrent/locks/AbstractQueuedSynchronizer.acquireShared(AbstractQueuedSynchronizer.java:1261)[inlined]
>         at java/util/concurrent/locks/ReentrantReadWriteLock$ReadLock.lock(ReentrantReadWriteLock.java:695)[optimized]
>         at oracle/security/jps/az/common/util/JpsLock.lock(JpsLock.java:81)
>         at oracle/security/jps/az/internal/runtime/service/PDPServiceImpl.getApplicationPolicy(PDPServiceImpl.java:850)
>         at oracle/security/jps/az/internal/runtime/service/PDPServiceImpl.getApplicationPolicy(PDPServiceImpl.java:810)
>         at oracle/security/jps/internal/policystore/PolicyUtil.getGrantedAppRoles(PolicyUtil.java:3042)
>         at oracle/security/jps/internal/policystore/PolicyUtil.getJpsAppRoles(PolicyUtil.java:1977)
>         at oracle/security/jps/internal/policystore/PolicyUtil.getJpsAppRoles(PolicyUtil.java:1922)
>         at oracle/security/jps/internal/core/util/SubjectResolverComputor$1.run(SubjectResolverComputor.java:152)
>         at oracle/security/jps/internal/core/util/SubjectResolverComputor$1.run(SubjectResolverComputor.java:143)
>         at jrockit/vm/AccessController.doPrivileged(AccessController.java:254)[inlined]
>         at jrockit/vm/AccessController.doPrivileged(AccessController.java:268)[optimized]
>         at oracle/security/jps/internal/core/util/SubjectResolverComputor.getAppRoles(SubjectResolverComputor.java:143)
>         at oracle/security/jps/internal/core/util/SubjectResolverComputor.compute(SubjectResolverComputor.java:123)
>         at oracle/security/jps/internal/core/util/SubjectResolverCacheImpl.computeJpsSubject(SubjectResolverCacheImpl.java:207)
>         at oracle/security/jps/az/internal/runtime/service/PDPServiceImpl.computeJpsSubject(PDPServiceImpl.java:2396)
>         at oracle/security/jps/internal/jaas/JpsAbsSubjectResolver.resolveJpsSubject(JpsAbsSubjectResolver.java:216)
>         at oracle/security/jps/internal/jaas/JpsAbsSubjectResolver.resolveSubject(JpsAbsSubjectResolver.java:175)
>         at oracle/security/jps/ee/ejb/JpsAbsInterceptor.intercept(JpsAbsInterceptor.java:123)
>         at oracle/security/jps/ee/ejb/JpsInterceptor.intercept(JpsInterceptor.java:113)
>         at sun/reflect/GeneratedMethodAccessor1293.invoke(Ljava/lang/Object;[Ljava/lang/Object;)Ljava/lang/Object;(Unknown Source)
>         at sun/reflect/DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)[optimized]
>         at java/lang/reflect/Method.invoke(Method.java:597)[optimized]
>         at com/bea/core/repackaged/springframework/aop/support/AopUtils.invokeJoinpointUsingReflection(AopUtils.java:310)
>         at com/oracle/pitchfork/intercept/JeeInterceptorInterceptor.invoke(JeeInterceptorInterceptor.java:68)
>         at com/bea/core/repackaged/springframework/aop/framework/ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
>         at com/bea/core/repackaged/springframework/aop/support/DelegatingIntroductionInterceptor.doProceed(DelegatingIntroductionInterceptor.java:131)
>         at com/bea/core/repackaged/springframework/aop/support/DelegatingIntroductionInterceptor.invoke(DelegatingIntroductionInterceptor.java:119)
>         at com/bea/core/repackaged/springframework/aop/framework/ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
>         at com/oracle/pitchfork/spi/MethodInvocationVisitorImpl.visit(MethodInvocationVisitorImpl.java:34)
>        at weblogic/ejb/container/injection/EnvironmentInterceptorCallbackImpl.callback(EnvironmentInterceptorCallbackImpl.java:54)
>         at com/oracle/pitchfork/spi/EnvironmentInterceptor.invoke(EnvironmentInterceptor.java:42)
>         at com/bea/core/repackaged/springframework/aop/framework/ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
>         at com/bea/core/repackaged/springframework/aop/interceptor/ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:89)
>         at com/bea/core/repackaged/springframework/aop/framework/ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
>         at com/bea/core/repackaged/springframework/aop/support/DelegatingIntroductionInterceptor.doProceed(DelegatingIntroductionInterceptor.java:131)
>         at com/bea/core/repackaged/springframework/aop/support/DelegatingIntroductionInterceptor.invoke(DelegatingIntroductionInterceptor.java:119)
>         at com/bea/core/repackaged/springframework/aop/framework/ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
>         at com/bea/core/repackaged/springframework/aop/framework/JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
>         at com/sun/proxy/$Proxy344.destroyWorkflowContext(Loracle/bpel/services/workflow/verification/IWorkflowContext;)V(Unknown Source)
>         at oracle/bpel/services/workflow/query/ejb/TaskQueryService_oz1ipg_EOImpl.__WL_invoke(Ljava/lang/Object;[Ljava/lang/Object;I)Ljava/lang/Object;(Unknown Source)
>         at weblogic/ejb/container/internal/SessionRemoteMethodInvoker.invoke(SessionRemoteMethodInvoker.java:40)
>         at oracle/bpel/services/workflow/query/ejb/TaskQueryService_oz1ipg_EOImpl.destroyWorkflowContext(Loracle/bpel/services/workflow/verification/IWorkflowContext;)V(Unknown Source)
>         at oracle/bpel/services/workflow/query/ejb/TaskQueryService_oz1ipg_EOImpl_WLSkel.invoke(ILweblogic/rmi/spi/InboundRequest;Lweblogic/rmi/spi/OutboundResponse;Ljava/lang/Object;)Lweblogic/rmi/spi/OutboundResponse;(Unknown Source)
>         at weblogic/rmi/internal/BasicServerRef.invoke(BasicServerRef.java:674)[optimized]
>         at weblogic/rmi/cluster/ClusterableServerRef.invoke(ClusterableServerRef.java:230)
>         at weblogic/rmi/internal/BasicServerRef$1.run(BasicServerRef.java:526)[inlined]
>         at weblogic/security/acl/internal/AuthenticatedSubject.doAs(AuthenticatedSubject.java:363)[inlined]
>         at weblogic/security/service/SecurityManager.runAs(SecurityManager.java:146)[inlined]
>         at weblogic/rmi/internal/BasicServerRef.handleRequest(BasicServerRef.java:523)[inlined]
>         at weblogic/rmi/internal/wls/WLSExecuteRequest.run(WLSExecuteRequest.java:118)[optimized]
>         at weblogic/work/ExecuteThread.execute(ExecuteThread.java:268)[optimized]
>         at weblogic/work/ExecuteThread.run(ExecuteThread.java:226)
>         at jrockit/vm/RNI.c2java(JJJJJ)V(Native Method)
> _______________________________________________
> Concurrency-interest mailing list
> [hidden email]
> http://cs.oswego.edu/mailman/listinfo/concurrency-interest

_______________________________________________
Concurrency-interest mailing list
[hidden email]
http://cs.oswego.edu/mailman/listinfo/concurrency-interest
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: hold lock thread in thread dump

Viktor Klang
IMO, Errors which may leave the JVM in an inconsistent state should always crash the JVM hard.

On Thu, Mar 30, 2017 at 9:18 AM, Alex Otenko <[hidden email]> wrote:
The holder may have moved on. Watch for stack overflows in history. When hard errors occur, the behaviour of the JVM is not guaranteed, and stack unwinding can miss finally statements, thus miss lock releases.

Alex

> On 30 Mar 2017, at 06:28, Gang Yan <[hidden email]> wrote:
>
> Hi all:
>
> I have a problem:
>
> 75 threads wait same lock, but not found hold lock thread from thread dump. someone recommend add option" -XX:+PrintConcurrentLocks" but affect performance. How to find out who hold lock ?
>
> "[STUCK] ExecuteThread: '20' for queue: 'weblogic.kernel.Default (self-tuning)'" id=571 idx=0x2f8 tid=19406 prio=1 alive, parked, native_blocked, daemon
>         -- Parking to wait for: java/util/concurrent/locks/ReentrantReadWriteLock$NonfairSync@0x8646d730
>         at jrockit/vm/Locks.park0(J)V(Native Method)
>         at jrockit/vm/Locks.park(Locks.java:2230)[inlined]
>         at jrockit/proxy/sun/misc/Unsafe.park(Unsafe.java:616)[inlined]
>         at java/util/concurrent/locks/LockSupport.park(LockSupport.java:156)[inlined]
>         at java/util/concurrent/locks/AbstractQueuedSynchronizer.parkAndCheckInterrupt(AbstractQueuedSynchronizer.java:811)[inlined]
>         at java/util/concurrent/locks/AbstractQueuedSynchronizer.doAcquireShared(AbstractQueuedSynchronizer.java:941)[inlined]
>         at java/util/concurrent/locks/AbstractQueuedSynchronizer.acquireShared(AbstractQueuedSynchronizer.java:1261)[inlined]
>         at java/util/concurrent/locks/ReentrantReadWriteLock$ReadLock.lock(ReentrantReadWriteLock.java:695)[optimized]
>         at oracle/security/jps/az/common/util/JpsLock.lock(JpsLock.java:81)
>         at oracle/security/jps/az/internal/runtime/service/PDPServiceImpl.getApplicationPolicy(PDPServiceImpl.java:850)
>         at oracle/security/jps/az/internal/runtime/service/PDPServiceImpl.getApplicationPolicy(PDPServiceImpl.java:810)
>         at oracle/security/jps/internal/policystore/PolicyUtil.getGrantedAppRoles(PolicyUtil.java:3042)
>         at oracle/security/jps/internal/policystore/PolicyUtil.getJpsAppRoles(PolicyUtil.java:1977)
>         at oracle/security/jps/internal/policystore/PolicyUtil.getJpsAppRoles(PolicyUtil.java:1922)
>         at oracle/security/jps/internal/core/util/SubjectResolverComputor$1.run(SubjectResolverComputor.java:152)
>         at oracle/security/jps/internal/core/util/SubjectResolverComputor$1.run(SubjectResolverComputor.java:143)
>         at jrockit/vm/AccessController.doPrivileged(AccessController.java:254)[inlined]
>         at jrockit/vm/AccessController.doPrivileged(AccessController.java:268)[optimized]
>         at oracle/security/jps/internal/core/util/SubjectResolverComputor.getAppRoles(SubjectResolverComputor.java:143)
>         at oracle/security/jps/internal/core/util/SubjectResolverComputor.compute(SubjectResolverComputor.java:123)
>         at oracle/security/jps/internal/core/util/SubjectResolverCacheImpl.computeJpsSubject(SubjectResolverCacheImpl.java:207)
>         at oracle/security/jps/az/internal/runtime/service/PDPServiceImpl.computeJpsSubject(PDPServiceImpl.java:2396)
>         at oracle/security/jps/internal/jaas/JpsAbsSubjectResolver.resolveJpsSubject(JpsAbsSubjectResolver.java:216)
>         at oracle/security/jps/internal/jaas/JpsAbsSubjectResolver.resolveSubject(JpsAbsSubjectResolver.java:175)
>         at oracle/security/jps/ee/ejb/JpsAbsInterceptor.intercept(JpsAbsInterceptor.java:123)
>         at oracle/security/jps/ee/ejb/JpsInterceptor.intercept(JpsInterceptor.java:113)
>         at sun/reflect/GeneratedMethodAccessor1293.invoke(Ljava/lang/Object;[Ljava/lang/Object;)Ljava/lang/Object;(Unknown Source)
>         at sun/reflect/DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)[optimized]
>         at java/lang/reflect/Method.invoke(Method.java:597)[optimized]
>         at com/bea/core/repackaged/springframework/aop/support/AopUtils.invokeJoinpointUsingReflection(AopUtils.java:310)
>         at com/oracle/pitchfork/intercept/JeeInterceptorInterceptor.invoke(JeeInterceptorInterceptor.java:68)
>         at com/bea/core/repackaged/springframework/aop/framework/ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
>         at com/bea/core/repackaged/springframework/aop/support/DelegatingIntroductionInterceptor.doProceed(DelegatingIntroductionInterceptor.java:131)
>         at com/bea/core/repackaged/springframework/aop/support/DelegatingIntroductionInterceptor.invoke(DelegatingIntroductionInterceptor.java:119)
>         at com/bea/core/repackaged/springframework/aop/framework/ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
>         at com/oracle/pitchfork/spi/MethodInvocationVisitorImpl.visit(MethodInvocationVisitorImpl.java:34)
>        at weblogic/ejb/container/injection/EnvironmentInterceptorCallbackImpl.callback(EnvironmentInterceptorCallbackImpl.java:54)
>         at com/oracle/pitchfork/spi/EnvironmentInterceptor.invoke(EnvironmentInterceptor.java:42)
>         at com/bea/core/repackaged/springframework/aop/framework/ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
>         at com/bea/core/repackaged/springframework/aop/interceptor/ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:89)
>         at com/bea/core/repackaged/springframework/aop/framework/ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
>         at com/bea/core/repackaged/springframework/aop/support/DelegatingIntroductionInterceptor.doProceed(DelegatingIntroductionInterceptor.java:131)
>         at com/bea/core/repackaged/springframework/aop/support/DelegatingIntroductionInterceptor.invoke(DelegatingIntroductionInterceptor.java:119)
>         at com/bea/core/repackaged/springframework/aop/framework/ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
>         at com/bea/core/repackaged/springframework/aop/framework/JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
>         at com/sun/proxy/$Proxy344.destroyWorkflowContext(Loracle/bpel/services/workflow/verification/IWorkflowContext;)V(Unknown Source)
>         at oracle/bpel/services/workflow/query/ejb/TaskQueryService_oz1ipg_EOImpl.__WL_invoke(Ljava/lang/Object;[Ljava/lang/Object;I)Ljava/lang/Object;(Unknown Source)
>         at weblogic/ejb/container/internal/SessionRemoteMethodInvoker.invoke(SessionRemoteMethodInvoker.java:40)
>         at oracle/bpel/services/workflow/query/ejb/TaskQueryService_oz1ipg_EOImpl.destroyWorkflowContext(Loracle/bpel/services/workflow/verification/IWorkflowContext;)V(Unknown Source)
>         at oracle/bpel/services/workflow/query/ejb/TaskQueryService_oz1ipg_EOImpl_WLSkel.invoke(ILweblogic/rmi/spi/InboundRequest;Lweblogic/rmi/spi/OutboundResponse;Ljava/lang/Object;)Lweblogic/rmi/spi/OutboundResponse;(Unknown Source)
>         at weblogic/rmi/internal/BasicServerRef.invoke(BasicServerRef.java:674)[optimized]
>         at weblogic/rmi/cluster/ClusterableServerRef.invoke(ClusterableServerRef.java:230)
>         at weblogic/rmi/internal/BasicServerRef$1.run(BasicServerRef.java:526)[inlined]
>         at weblogic/security/acl/internal/AuthenticatedSubject.doAs(AuthenticatedSubject.java:363)[inlined]
>         at weblogic/security/service/SecurityManager.runAs(SecurityManager.java:146)[inlined]
>         at weblogic/rmi/internal/BasicServerRef.handleRequest(BasicServerRef.java:523)[inlined]
>         at weblogic/rmi/internal/wls/WLSExecuteRequest.run(WLSExecuteRequest.java:118)[optimized]
>         at weblogic/work/ExecuteThread.execute(ExecuteThread.java:268)[optimized]
>         at weblogic/work/ExecuteThread.run(ExecuteThread.java:226)
>         at jrockit/vm/RNI.c2java(JJJJJ)V(Native Method)
> _______________________________________________
> Concurrency-interest mailing list
> [hidden email]
> http://cs.oswego.edu/mailman/listinfo/concurrency-interest

_______________________________________________
Concurrency-interest mailing list
[hidden email]
http://cs.oswego.edu/mailman/listinfo/concurrency-interest



--
Cheers,

_______________________________________________
Concurrency-interest mailing list
[hidden email]
http://cs.oswego.edu/mailman/listinfo/concurrency-interest
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: hold lock thread in thread dump

Alex Otenko
JVM spec allows for undefined behaviour. They don’t have to throw SOE or OOME. People shouldn’t catch all Throwables, if they want JVM to crash.


Alex


On 30 Mar 2017, at 09:08, Viktor Klang <[hidden email]> wrote:

IMO, Errors which may leave the JVM in an inconsistent state should always crash the JVM hard.

On Thu, Mar 30, 2017 at 9:18 AM, Alex Otenko <[hidden email]> wrote:
The holder may have moved on. Watch for stack overflows in history. When hard errors occur, the behaviour of the JVM is not guaranteed, and stack unwinding can miss finally statements, thus miss lock releases.

Alex

> On 30 Mar 2017, at 06:28, Gang Yan <[hidden email]> wrote:
>
> Hi all:
>
> I have a problem:
>
> 75 threads wait same lock, but not found hold lock thread from thread dump. someone recommend add option" -XX:+PrintConcurrentLocks" but affect performance. How to find out who hold lock ?
>
> "[STUCK] ExecuteThread: '20' for queue: 'weblogic.kernel.Default (self-tuning)'" id=571 idx=0x2f8 tid=19406 prio=1 alive, parked, native_blocked, daemon
>         -- Parking to wait for: java/util/concurrent/locks/ReentrantReadWriteLock$NonfairSync@0x8646d730
>         at jrockit/vm/Locks.park0(J)V(Native Method)
>         at jrockit/vm/Locks.park(Locks.java:2230)[inlined]
>         at jrockit/proxy/sun/misc/Unsafe.park(Unsafe.java:616)[inlined]
>         at java/util/concurrent/locks/LockSupport.park(LockSupport.java:156)[inlined]
>         at java/util/concurrent/locks/AbstractQueuedSynchronizer.parkAndCheckInterrupt(AbstractQueuedSynchronizer.java:811)[inlined]
>         at java/util/concurrent/locks/AbstractQueuedSynchronizer.doAcquireShared(AbstractQueuedSynchronizer.java:941)[inlined]
>         at java/util/concurrent/locks/AbstractQueuedSynchronizer.acquireShared(AbstractQueuedSynchronizer.java:1261)[inlined]
>         at java/util/concurrent/locks/ReentrantReadWriteLock$ReadLock.lock(ReentrantReadWriteLock.java:695)[optimized]
>         at oracle/security/jps/az/common/util/JpsLock.lock(JpsLock.java:81)
>         at oracle/security/jps/az/internal/runtime/service/PDPServiceImpl.getApplicationPolicy(PDPServiceImpl.java:850)
>         at oracle/security/jps/az/internal/runtime/service/PDPServiceImpl.getApplicationPolicy(PDPServiceImpl.java:810)
>         at oracle/security/jps/internal/policystore/PolicyUtil.getGrantedAppRoles(PolicyUtil.java:3042)
>         at oracle/security/jps/internal/policystore/PolicyUtil.getJpsAppRoles(PolicyUtil.java:1977)
>         at oracle/security/jps/internal/policystore/PolicyUtil.getJpsAppRoles(PolicyUtil.java:1922)
>         at oracle/security/jps/internal/core/util/SubjectResolverComputor$1.run(SubjectResolverComputor.java:152)
>         at oracle/security/jps/internal/core/util/SubjectResolverComputor$1.run(SubjectResolverComputor.java:143)
>         at jrockit/vm/AccessController.doPrivileged(AccessController.java:254)[inlined]
>         at jrockit/vm/AccessController.doPrivileged(AccessController.java:268)[optimized]
>         at oracle/security/jps/internal/core/util/SubjectResolverComputor.getAppRoles(SubjectResolverComputor.java:143)
>         at oracle/security/jps/internal/core/util/SubjectResolverComputor.compute(SubjectResolverComputor.java:123)
>         at oracle/security/jps/internal/core/util/SubjectResolverCacheImpl.computeJpsSubject(SubjectResolverCacheImpl.java:207)
>         at oracle/security/jps/az/internal/runtime/service/PDPServiceImpl.computeJpsSubject(PDPServiceImpl.java:2396)
>         at oracle/security/jps/internal/jaas/JpsAbsSubjectResolver.resolveJpsSubject(JpsAbsSubjectResolver.java:216)
>         at oracle/security/jps/internal/jaas/JpsAbsSubjectResolver.resolveSubject(JpsAbsSubjectResolver.java:175)
>         at oracle/security/jps/ee/ejb/JpsAbsInterceptor.intercept(JpsAbsInterceptor.java:123)
>         at oracle/security/jps/ee/ejb/JpsInterceptor.intercept(JpsInterceptor.java:113)
>         at sun/reflect/GeneratedMethodAccessor1293.invoke(Ljava/lang/Object;[Ljava/lang/Object;)Ljava/lang/Object;(Unknown Source)
>         at sun/reflect/DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)[optimized]
>         at java/lang/reflect/Method.invoke(Method.java:597)[optimized]
>         at com/bea/core/repackaged/springframework/aop/support/AopUtils.invokeJoinpointUsingReflection(AopUtils.java:310)
>         at com/oracle/pitchfork/intercept/JeeInterceptorInterceptor.invoke(JeeInterceptorInterceptor.java:68)
>         at com/bea/core/repackaged/springframework/aop/framework/ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
>         at com/bea/core/repackaged/springframework/aop/support/DelegatingIntroductionInterceptor.doProceed(DelegatingIntroductionInterceptor.java:131)
>         at com/bea/core/repackaged/springframework/aop/support/DelegatingIntroductionInterceptor.invoke(DelegatingIntroductionInterceptor.java:119)
>         at com/bea/core/repackaged/springframework/aop/framework/ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
>         at com/oracle/pitchfork/spi/MethodInvocationVisitorImpl.visit(MethodInvocationVisitorImpl.java:34)
>        at weblogic/ejb/container/injection/EnvironmentInterceptorCallbackImpl.callback(EnvironmentInterceptorCallbackImpl.java:54)
>         at com/oracle/pitchfork/spi/EnvironmentInterceptor.invoke(EnvironmentInterceptor.java:42)
>         at com/bea/core/repackaged/springframework/aop/framework/ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
>         at com/bea/core/repackaged/springframework/aop/interceptor/ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:89)
>         at com/bea/core/repackaged/springframework/aop/framework/ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
>         at com/bea/core/repackaged/springframework/aop/support/DelegatingIntroductionInterceptor.doProceed(DelegatingIntroductionInterceptor.java:131)
>         at com/bea/core/repackaged/springframework/aop/support/DelegatingIntroductionInterceptor.invoke(DelegatingIntroductionInterceptor.java:119)
>         at com/bea/core/repackaged/springframework/aop/framework/ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
>         at com/bea/core/repackaged/springframework/aop/framework/JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
>         at com/sun/proxy/$Proxy344.destroyWorkflowContext(Loracle/bpel/services/workflow/verification/IWorkflowContext;)V(Unknown Source)
>         at oracle/bpel/services/workflow/query/ejb/TaskQueryService_oz1ipg_EOImpl.__WL_invoke(Ljava/lang/Object;[Ljava/lang/Object;I)Ljava/lang/Object;(Unknown Source)
>         at weblogic/ejb/container/internal/SessionRemoteMethodInvoker.invoke(SessionRemoteMethodInvoker.java:40)
>         at oracle/bpel/services/workflow/query/ejb/TaskQueryService_oz1ipg_EOImpl.destroyWorkflowContext(Loracle/bpel/services/workflow/verification/IWorkflowContext;)V(Unknown Source)
>         at oracle/bpel/services/workflow/query/ejb/TaskQueryService_oz1ipg_EOImpl_WLSkel.invoke(ILweblogic/rmi/spi/InboundRequest;Lweblogic/rmi/spi/OutboundResponse;Ljava/lang/Object;)Lweblogic/rmi/spi/OutboundResponse;(Unknown Source)
>         at weblogic/rmi/internal/BasicServerRef.invoke(BasicServerRef.java:674)[optimized]
>         at weblogic/rmi/cluster/ClusterableServerRef.invoke(ClusterableServerRef.java:230)
>         at weblogic/rmi/internal/BasicServerRef$1.run(BasicServerRef.java:526)[inlined]
>         at weblogic/security/acl/internal/AuthenticatedSubject.doAs(AuthenticatedSubject.java:363)[inlined]
>         at weblogic/security/service/SecurityManager.runAs(SecurityManager.java:146)[inlined]
>         at weblogic/rmi/internal/BasicServerRef.handleRequest(BasicServerRef.java:523)[inlined]
>         at weblogic/rmi/internal/wls/WLSExecuteRequest.run(WLSExecuteRequest.java:118)[optimized]
>         at weblogic/work/ExecuteThread.execute(ExecuteThread.java:268)[optimized]
>         at weblogic/work/ExecuteThread.run(ExecuteThread.java:226)
>         at jrockit/vm/RNI.c2java(JJJJJ)V(Native Method)
> _______________________________________________
> Concurrency-interest mailing list
> [hidden email]
> http://cs.oswego.edu/mailman/listinfo/concurrency-interest

_______________________________________________
Concurrency-interest mailing list
[hidden email]
http://cs.oswego.edu/mailman/listinfo/concurrency-interest



--
Cheers,


_______________________________________________
Concurrency-interest mailing list
[hidden email]
http://cs.oswego.edu/mailman/listinfo/concurrency-interest
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: hold lock thread in thread dump

Viktor Klang


On Thu, Mar 30, 2017 at 10:33 AM, Alex Otenko <[hidden email]> wrote:
JVM spec allows for undefined behaviour.

Yes—otherwise there wouldn't be a need to crash it ;-)
 
They don’t have to throw SOE or OOME.

 
People shouldn’t catch all Throwables, if they want JVM to crash.

Absolutely agreed—problem is that they do. All over the place. OOMEs and SOEs can be thrown virtually everywhere, which means that if they are triggered under a "catch( Throwable t) { /* yolo */ }" the JVM will keep on chugging along but with unknown internal damage.

Personally, I love this part of the java.lang.Error javadoc:

«An Error is a subclass of Throwable that indicates serious problems that a reasonable application should not try to catch.»

With 20/20 hindsight, perhaps catch should operate, not on Throwable but rather on Catchable—and some Throwables should never have been Catchable.



Alex


On 30 Mar 2017, at 09:08, Viktor Klang <[hidden email]> wrote:

IMO, Errors which may leave the JVM in an inconsistent state should always crash the JVM hard.

On Thu, Mar 30, 2017 at 9:18 AM, Alex Otenko <[hidden email]> wrote:
The holder may have moved on. Watch for stack overflows in history. When hard errors occur, the behaviour of the JVM is not guaranteed, and stack unwinding can miss finally statements, thus miss lock releases.

Alex

> On 30 Mar 2017, at 06:28, Gang Yan <[hidden email]> wrote:
>
> Hi all:
>
> I have a problem:
>
> 75 threads wait same lock, but not found hold lock thread from thread dump. someone recommend add option" -XX:+PrintConcurrentLocks" but affect performance. How to find out who hold lock ?
>
> "[STUCK] ExecuteThread: '20' for queue: 'weblogic.kernel.Default (self-tuning)'" id=571 idx=0x2f8 tid=19406 prio=1 alive, parked, native_blocked, daemon
>         -- Parking to wait for: java/util/concurrent/locks/ReentrantReadWriteLock$NonfairSync@0x8646d730
>         at jrockit/vm/Locks.park0(J)V(Native Method)
>         at jrockit/vm/Locks.park(Locks.java:2230)[inlined]
>         at jrockit/proxy/sun/misc/Unsafe.park(Unsafe.java:616)[inlined]
>         at java/util/concurrent/locks/LockSupport.park(LockSupport.java:156)[inlined]
>         at java/util/concurrent/locks/AbstractQueuedSynchronizer.parkAndCheckInterrupt(AbstractQueuedSynchronizer.java:811)[inlined]
>         at java/util/concurrent/locks/AbstractQueuedSynchronizer.doAcquireShared(AbstractQueuedSynchronizer.java:941)[inlined]
>         at java/util/concurrent/locks/AbstractQueuedSynchronizer.acquireShared(AbstractQueuedSynchronizer.java:1261)[inlined]
>         at java/util/concurrent/locks/ReentrantReadWriteLock$ReadLock.lock(ReentrantReadWriteLock.java:695)[optimized]
>         at oracle/security/jps/az/common/util/JpsLock.lock(JpsLock.java:81)
>         at oracle/security/jps/az/internal/runtime/service/PDPServiceImpl.getApplicationPolicy(PDPServiceImpl.java:850)
>         at oracle/security/jps/az/internal/runtime/service/PDPServiceImpl.getApplicationPolicy(PDPServiceImpl.java:810)
>         at oracle/security/jps/internal/policystore/PolicyUtil.getGrantedAppRoles(PolicyUtil.java:3042)
>         at oracle/security/jps/internal/policystore/PolicyUtil.getJpsAppRoles(PolicyUtil.java:1977)
>         at oracle/security/jps/internal/policystore/PolicyUtil.getJpsAppRoles(PolicyUtil.java:1922)
>         at oracle/security/jps/internal/core/util/SubjectResolverComputor$1.run(SubjectResolverComputor.java:152)
>         at oracle/security/jps/internal/core/util/SubjectResolverComputor$1.run(SubjectResolverComputor.java:143)
>         at jrockit/vm/AccessController.doPrivileged(AccessController.java:254)[inlined]
>         at jrockit/vm/AccessController.doPrivileged(AccessController.java:268)[optimized]
>         at oracle/security/jps/internal/core/util/SubjectResolverComputor.getAppRoles(SubjectResolverComputor.java:143)
>         at oracle/security/jps/internal/core/util/SubjectResolverComputor.compute(SubjectResolverComputor.java:123)
>         at oracle/security/jps/internal/core/util/SubjectResolverCacheImpl.computeJpsSubject(SubjectResolverCacheImpl.java:207)
>         at oracle/security/jps/az/internal/runtime/service/PDPServiceImpl.computeJpsSubject(PDPServiceImpl.java:2396)
>         at oracle/security/jps/internal/jaas/JpsAbsSubjectResolver.resolveJpsSubject(JpsAbsSubjectResolver.java:216)
>         at oracle/security/jps/internal/jaas/JpsAbsSubjectResolver.resolveSubject(JpsAbsSubjectResolver.java:175)
>         at oracle/security/jps/ee/ejb/JpsAbsInterceptor.intercept(JpsAbsInterceptor.java:123)
>         at oracle/security/jps/ee/ejb/JpsInterceptor.intercept(JpsInterceptor.java:113)
>         at sun/reflect/GeneratedMethodAccessor1293.invoke(Ljava/lang/Object;[Ljava/lang/Object;)Ljava/lang/Object;(Unknown Source)
>         at sun/reflect/DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)[optimized]
>         at java/lang/reflect/Method.invoke(Method.java:597)[optimized]
>         at com/bea/core/repackaged/springframework/aop/support/AopUtils.invokeJoinpointUsingReflection(AopUtils.java:310)
>         at com/oracle/pitchfork/intercept/JeeInterceptorInterceptor.invoke(JeeInterceptorInterceptor.java:68)
>         at com/bea/core/repackaged/springframework/aop/framework/ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
>         at com/bea/core/repackaged/springframework/aop/support/DelegatingIntroductionInterceptor.doProceed(DelegatingIntroductionInterceptor.java:131)
>         at com/bea/core/repackaged/springframework/aop/support/DelegatingIntroductionInterceptor.invoke(DelegatingIntroductionInterceptor.java:119)
>         at com/bea/core/repackaged/springframework/aop/framework/ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
>         at com/oracle/pitchfork/spi/MethodInvocationVisitorImpl.visit(MethodInvocationVisitorImpl.java:34)
>        at weblogic/ejb/container/injection/EnvironmentInterceptorCallbackImpl.callback(EnvironmentInterceptorCallbackImpl.java:54)
>         at com/oracle/pitchfork/spi/EnvironmentInterceptor.invoke(EnvironmentInterceptor.java:42)
>         at com/bea/core/repackaged/springframework/aop/framework/ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
>         at com/bea/core/repackaged/springframework/aop/interceptor/ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:89)
>         at com/bea/core/repackaged/springframework/aop/framework/ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
>         at com/bea/core/repackaged/springframework/aop/support/DelegatingIntroductionInterceptor.doProceed(DelegatingIntroductionInterceptor.java:131)
>         at com/bea/core/repackaged/springframework/aop/support/DelegatingIntroductionInterceptor.invoke(DelegatingIntroductionInterceptor.java:119)
>         at com/bea/core/repackaged/springframework/aop/framework/ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
>         at com/bea/core/repackaged/springframework/aop/framework/JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
>         at com/sun/proxy/$Proxy344.destroyWorkflowContext(Loracle/bpel/services/workflow/verification/IWorkflowContext;)V(Unknown Source)
>         at oracle/bpel/services/workflow/query/ejb/TaskQueryService_oz1ipg_EOImpl.__WL_invoke(Ljava/lang/Object;[Ljava/lang/Object;I)Ljava/lang/Object;(Unknown Source)
>         at weblogic/ejb/container/internal/SessionRemoteMethodInvoker.invoke(SessionRemoteMethodInvoker.java:40)
>         at oracle/bpel/services/workflow/query/ejb/TaskQueryService_oz1ipg_EOImpl.destroyWorkflowContext(Loracle/bpel/services/workflow/verification/IWorkflowContext;)V(Unknown Source)
>         at oracle/bpel/services/workflow/query/ejb/TaskQueryService_oz1ipg_EOImpl_WLSkel.invoke(ILweblogic/rmi/spi/InboundRequest;Lweblogic/rmi/spi/OutboundResponse;Ljava/lang/Object;)Lweblogic/rmi/spi/OutboundResponse;(Unknown Source)
>         at weblogic/rmi/internal/BasicServerRef.invoke(BasicServerRef.java:674)[optimized]
>         at weblogic/rmi/cluster/ClusterableServerRef.invoke(ClusterableServerRef.java:230)
>         at weblogic/rmi/internal/BasicServerRef$1.run(BasicServerRef.java:526)[inlined]
>         at weblogic/security/acl/internal/AuthenticatedSubject.doAs(AuthenticatedSubject.java:363)[inlined]
>         at weblogic/security/service/SecurityManager.runAs(SecurityManager.java:146)[inlined]
>         at weblogic/rmi/internal/BasicServerRef.handleRequest(BasicServerRef.java:523)[inlined]
>         at weblogic/rmi/internal/wls/WLSExecuteRequest.run(WLSExecuteRequest.java:118)[optimized]
>         at weblogic/work/ExecuteThread.execute(ExecuteThread.java:268)[optimized]
>         at weblogic/work/ExecuteThread.run(ExecuteThread.java:226)
>         at jrockit/vm/RNI.c2java(JJJJJ)V(Native Method)
> _______________________________________________
> Concurrency-interest mailing list
> [hidden email]
> http://cs.oswego.edu/mailman/listinfo/concurrency-interest

_______________________________________________
Concurrency-interest mailing list
[hidden email]
http://cs.oswego.edu/mailman/listinfo/concurrency-interest



--
Cheers,




--
Cheers,

_______________________________________________
Concurrency-interest mailing list
[hidden email]
http://cs.oswego.edu/mailman/listinfo/concurrency-interest
12
Loading...