You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@groovy.apache.org by Jeff Adamson <jw...@us.ibm.com> on 2016/09/28 19:23:48 UTC

Serious memory leak in groovy 2.4.7?


Using GroovyShell to evaluate expressions appears to leak permgen space in
2.4.7 when run with oracle java 7 jvm.

Should I open a bug report or is there an existing one I can link to?

Using groovy 2.4.7: this script causes perm-gen error in java 1.7. After
approx 24 thousand evaluate calls it slows for a while due to GC overhead,
then expands perm space and usage rises again until failing OOM ~41k calls
and 7 minutes.
Using groovy 2.4.6: failure is same as 2.4.7 after 4.5 minutes
Using groovy 2.4.0: increases perm-gen usage after a couple minutes, it
does reclaim a large chunk and seems to attain a steady state of usage.
completing in 5 minutes.
Using groovy 2.3.9: perm-gen has a steady-state memory usage pattern for
entire run without any slowdowns over 7.5 minutes
Using groovy 1.8.9: same as 2.3.9.

=================================
long sleep = 0;
String scriptText = "println this.binding.variables; return true;";

for (int trial = 0; trial < 100; trial ++) {
	Thread.sleep(sleep);
	for (int i = 0; i < 1000; i++) {

		Map<String,Object> bind = new HashMap<String,Object>();
		bind.put("bindingObject", "a binding object "+i);

		Object result = null;
		System.out.println("Run "+trial+"."+i);

		GroovyShell shell = new GroovyShell(new Binding(bind));
		result = shell.evaluate(scriptText);

		System.out.println(trial+"."+i+" result:"+result);
		System.out.println();
	}
}
================================

$ export JAVA_HOME=/usr/lib/jvm/java-1.7.0-openjdk-i386
$ groovy -version
Groovy Version: 2.4.7 JVM: 1.7.0_111 Vendor: Oracle Corporation OS: Linux
$ groovy groovyOOM.groovy
....
Run 41.381
Caught: java.lang.OutOfMemoryError: PermGen space
Exception in thread "RMI TCP Connection(idle)" java.lang.OutOfMemoryError:
PermGen space
	at sun.misc.Unsafe.defineClass(Native Method)
	at sun.reflect.ClassDefiner.defineClass(ClassDefiner.java:63)

(See attached file: Screenshot from 2016-09-28 13:38:22.png)





Regards,
Jeff Adamson

Re: Serious memory leak in groovy 2.4.7?

Posted by Jeff Adamson <jw...@us.ibm.com>.
Thanks, will check those options out.

Regards,
Jeff Adamson



From:	John Wagenleitner <jo...@gmail.com>
To:	dev@groovy.apache.org
Date:	09/28/2016 05:48 PM
Subject:	Re: Serious memory leak in groovy 2.4.7?



It might be related to GROOVY-7683 [1].  I ran the script
with 2.4.8-SNAPSHOT and it completes successfully.  I can replicate the
problem with 2.4.7.  As a workaround, I can get it to work with 2.4.7 if I
use the following:


groovy -Dgroovy.use.classvalue=true groovyOOM.groovy


[1]  https://issues.apache.org/jira/browse/GROOVY-7683


