Heap space error caused by UserCodeSegment

classic Classic list List threaded Threaded
9 messages Options
Reply | Threaded
Open this post in threaded view
|

Heap space error caused by UserCodeSegment

kramer
This post was updated on .
I have an application that is working fine on my local machine (windows 7 with -Xmx256m) but keeps getting heap space error upon the first request on remote server (linux  3.0.76-0.11-default with -Xmx2g). Heap dump looks like this and goes to infinity:
 

My code is not recursive and is not memory intensive, any idea what can cause this type of behaviour?
Reply | Threaded
Open this post in threaded view
|

Re: Heap space error caused by UserCodeSegment

Luke Daley
Administrator
I just stumbled across this on the weekend, or at least I think it’s the same thing.

This can happen when your code throws a java.lang.Error. YourKit can tell you about thrown exceptions. 

I’m still refining what the problem is before raising an issue, but it’s something like this.


Reply | Threaded
Open this post in threaded view
|

Re: Heap space error caused by UserCodeSegment

kramer
Thanks for the tip, I found the root cause via YourKit.
Still it's strange how this is not reported on any logs and instead causes heap error.

Reply | Threaded
Open this post in threaded view
|

Re: Heap space error caused by UserCodeSegment

Luke Daley
Administrator
It’s a bug that it does that, which we need to fix. 

Do you think you could put together a small reproducible sample?
Reply | Threaded
Open this post in threaded view
|

Re: Heap space error caused by UserCodeSegment

kramer
Sure I'll look into that when I've the time
Reply | Threaded
Open this post in threaded view
|

Re: Heap space error caused by UserCodeSegment

kramer
In reply to this post by Luke Daley
In my exact case I was getting a FileNotFoundException from a class which had a field like: static final template = new ClassPathResource(..)
So I tried to minimally recreate it here: https://gist.github.com/kramer/c15ada4fca127d251506
I can't see if this one gets heap space error too (because it does not print that) but it never responds and goes into an infinite loop causing serious cpu&memory spike upon receiving the request.
Reply | Threaded
Open this post in threaded view
|

Re: Heap space error caused by UserCodeSegment

Luke Daley
Administrator
Looking into this now, thanks.

FYI - I noticed that the build.gradle declared the ratpack-rx dependency the manual way. There's an easier way to use other Ratpack dependencies and keep the version numbers in sync.

http://www.ratpack.io/manual/current/gradle.html#ratpack_dependencies
Reply | Threaded
Open this post in threaded view
|

Re: Heap space error caused by UserCodeSegment

kramer
Luke Daley wrote
 There's an easier way to use other Ratpack dependencies and keep the version numbers in sync.
I missed that part, thanks !
Reply | Threaded
Open this post in threaded view
|

Re: Heap space error caused by UserCodeSegment

Luke Daley
Administrator
 
This will be fixed as part of https://github.com/ratpack/ratpack/issues/422