Re: Calling a lambda expression from a new thread before the main method is run causes the thread to lock up

2017-01-24 Thread Luke Hutchison
Thank you Remi and David for your detailed explanations, this was very helpful, and I understand the issues now. Please go ahead and close the Jira bug I created for this (JDK-8173252), I see this is WAI. On Tue, Jan 24, 2017 at 12:39 AM, wrote: > Here is your code slightly

Re: Calling a lambda expression from a new thread before the main method is run causes the thread to lock up

2017-01-24 Thread David Holmes
I have to second Remi's view here - hidden concurrency is an accident waiting to happen, far too many things can go wrong if the users of your API don't know that new threads can be involved. It's not wrong, per-se, to start threads from a static initializer - just wrong to do something that

Re: Calling a lambda expression from a new thread before the main method is run causes the thread to lock up

2017-01-24 Thread David Holmes
On 24/01/2017 5:21 PM, Luke Hutchison wrote: On Mon, Jan 23, 2017 at 10:48 PM, David Holmes > wrote: On 24/01/2017 2:41 PM, Luke Hutchison wrote: If you run the code below, the active JVM thread (in the

Re: Calling a lambda expression from a new thread before the main method is run causes the thread to lock up

2017-01-24 Thread forax
> De: "Luke Hutchison" > À: "Remi Forax" > Cc: "David Holmes" , core-libs-dev@openjdk.java.net > Envoyé: Mardi 24 Janvier 2017 09:13:17 > Objet: Re: Calling a lambda expression from a new thread before the main > method > is run

Re: Calling a lambda expression from a new thread before the main method is run causes the thread to lock up

2017-01-24 Thread Luke Hutchison
On Tue, Jan 24, 2017 at 12:02 AM, Remi Forax wrote: > a worker thread of the executor will try to execute the code of the static > method but because the static initializer is not finished, the worker > thread has to wait But what is the worker thread waiting for in the case

Re: Calling a lambda expression from a new thread before the main method is run causes the thread to lock up

2017-01-24 Thread Remi Forax
- Mail original - > De: "Luke Hutchison" > À: "David Holmes" > Cc: core-libs-dev@openjdk.java.net > Envoyé: Mardi 24 Janvier 2017 08:21:39 > Objet: Re: Calling a lambda expression from a new thread before the main > method is run

Re: Calling a lambda expression from a new thread before the main method is run causes the thread to lock up

2017-01-23 Thread Luke Hutchison
On Mon, Jan 23, 2017 at 11:37 PM, Luke Hutchison wrote: > On Mon, Jan 23, 2017 at 11:21 PM, Luke Hutchison > wrote: > >> That looks like a variation of the classic class initialization deadlock >>> problem. Your main thread is blocked in

Re: Calling a lambda expression from a new thread before the main method is run causes the thread to lock up

2017-01-23 Thread Luke Hutchison
On Mon, Jan 23, 2017 at 11:21 PM, Luke Hutchison wrote: > That looks like a variation of the classic class initialization deadlock >> problem. Your main thread is blocked in es.submit(callable).get(); while >> still within the static initializer of the LambdaBug class. If

Re: Calling a lambda expression from a new thread before the main method is run causes the thread to lock up

2017-01-23 Thread Luke Hutchison
On Mon, Jan 23, 2017 at 10:48 PM, David Holmes wrote: > On 24/01/2017 2:41 PM, Luke Hutchison wrote: > >> If you run the code below, the active JVM thread (in the ExecutorService) >> locks up when the lambda expression is called. The Eclipse debugger is not >> able to

Re: Calling a lambda expression from a new thread before the main method is run causes the thread to lock up

2017-01-23 Thread David Holmes
Hi Luke, On 24/01/2017 2:41 PM, Luke Hutchison wrote: If you run the code below, the active JVM thread (in the ExecutorService) locks up when the lambda expression is called. The Eclipse debugger is not able to stop the locked-up thread, or get a stacktrace beyond the call into the lambda.

Calling a lambda expression from a new thread before the main method is run causes the thread to lock up

2017-01-23 Thread Luke Hutchison
If you run the code below, the active JVM thread (in the ExecutorService) locks up when the lambda expression is called. The Eclipse debugger is not able to stop the locked-up thread, or get a stacktrace beyond the call into the lambda. The problem seems to be that some part of the Java 8 lambda