On Wed, Sep 28, 2016 at 12:23 PM, Jeff Adamson <jw...@us.ibm.com>
wrote:
  Using GroovyShell to evaluate expressions appears to leak permgen space
  in 2.4.7 when run with oracle java 7 jvm.

  Should I open a bug report or is there an existing one I can link to?

  Using groovy 2.4.7: this script causes perm-gen error in java 1.7. After
  approx 24 thousand evaluate calls it slows for a while due to GC
  overhead, then expands perm space and usage rises again until failing OOM
  ~41k calls and 7 minutes.
  Using groovy 2.4.6: failure is same as 2.4.7 after 4.5 minutes
  Using groovy 2.4.0: increases perm-gen usage after a couple minutes, it
  does reclaim a large chunk and seems to attain a steady state of usage.
  completing in 5 minutes.
  Using groovy 2.3.9: perm-gen has a steady-state memory usage pattern for
  entire run without any slowdowns over 7.5 minutes
  Using groovy 1.8.9: same as 2.3.9.

  =================================
  long sleep = 0;
  String scriptText = "println this.binding.variables; return true;";

  for (int trial = 0; trial < 100; trial ++) {
  Thread.sleep(sleep);
  for (int i = 0; i < 1000; i++) {

  Map<String,Object> bind = new HashMap<String,Object>();
  bind.put("bindingObject", "a binding object "+i);

  Object result = null;
  System.out.println("Run "+trial+"."+i);

  GroovyShell shell = new GroovyShell(new Binding(bind));
  result = shell.evaluate(scriptText);

  System.out.println(trial+"."+i+" result:"+result);
  System.out.println();
  }
  }
  ================================

  $ export JAVA_HOME=/usr/lib/jvm/java-1.7.0-openjdk-i386
  $ groovy -version
  Groovy Version: 2.4.7 JVM: 1.7.0_111 Vendor: Oracle Corporation OS: Linux
  $ groovy groovyOOM.groovy
  ....
  Run 41.381
  Caught: java.lang.OutOfMemoryError: PermGen space
  Exception in thread "RMI TCP Connection(idle)"
  java.lang.OutOfMemoryError: PermGen space
  at sun.misc.Unsafe.defineClass(Native Method)
  at sun.reflect.ClassDefiner.defineClass(ClassDefiner.java:63)

  (See attached file: Screenshot from 2016-09-28 13:38:22.png)





  Regards,
  Jeff Adamson






Re: Serious memory leak in groovy 2.4.7?

Posted by Jochen Theodorou <bl...@gmx.org>.
On 29.09.2016 19:35, Jeff Adamson wrote:
[...]
> Last quick Q, is there a broad eta about is 2.4.8 going to be released
> e.g. in a month or next year?

We will do as soon as Cedric finds the time to tell me how to make a 
release.

bye Jochen


Re: Serious memory leak in groovy 2.4.7?

Posted by Jeff Adamson <jw...@us.ibm.com>.
Thanks, glad it will be fixed in future.

With groovy 2.4.7
`env JAVA_HOME=/usr/lib/jvm/java-1.7.0-openjdk-i386
JAVA_OPTS=-XX:MaxPermSize=32m groovy -Dgroovy.use.classvalue=false
groovyOOM.groov` fails as described
`env JAVA_HOME=/usr/lib/jvm/java-1.7.0-openjdk-i386
JAVA_OPTS=-XX:MaxPermSize=32m groovy -Dgroovy.use.classvalue=true
groovyOOM.groov` works successfully

With a personal build of groovy 2.4.8 revision
da30fa2005c94bba20d78c56245805fa5a29e229 of apache/GROOVY_2_4_X
`env JAVA_HOME=/usr/lib/jvm/java-1.7.0-openjdk-i386
JAVA_OPTS=-XX:MaxPermSize=32m GROOVY_HOME=$HOME/.../groovy-2.4.8-SNAPSHOT
bash -c '$GROOVY_HOME/bin/groovy -Dgroovy.use.classvalue=true
groovyOOM.groovy'` works successfully (stable perm-gen usage over time)
`env JAVA_HOME=/usr/lib/jvm/java-1.7.0-openjdk-i386
JAVA_OPTS=-XX:MaxPermSize=32m GROOVY_HOME=$HOME/.../groovy-2.4.8-SNAPSHOT
bash -c '$GROOVY_HOME/bin/groovy -Dgroovy.use.classvalue=false
groovyOOM.groovy'` works successfully same

Last quick Q, is there a broad eta about is 2.4.8 going to be released e.g.
in a month or next year?


Regards,
Jeff Adamson



From:	John Wagenleitner <jo...@gmail.com>
To:	dev@groovy.apache.org
Date:	09/28/2016 05:48 PM
Subject:	Re: Serious memory leak in groovy 2.4.7?



It might be related to GROOVY-7683 [1].  I ran the script
with 2.4.8-SNAPSHOT and it completes successfully.  I can replicate the
problem with 2.4.7.  As a workaround, I can get it to work with 2.4.7 if I
use the following:


