Some and None leaks inside Tomcat

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Some and None leaks inside Tomcat

Alan Burlison
When I redeploy my Scala-based webapp inside Tomcat I get the following
warnings, is there anything I can do to fix it?

Nov 07, 2014 3:09:08 PM org.apache.catalina.loader.WebappClassLoader
checkThreadLocalMapForLeaks
SEVERE: The web application [/browse] created a ThreadLocal with key of
type [scala.util.DynamicVariable$$anon$1] (value
[scala.util.DynamicVariable$$anon$1@4ebfa6c7]) and a value of type
[scala.None$] (value [None]) but failed to remove it when the web
application was stopped. Threads are going to be renewed over time to
try and avoid a probable memory leak.
Nov 07, 2014 3:09:08 PM org.apache.catalina.loader.WebappClassLoader
checkThreadLocalMapForLeaks
SEVERE: The web application [/browse] created a ThreadLocal with key of
type [scala.util.DynamicVariable$$anon$1] (value
[scala.util.DynamicVariable$$anon$1@48755f1b]) and a value of type
[scala.Some] (value [Some([166.1] failure: end of input


--
Alan Burlison
--

--
You received this message because you are subscribed to the Google Groups "scala-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Some and None leaks inside Tomcat

Jason Zaugg
This is the spot that created the thread local:

https://github.com/scala/scala-parser-combinators/blob/v1.0.2/src/main/scala/scala/util/parsing/combinator/Parsers.scala#L159

The leak will be pretty tiny (one Some and one String) each reload of the webapp. If you want to get rid of the warning, you might be able to use reflection to clear the corresponding ThreadLocal. I haven’t tried this myself.

-jason


Sent from Mailbox


On Sat, Nov 8, 2014 at 1:16 AM, Alan Burlison <[hidden email]> wrote:

When I redeploy my Scala-based webapp inside Tomcat I get the following
warnings, is there anything I can do to fix it?

Nov 07, 2014 3:09:08 PM org.apache.catalina.loader.WebappClassLoader
checkThreadLocalMapForLeaks
SEVERE: The web application [/browse] created a ThreadLocal with key of
type [scala.util.DynamicVariable$$anon$1] (value
[scala.util.DynamicVariable$$anon$1@4ebfa6c7]) and a value of type
[scala.None$] (value [None]) but failed to remove it when the web
application was stopped. Threads are going to be renewed over time to
try and avoid a probable memory leak.
Nov 07, 2014 3:09:08 PM org.apache.catalina.loader.WebappClassLoader
checkThreadLocalMapForLeaks
SEVERE: The web application [/browse] created a ThreadLocal with key of
type [scala.util.DynamicVariable$$anon$1] (value
[scala.util.DynamicVariable$$anon$1@48755f1b]) and a value of type
[scala.Some] (value [Some([166.1] failure: end of input


--
Alan Burlison
--

--
You received this message because you are subscribed to the Google Groups "scala-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.


--
You received this message because you are subscribed to the Google Groups "scala-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Some and None leaks inside Tomcat

Seth Tisue
for a ton of background on this, see
https://issues.scala-lang.org/browse/SI-4929

--
You received this message because you are subscribed to the Google Groups "scala-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Some and None leaks inside Tomcat

Roland Kuhn
In reply to this post by Jason Zaugg

7 nov 2014 kl. 22:45 skrev Jason Zaugg <[hidden email]>:

This is the spot that created the thread local:


The leak will be pretty tiny (one Some and one String) each reload of the webapp.

It depends: the ClassLoader which loaded Some will also be retained, which means that unless scala-library.jar is shared across reloads the leak would be quite large … (unless I am missing something).

Regards,

Roland

If you want to get rid of the warning, you might be able to use reflection to clear the corresponding ThreadLocal. I haven’t tried this myself.

-jason


Sent from Mailbox


On Sat, Nov 8, 2014 at 1:16 AM, Alan Burlison <[hidden email]> wrote:

When I redeploy my Scala-based webapp inside Tomcat I get the following
warnings, is there anything I can do to fix it?

Nov 07, 2014 3:09:08 PM org.apache.catalina.loader.WebappClassLoader
checkThreadLocalMapForLeaks
SEVERE: The web application [/browse] created a ThreadLocal with key of
type [scala.util.DynamicVariable$$anon$1] (value
[scala.util.DynamicVariable$$anon$1@4ebfa6c7]) and a value of type
[scala.None$] (value [None]) but failed to remove it when the web
application was stopped. Threads are going to be renewed over time to
try and avoid a probable memory leak.
Nov 07, 2014 3:09:08 PM org.apache.catalina.loader.WebappClassLoader
checkThreadLocalMapForLeaks
SEVERE: The web application [/browse] created a ThreadLocal with key of
type [scala.util.DynamicVariable$$anon$1] (value
[scala.util.DynamicVariable$$anon$1@48755f1b]) and a value of type
[scala.Some] (value [Some([166.1] failure: end of input


--
Alan Burlison
--

--
You received this message because you are subscribed to the Google Groups "scala-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.



--
You received this message because you are subscribed to the Google Groups "scala-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.



Dr. Roland Kuhn
Akka Tech Lead
Typesafe – Reactive apps on the JVM.
twitter: @rolandkuhn


--
You received this message because you are subscribed to the Google Groups "scala-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Some and None leaks inside Tomcat

Alan Burlison
In reply to this post by Jason Zaugg
On 7 November 2014 21:45, Jason Zaugg <[hidden email]> wrote:

> This is the spot that created the thread local:

Thanks, I'm astonished you knew where it was based on the limited
information  I had :-)

Tomcat7 onwards has a setting that might help, I'll give it a try:

clearReferencesStatic

If true, Tomcat attempts to null out any static or final fields from
loaded classes when a web application is stopped as a work around for
apparent garbage collection bugs and application coding errors. There
have been some issues reported with log4j when this is true.
Applications without memory leaks using recent JVMs should operate
correctly with this attribute set to false. If not specified, the
default value of false will be used.

--
Alan Burlison
--

--
You received this message because you are subscribed to the Google Groups "scala-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.