[Dancer-users] Strange errors while running multiple dancer apps with mount
Naveed Massjouni
naveedm9 at gmail.com
Mon Jun 4 07:34:45 CEST 2012
On Mon, Jun 4, 2012 at 1:01 AM, Gurunandan Bhat <gbhat at pobox.com> wrote:
>
>
> On Sun, Jun 3, 2012 at 8:55 PM, Naveed Massjouni <naveedm9 at gmail.com> wrote:
>>
>> 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
>
>
>
> Ah! Thank you.
>
> Whom do I petition to get this removed from the documentation? I think there
> is a reference to this in one of the Advent articles too (not sure, will
> check).
>
> Thank you once again for stating this clearly and unambiguously
Way ahead of you :)
https://github.com/sukria/Dancer/pull/799
Also, please consider using a Dancer based paste service instead of pastie:
http://paste.perldancer.org
http://danceb.in
-Naveed
More information about the Dancer-users
mailing list