groovy -Dgroovy.use.classvalue=true groovyOOM.groovy


[1]  https://issues.apache.org/jira/browse/GROOVY-7683


On Wed, Sep 28, 2016 at 12:23 PM, Jeff Adamson <jw...@us.ibm.com>
wrote:
  Using GroovyShell to evaluate expressions appears to leak permgen space
  in 2.4.7 when run with oracle java 7 jvm.

  Should I open a bug report or is there an existing one I can link to?

  Using groovy 2.4.7: this script causes perm-gen error in java 1.7. After
  approx 24 thousand evaluate calls it slows for a while due to GC
  overhead, then expands perm space and usage rises again until failing OOM
  ~41k calls and 7 minutes.
  Using groovy 2.4.6: failure is same as 2.4.7 after 4.5 minutes
  Using groovy 2.4.0: increases perm-gen usage after a couple minutes, it
  does reclaim a large chunk and seems to attain a steady state of usage.
  completing in 5 minutes.
  Using groovy 2.3.9: perm-gen has a steady-state memory usage pattern for
  entire run without any slowdowns over 7.5 minutes
  Using groovy 1.8.9: same as 2.3.9.

  =================================
  long sleep = 0;
  String scriptText = "println this.binding.variables; return true;";

  for (int trial = 0; trial < 100; trial ++) {
  Thread.sleep(sleep);
  for (int i = 0; i < 1000; i++) {

  Map<String,Object> bind = new HashMap<String,Object>();
  bind.put("bindingObject", "a binding object "+i);

  Object result = null;
  System.out.println("Run "+trial+"."+i);

  GroovyShell shell = new GroovyShell(new Binding(bind));
  result = shell.evaluate(scriptText);

  System.out.println(trial+"."+i+" result:"+result);
  System.out.println();
  }
  }
  ================================

  $ export JAVA_HOME=/usr/lib/jvm/java-1.7.0-openjdk-i386
  $ groovy -version
  Groovy Version: 2.4.7 JVM: 1.7.0_111 Vendor: Oracle Corporation OS: Linux
  $ groovy groovyOOM.groovy
  ....
  Run 41.381
  Caught: java.lang.OutOfMemoryError: PermGen space
  Exception in thread "RMI TCP Connection(idle)"
  java.lang.OutOfMemoryError: PermGen space
  at sun.misc.Unsafe.defineClass(Native Method)
  at sun.reflect.ClassDefiner.defineClass(ClassDefiner.java:63)

  (See attached file: Screenshot from 2016-09-28 13:38:22.png)





  Regards,
  Jeff Adamson






Re: Serious memory leak in groovy 2.4.7?

Posted by John Wagenleitner <jo...@gmail.com>.
It might be related to GROOVY-7683 [1].  I ran the script
with 2.4.8-SNAPSHOT and it completes successfully.  I can replicate the
problem with 2.4.7.  As a workaround, I can get it to work with 2.4.7 if I
use the following:


groovy -Dgroovy.use.classvalue=true groovyOOM.groovy


[1]  https://issues.apache.org/jira/browse/GROOVY-7683


On Wed, Sep 28, 2016 at 12:23 PM, Jeff Adamson <jw...@us.ibm.com> wrote:

