Hi Tobias,
You have to modify the code with the snippet below. This will wait for
termination with a
timeout of 1 minute, after which the VM still terminates. However, in a normal
webapplication, the VM will not terminate, so threads will stay active until
you terminate
your entire application.
The code to trigger an out-of-memory is:
var i = 0, o = {};
while(true) {
o[i++] = new Array(1000000);
}
Also, you can try to run the same testcase multiple times in 1 go. After about
100
executions of the script, I suspect your system will start to die on you.
Best regards,
Emond
On Thursday, January 07, 2016 02:50:03 PM Tobias Soloschenko wrote:
> Hi well for me the behavior you mentioned is not shown up.
>
> For me the jvm is terminated. I also watched the process list.
>
> Maybe it depends on the os?! I use MacOS X.
>
> kind regards
>
> Tobias
>
> > Am 07.01.2016 um 13:43 schrieb Emond Papegaaij
> > <[email protected]>:
> >
> > Hi Tobias,
> >
> > I've checked your code, and the testcase does stop in 5 seconds, but the
> > thread does not. The cancelation of the future triggers an exception in
> > the resources, which causes the test to terminate, thereby stopping the
> > vm and the thread. However, if you add this to your testcase:
> > try {
> >
> > wicketTester.startResourceReference(reference);
> >
> > } finally {
> >
> > reference.getScheduledExecutorService().shutdownNow();
> > reference.getScheduledExecutorService().awaitTermination(
> >
> > 1, TimeUnit.MINUTES);
> >
> > }
> > You will see that after 1 minute, the executor is still not terminated.
> >
> > Also, when executing my other script, I get a java.lang.OutOfMemoryError
> > after only 3 seconds.
> >
> > Best regards,
> > Emond
> >
> >> On Thursday, January 07, 2016 12:21:42 PM Tobias Soloschenko wrote:
> >> Hi again,
> >>
> >> I updated the PR - just check it out, open the
> >> NashornResourceReferenceTest.js and add:
> >>
> >> while(true){}