#2072 new
Andrei Solntsev

Play has memory leaks

Reported by Andrei Solntsev | November 28th, 2016 @ 10:04 PM

Play application does not survive multiple reloads, ending up with OutOfMemoryError.
The reason

Framework version: 1.4.3
Platform you're using: Linux, Windows, MacOS

Reproduction steps:
1. Start any play application (using database and/or html templates)
2. Modify some java classes
3. Refresh opened page in browser
4. Reproduce steps 2 & 3

Expected result:
Play unloads the previous classes from memory. Garbage collector frees the memory up.

Actual result:
Play holds all the previous classloaders in memory. Application dies up with OutOfMemoryError after a few reloads.

Comments and changes to this ticket

  • Robert Rettig

    Robert Rettig December 2nd, 2016 @ 02:47 PM

    which java version do you use?
    maybe use java 8 and do some special jvm.memory settings.

    try to set something like this in application.conf and try to reproduce it

    java.source=1.8
    jvm.memory=-Xms128m -Xmx1500m -XX:ReservedCodeCacheSize=240m -XX:+UseConcMarkSweepGC -XX:SoftRefLRUPolicyMSPerMB=50 -ea -Dsun.io.useCanonCaches=false -Djava.net.preferIPv4Stack=true -XX:+HeapDumpOnOutOfMemoryError -XX:-OmitStackTraceInFastThrow
    
  • Andrei Solntsev

    Andrei Solntsev December 2nd, 2016 @ 03:24 PM

    @Robert Retting No, it's not connect to Java version (we actually use Java 8).

    Play framework actually does have memory leaks. See corresponding pull requests:
    https://github.com/playframework/play1/pulls?utf8=%E2%9C%93&q=i...

    (there is more to come...)

  • Robert Rettig

    Robert Rettig December 2nd, 2016 @ 03:49 PM

    yeah i know it but this is just in case of reloading, which is only done in development mode.
    i use advanced memory settings for development and i never got outofmemory anymore. and if there is a outofmemory i get a heap dump which never occurred again since switching memory parameters.
    in production i do not see such bad memory leaks

  • Andrei Solntsev

    Andrei Solntsev December 2nd, 2016 @ 04:18 PM

    @Robert Retting

    Yes, I mean only memory leaks on development mode, not production.
    But it's a serious problem for us, because we are forced to restart application after every change. All the Play beauty (aka "no need to reload") is just disappeared. :(

    Thanks you for the advice, I will try your memory settings. Thought I don't imagine how they theoretically can help.

  • Robert Rettig

    Robert Rettig December 2nd, 2016 @ 05:58 PM

    @Andrei Solntsev of course removing stale references is the better solution

    if you try the way with memory settings you will notice somtimes heavy work of the garbage collector.
    the settings are more or even copied from intellij ide or some other jetbrain "team tools" products (which are most java server).
    i hope they know why they use explicit garbage collector settings.

  • Kelvin S

    Kelvin S December 17th, 2017 @ 06:52 PM

    Memory management is necessary to maintain your deceive performance. If your device virtual memory or other physical memory don’t cooperate or less that would cause of crashing software. I hope that information would help me with my essay and for others thanks for sharing.

  • Scott Saadiq

    Scott Saadiq December 29th, 2017 @ 04:59 PM

    Mini Militia Unlimited Health & Nitro, Ammo Mod Apk IN Doodle Army 2

  • Alex ferguson

    Alex ferguson January 20th, 2018 @ 09:48 AM

    I utilize propelled memory settings for improvement and I never escaped memory any longer. furthermore, if there is an out of memory I get a load dump which never happened again since exchanging memory parameters. Be that as it may, it's a major issue for us since we are compelled to restart the application after each change. All the Play excellence (otherwise known as "no compelling reason to reload") has simply vanished. Much obliged to you for the guidance, I will attempt your memory settings. Figured I don't envision how they hypothetically can help GroovyEssays.co.uk.

  • Priyank

    Priyank February 21st, 2018 @ 07:04 AM

    Very nice informational blog . also all the information of this blog are very useful. wwe 2k14

  • Rahul Shirmar

    Rahul Shirmar March 19th, 2018 @ 07:42 AM

    Nice information, thanks for awaring about the leaks. I would like to share it on my game blog Shadow fight 3. Please have a look over there.

  • Dinesh Kumar

    Dinesh Kumar August 6th, 2018 @ 12:51 PM

    Thanks for sharing this information. This post has covered so many topics. Visit once
    website design company in vijayawada

  • Alina olive

    Alina olive August 9th, 2018 @ 05:58 AM

    Great blog. I delighted in perusing your articles. This is really an awesome perused for me Essay Writing Service Australia I have bookmarked it and I am anticipating perusing new articles. Keep doing awesome.

  • moby dennis

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.

New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

<h2>Play framework</h2>

Play makes it easier to build Web applications with Java. It is a clean alternative to bloated Enterprise Java stacks. It focuses on developer productivity and targets RESTful architectures. Learn more on the <a href="http://www.playframework.org">http://www.playframework.org</a> website.<br><br>

<h2>Source code is hosted on github</h2>Check out our repository at <a href="http://github.com/playframework/play">http://github.com/playframework/play</a><br><br>

<h2>Contributing, creating a patch</h2> Please read the <a href="http://play.lighthouseapp.com/projects/57987/contributor-guide">contributor guide</a><br><br>

<h2>Reporting Security Vulnerabilities</h2> Since all bug reports are public, please report any security vulnerability directly to <em>guillaume dot bort at gmail dot com</em>.<br><br>

<h2>Creating a bug report</h2> Bug reports are incredibly helpful, so take time to report bugs and request features in our ticket tracker. We’re always grateful for patches to Play’s code. Indeed, bug reports with attached patches will get fixed far quickly than those without any.<br><br>

Please include as much relevant information as possible including the exact framework version you're using and a code snippet that reproduces the problem.<br><br>

Don't have too much expectations. Unless the bug is really a serious "everything is broken" thing, you're creating a ticket to start a discussion. Having a patch (or a branch on Github we can pull from) is better, but then again we'll only pull high quality branches that make sense to be in the core of Play.

Pages