> Using GroovyShell to evaluate expressions appears to leak permgen space in
> 2.4.7 when run with oracle java 7 jvm.
>
> Should I open a bug report or is there an existing one I can link to?
>
> Using groovy 2.4.7: this script causes perm-gen error in java 1.7. After
> approx 24 thousand evaluate calls it slows for a while due to GC overhead,
> then expands perm space and usage rises again until failing OOM ~41k calls
> and 7 minutes.
> Using groovy 2.4.6: failure is same as 2.4.7 after 4.5 minutes
> Using groovy 2.4.0: increases perm-gen usage after a couple minutes, it
> does reclaim a large chunk and seems to attain a steady state of usage.
> completing in 5 minutes.
> Using groovy 2.3.9: perm-gen has a steady-state memory usage pattern for
> entire run without any slowdowns over 7.5 minutes
> Using groovy 1.8.9: same as 2.3.9.
>
> =================================
> long sleep = 0;
> String scriptText = "println this.binding.variables; return true;";
>
> for (int trial = 0; trial < 100; trial ++) {
> Thread.sleep(sleep);
> for (int i = 0; i < 1000; i++) {
>
> Map<String,Object> bind = new HashMap<String,Object>();
> bind.put("bindingObject", "a binding object "+i);
>
> Object result = null;
> System.out.println("Run "+trial+"."+i);
>
> GroovyShell shell = new GroovyShell(new Binding(bind));
> result = shell.evaluate(scriptText);
>
> System.out.println(trial+"."+i+" result:"+result);
> System.out.println();
> }
> }
> ================================
>
> $ export JAVA_HOME=/usr/lib/jvm/java-1.7.0-openjdk-i386
> $ groovy -version
> Groovy Version: 2.4.7 JVM: 1.7.0_111 Vendor: Oracle Corporation OS: Linux
> $ groovy groovyOOM.groovy
> ....
> Run 41.381
> Caught: java.lang.OutOfMemoryError: PermGen space
> Exception in thread "RMI TCP Connection(idle)" java.lang.OutOfMemoryError:
> PermGen space
> at sun.misc.Unsafe.defineClass(Native Method)
> at sun.reflect.ClassDefiner.defineClass(ClassDefiner.java:63)
>
> *(See attached file: Screenshot from 2016-09-28 13:38:22.png)*
>
>
>
>
>
> Regards,
> Jeff Adamson
>

Re: Serious memory leak in groovy 2.4.7?

Posted by Paolo Di Tommaso <pa...@gmail.com>.
I've noticed a similar problem recently.


p

On Wed, Sep 28, 2016 at 9:23 PM, Jeff Adamson <jw...@us.ibm.com> wrote:

> Using GroovyShell to evaluate expressions appears to leak permgen space in
> 2.4.7 when run with oracle java 7 jvm.
>
> Should I open a bug report or is there an existing one I can link to?
>
> Using groovy 2.4.7: this script causes perm-gen error in java 1.7. After
> approx 24 thousand evaluate calls it slows for a while due to GC overhead,
> then expands perm space and usage rises again until failing OOM ~41k calls
> and 7 minutes.
> Using groovy 2.4.6: failure is same as 2.4.7 after 4.5 minutes
> Using groovy 2.4.0: increases perm-gen usage after a couple minutes, it
> does reclaim a large chunk and seems to attain a steady state of usage.
> completing in 5 minutes.
> Using groovy 2.3.9: perm-gen has a steady-state memory usage pattern for
> entire run without any slowdowns over 7.5 minutes
> Using groovy 1.8.9: same as 2.3.9.
>
> =================================
> long sleep = 0;
> String scriptText = "println this.binding.variables; return true;";
>
> for (int trial = 0; trial < 100; trial ++) {
> Thread.sleep(sleep);
> for (int i = 0; i < 1000; i++) {
>
> Map<String,Object> bind = new HashMap<String,Object>();
> bind.put("bindingObject", "a binding object "+i);
>
> Object result = null;
> System.out.println("Run "+trial+"."+i);
>
> GroovyShell shell = new GroovyShell(new Binding(bind));
> result = shell.evaluate(scriptText);
>
> System.out.println(trial+"."+i+" result:"+result);
> System.out.println();
> }
> }
> ================================
>
> $ export JAVA_HOME=/usr/lib/jvm/java-1.7.0-openjdk-i386
> $ groovy -version
> Groovy Version: 2.4.7 JVM: 1.7.0_111 Vendor: Oracle Corporation OS: Linux
> $ groovy groovyOOM.groovy
> ....
> Run 41.381
> Caught: java.lang.OutOfMemoryError: PermGen space
> Exception in thread "RMI TCP Connection(idle)" java.lang.OutOfMemoryError:
> PermGen space
> at sun.misc.Unsafe.defineClass(Native Method)
> at sun.reflect.ClassDefiner.defineClass(ClassDefiner.java:63)
>
> *(See attached file: Screenshot from 2016-09-28 13:38:22.png)*
>
>
>
>
>
> Regards,
> Jeff Adamson
>