sakinho has asked for the wisdom of the Perl Monks concerning the following question:

Update:

Finally I found where the memory leak was and I'm sorry Starman to blame you :) In the program we use a binding library wich works perfect in a regular execution but for a reason I can't figure out, in a multiprocess situation eat all the memory. This bug have been sended to the author of the perl library.


I have developed a RESTful application with perl framework Dancer. This application needs almost 1 GB in memory and it takes 30 seconds to be loaded. This application works pretty well in a local test with ./bin/app.pl for a single user, then I try to deploy with Starman (alone or with plackup, with and without keep-alive) for multi-tenant use in several different ways:

plackup -E production -s Starman --workers=10 -p 3000 -a bin/app.pl plackup -E production -s Starman --workers=10 -p 3000 -a bin/app.pl -- +disable-keepalive plackup -E production -s Starman --workers=10 -p 3000 -a bin/app.pl -- +disable-keepalive --preload-app starman --workers=10 -p 3000 -a bin/app.pl

Deployment success, but for each query Starman allocates some memory which never free any more, so the application go out of memory very fast.

I read all the documentation of Starman, PSGI and Dancer deployment, included a very nice explanation of NGINX/Starman/Dancer and a similar error with Starman and memory but it doesn't solve this one, because I disable keep-alive and Starman still keep the memory.

Any idea why Starman is eating my memory? Thanks!

Disclaimer: I posted this question in Stackoverflow and someone recomend me to came to the monastery :)

Replies are listed 'Best First'.
Re: Starman eat all the memory with Dancer REST api
by Corion (Patriarch) on Jan 18, 2014 at 16:38 UTC

    To expand a bit on the somewhat terse reply by Anonymous Monk, you will have to show more conclusively that it actually is Starman that has a memory leak.

    The easiest way to do that is to strip down your application to the bare minimum application that runs and still exposes the memory leak in Starman. Most likely, while stripping down your application, you will find out that somewhere in your application you are creating memory cycles that cannot be relased using the reference counting memory management that Perl uses.

Re: Starman eat all the memory with Dancer REST api
by Anonymous Monk on Jan 18, 2014 at 05:25 UTC

    Any idea why Starman is eating my memory? Thanks!

    Because your program/application is eating your memory

      What a confidence in Starman! :P

      Of course that was my first thought, but my app don't have memory leaks if I execute standalone, just when I execute with Starman happends.

      I tryed Starman only with 1 worker and I modified my app to perform a single operation, and the problem was still there.