[Dancer-users] Strange errors while running multiple dancer apps with mount

Naveed Massjouni naveedm9 at gmail.com
Mon Jun 4 05:55:53 CEST 2012


On Thu, May 31, 2012 at 5:17 PM, Gurunandan Bhat <gbhat at pobox.com> wrote:
> I have 2 applications that work fine when run individually. One uses
> sessions (Storable) and the other does not use sessions at all.
>
> When mounted as recommended in  Dancer::Deployment however, I get strange
> errors depending on the sequence that I visit the two applications. app1
> does not use sessions and app2 uses sessions (Storable)
>
> My app.psgi can be viewed here: http://pastie.org/4004017
>
> Here is what I find:
>
> When I visit http://localhost:5000/app1 first and then
> http://localhost:5000/app2. app2 dies with an error: "core - Must specify
> session engine in settings prior to using 'session' keyword at...". The
> Settings section in the Debug panel shows no session related settings even
> though they are present in config.yml
> When I visit http://localhost:5000/app2 and then http://localhost:5000/app1,
> app2 dies again but with a different error: "core - template - file error -
> signin_header.tt: not found at...". signin_header.tt is used in the index
> template using [% INCLUDE....%] directive of TT. This time, the session
> related settings are correctly displayed in the debug panel
> When I visit app2, then app1, then back to app2, I get the session error
> described in item 1.
> Sometimes, and this is random, app2 (the one that uses sessions) also loses
> the value of the database configuration parameters (I use
> Dancer::Plugin::Database) giving me a "...database not defined..." error.
> But this is once in about 8-10 visits. Situations 1, 2 and 3 however play
> out each time.
>
>
> It appears to me that if two apps one using sessions and the other not, then
> visiting the application that does not use sessions somehow deletes the
> session settings of the other application.
>
> I can easily fix the error in item 2 (template not found..) by giving the
> full path of the template, but I would lose the very advantage that makes
> hosting multiple apps *without making any change* to their configuration so
> attractive.
>
> I have tried to debug this for a few days and am unable to figure this.
> Would really appreciate some help/pointers here.
>
>
> Thank you.

Mounting multiple Dancer apps has been broken for a very long time. It
has to do with global things interfering with each other. You can
search the mailing list for alternative solutions. Such as deploying
each app with it's own starman and proxing to them via nginx. My
understanding is that it might be fixed when Dancer2 is released. We
really need to remove the example of mounting multiple apps from the
documentation.
-Naveed


More information about the Dancer-users mailing list