Returning to this after the summer break, I was astounded to see my fix did
not work on my main machine.

It transpires that this memoize bug is only manifesting its self when using
apache2-mpm-worker. Using apache2-mpm-prefork works fine. (These are latest
Ubuntu builds).

Here's the stack trace:


[6055]  core @0.213982> [hit #1]entering before_template_render hook in
/usr/local/share/perl/5.10.1/Dancer/Hook.pm l. 57
Use of uninitialized value within %revmemotable in hash element
at Memoize::flush_cache(/usr/local/share/perl/5.10.1/Memoize.pm:203)
at
Mason::Interp::_flush_load_cache(/usr/local/share/perl/5.10.1/Mason/Interp.pm:666)
 at Mason::Request::run(/usr/local/share/perl/5.10.1/Mason/Request.pm:285)
at Mason::Interp::run(/usr/local/share/perl/5.10.1/Mason/Interp.pm:366)
 at
Dancer::Template::Mason2::render(/usr/local/share/perl/5.10.1/Dancer/Template/Mason2.pm:33)
at
Dancer::Template::Abstract::apply_renderer(/usr/local/share/perl/5.10.1/Dancer/Template/Abstract.pm:60)
 at
Dancer::Template::Abstract::template(/usr/local/share/perl/5.10.1/Dancer/Template/Abstract.pm:146)
at Dancer::template(/usr/local/share/perl/5.10.1/Dancer.pm:161)
 at
BunnyGo::__ANON__(/home/stephen/BunnyGo/trunk/BunnyGo/lib/BunnyGo.pm:275)
at Dancer::Route::execute(/usr/local/share/perl/5.10.1/Dancer/Route.pm:250)
 at Dancer::Route::run(/usr/local/share/perl/5.10.1/Dancer/Route.pm:169)
at
Dancer::Renderer::get_action_response(/usr/local/share/perl/5.10.1/Dancer/Renderer.pm:127)
 at
Dancer::Renderer::render_action(/usr/local/share/perl/5.10.1/Dancer/Renderer.pm:28)
at <eval>(/usr/local/share/perl/5.10.1/Dancer/Handler.pm:80)
 at
Dancer::Handler::render_request(/usr/local/share/perl/5.10.1/Dancer/Handler.pm:79)
at
Dancer::Handler::handle_request(/usr/local/share/perl/5.10.1/Dancer/Handler.pm:72)
 at
Dancer::Handler::__ANON__(/usr/local/share/perl/5.10.1/Dancer/Handler.pm:111)
at
Plack::Handler::Apache2::call_app(/usr/local/share/perl/5.10.1/Plack/Handler/Apache2.pm:65)
 at
Plack::Handler::Apache2::handler(/usr/local/share/perl/5.10.1/Plack/Handler/Apache2.pm:86)
at <eval>(-e)
 at main::(-e)
Use of uninitialized value within %revmemotable in hash element
at Memoize::flush_cache(/usr/local/share/perl/5.10.1/Memoize.pm:203)
 at
Mason::Interp::_flush_load_cache(/usr/local/share/perl/5.10.1/Mason/Interp.pm:666)
at
Mason::Request::cleanup_request(/usr/local/share/perl/5.10.1/Mason/Request.pm:211)
 at
Mason::Request::__ANON__(/usr/local/share/perl/5.10.1/Mason/Request.pm:281)
at <eval>(/usr/local/share/perl/5.10.1/Memoize.pm:204)
 at
Dancer::Handler::render_request(/usr/local/share/perl/5.10.1/Memoize.pm:204)
at
Dancer::Handler::handle_request(/usr/local/share/perl/5.10.1/Dancer/Handler.pm:72)
 at
Dancer::Handler::__ANON__(/usr/local/share/perl/5.10.1/Dancer/Handler.pm:111)
at
Plack::Handler::Apache2::call_app(/usr/local/share/perl/5.10.1/Plack/Handler/Apache2.pm:65)
 at
Plack::Handler::Apache2::handler(/usr/local/share/perl/5.10.1/Plack/Handler/Apache2.pm:86)
at <eval>(-e)
 at main::(-e)
CODE(0x7f80a30ae788) not memoized
at Guard::__ANON__(/usr/local/share/perl/5.10.1/Memoize.pm:204)
 at <eval>(/usr/local/share/perl/5.10.1/Memoize.pm:204)
at
Dancer::Handler::render_request(/usr/local/share/perl/5.10.1/Memoize.pm:204)
 at
Dancer::Handler::handle_request(/usr/local/share/perl/5.10.1/Dancer/Handler.pm:72)
at
Dancer::Handler::__ANON__(/usr/local/share/perl/5.10.1/Dancer/Handler.pm:111)
 at
Plack::Handler::Apache2::call_app(/usr/local/share/perl/5.10.1/Plack/Handler/Apache2.pm:65)
at
Plack::Handler::Apache2::handler(/usr/local/share/perl/5.10.1/Plack/Handler/Apache2.pm:86)
 at <eval>(-e)
at main::(-e)
[6055] error @0.216585> [hit #1]request to /map.html crashed:
CODE(0x7f80a30ae788) not memoized
 at Memoize::flush_cache(/usr/local/share/perl/5.10.1/Memoize.pm:204)
at
Mason::Interp::_flush_load_cache(/usr/local/share/perl/5.10.1/Mason/Interp.pm:666)
 at Mason::Request::run(/usr/local/share/perl/5.10.1/Mason/Request.pm:285)
at Mason::Interp::run(/usr/local/share/perl/5.10.1/Mason/Interp.pm:366)
 at
Dancer::Template::Mason2::render(/usr/local/share/perl/5.10.1/Dancer/Template/Mason2.pm:33)
at
Dancer::Template::Abstract::apply_renderer(/usr/local/share/perl/5.10.1/Dancer/Template/Abstract.pm:60)
 at
Dancer::Template::Abstract::template(/usr/local/share/perl/5.10.1/Dancer/Template/Abstract.pm:146)
at Dancer::template(/usr/local/share/perl/5.10.1/Dancer.pm:161)
 at
BunnyGo::__ANON__(/home/stephen/BunnyGo/trunk/BunnyGo/lib/BunnyGo.pm:275)
at Dancer::Route::execute(/usr/local/share/perl/5.10.1/Dancer/Route.pm:250)
 at Dancer::Route::run(/usr/local/share/perl/5.10.1/Dancer/Route.pm:169)
at
Dancer::Renderer::get_action_response(/usr/local/share/perl/5.10.1/Dancer/Renderer.pm:127)
 at
Dancer::Renderer::render_action(/usr/local/share/perl/5.10.1/Dancer/Renderer.pm:28)
at <eval>(/usr/local/share/perl/5.10.1/Dancer/Handler.pm:80)
 at
Dancer::Handler::render_request(/usr/local/share/perl/5.10.1/Dancer/Handler.pm:79)
at
Dancer::Handler::handle_request(/usr/local/share/perl/5.10.1/Dancer/Handler.pm:72)
 at
Dancer::Handler::__ANON__(/usr/local/share/perl/5.10.1/Dancer/Handler.pm:111)
at
Plack::Handler::Apache2::call_app(/usr/local/share/perl/5.10.1/Plack/Handler/Apache2.pm:65)
 at
Plack::Handler::Apache2::handler(/usr/local/share/perl/5.10.1/Plack/Handler/Apache2.pm:86)
at <eval>(-e)
 at main::(-e) in /usr/local/share/perl/5.10.1/Dancer/Handler.pm l. 90
[6055]  core @0.251724> [hit #1]entering before_template_render hook in
/usr/local/share/perl/5.10.1/Dancer/Hook.pm l. 57
Use of uninitialized value within %revmemotable in hash element
at Memoize::flush_cache(/usr/local/share/perl/5.10.1/Memoize.pm:203)
at
Mason::Interp::_flush_load_cache(/usr/local/share/perl/5.10.1/Mason/Interp.pm:666)
 at Mason::Request::run(/usr/local/share/perl/5.10.1/Mason/Request.pm:285)
at Mason::Interp::run(/usr/local/share/perl/5.10.1/Mason/Interp.pm:366)
 at
Dancer::Template::Mason2::render(/usr/local/share/perl/5.10.1/Dancer/Template/Mason2.pm:33)
at
Dancer::Template::Abstract::apply_renderer(/usr/local/share/perl/5.10.1/Dancer/Template/Abstract.pm:60)
 at
Dancer::Error::_render_html(/usr/local/share/perl/5.10.1/Dancer/Error.pm:222)
at Dancer::Error::render(/usr/local/share/perl/5.10.1/Dancer/Error.pm:177)
 at
Dancer::Handler::render_request(/usr/local/share/perl/5.10.1/Dancer/Handler.pm:93)
at
Dancer::Handler::handle_request(/usr/local/share/perl/5.10.1/Dancer/Handler.pm:72)
 at
Dancer::Handler::__ANON__(/usr/local/share/perl/5.10.1/Dancer/Handler.pm:111)
at
Plack::Handler::Apache2::call_app(/usr/local/share/perl/5.10.1/Plack/Handler/Apache2.pm:65)
 at
Plack::Handler::Apache2::handler(/usr/local/share/perl/5.10.1/Plack/Handler/Apache2.pm:86)
at <eval>(-e)
 at main::(-e)
Use of uninitialized value within %revmemotable in hash element
at Memoize::flush_cache(/usr/local/share/perl/5.10.1/Memoize.pm:203)
 at
Mason::Interp::_flush_load_cache(/usr/local/share/perl/5.10.1/Mason/Interp.pm:666)
at
Mason::Request::cleanup_request(/usr/local/share/perl/5.10.1/Mason/Request.pm:211)
 at
Mason::Request::__ANON__(/usr/local/share/perl/5.10.1/Mason/Request.pm:281)
at <eval>(/usr/local/share/perl/5.10.1/Memoize.pm:204)
 at Memoize::(/usr/local/share/perl/5.10.1/Memoize.pm:204)
CODE(0x7f80a30ae788) not memoized
at Guard::__ANON__(/usr/local/share/perl/5.10.1/Memoize.pm:204)
 at <eval>(/usr/local/share/perl/5.10.1/Memoize.pm:204)
at Memoize::(/usr/local/share/perl/5.10.1/Memoize.pm:204)


Stephen


On Mon, Aug 1, 2011 at 6:28 PM, Jonathan Swartz <swa...@pobox.com> wrote:

> Ok. Sorry to hear about your back :(, hope you feel better.
>
> I was thinking about making this change, which changes the default data dir
> to always be alongside the comp root. If you are able, can you apply this
> change to your version and see if it makes the default better under apache?
> (For some reason I'm not able to reproduce your bug on my system).
>
> Also, clearly, I need to improve the error message when the object dir is
> not writable.
>
> Thanks
> Jon
>
> --- a/lib/Dancer/Template/Mason2.pm
> +++ b/lib/Dancer/Template/Mason2.pm
> @@ -1,5 +1,6 @@
>  package Dancer::Template::Mason2;
>  use Dancer::Config 'setting';
> +use File::Basename;
>  use FindBin;
>  use Mason;
>  use strict;
> @@ -14,7 +15,7 @@ sub init {
>      my $config = $self->config || {};
>
>      $root_dir = $config->{comp_root} ||= setting('views') || $FindBin::Bin
> . '/views';
> -    $config->{data_dir} ||= $FindBin::Bin . "/data";
> +    $config->{data_dir} ||= dirname($root_dir) . "/data";
>      $config->{autoextend_request_path} = 0 if !exists(
> $config->{autoextend_request_path} );
>
>      $_engine = Mason->new(%$config);
>
>
> On Aug 1, 2011, at 1:35 AM, Stephen Fenwick-Paul wrote:
>
> Thanks for the reply. Sorry for the delay. I've done my back in and typing
> on my laptop upside down is one of the skills they don't teach at college.
>
> But my small investigation points towards the default value of data_dir
> being the issue. When running Dancer in standalone mode data_dir correctly
> points to 'data' in the application's root. But when running under apache it
> appears to    want 'data' to be in /usr/sbin - where, on Ubuntu, apache2
> resides.
>
> So setting data_dir to something sensible fixes my problem.
>
>
>
> On Mon, Jul 25, 2011 at 11:39 PM, Jonathan Swartz <swa...@pobox.com>wrote:
>
>> It worked for me. I'm able to see the "Running with Mason" via Apache.
>>
>> It would be great to get the stacktrace where that "not memoized" error is
>> happening. Maybe you can load Devel::SimpleTrace or Carp::Always in the
>> apache process?
>>
>> On Jul 22, 2011, at 3:40 AM, Stephen Fenwick-Paul wrote:
>>
>> Hi all
>>
>> I'm getting a "CODE(0x7fe2bc5dfba8) not memoized at
>> /usr/share/perl/5.10/Memoize.pm line 204." when using Mason2 with
>> PerlDancer, but only when  running under Apache.
>>
>>
>> How to reproduce (install  Dancer & Dancer::Template::Mason2 first):
>>
>>
>> Make a simple dancer app:
>>
>> $ dancer Simple
>>
>>  Start it:
>>
>> $ Simple/bin/app.pl
>>
>> And view http://localhost:3000
>>
>> And you will see a default page. Good.
>>
>> Copy views/index.tt to views/index.mc
>> Copy views/layout/main.tt to views/layout/main.mc
>>
>> and convert them to Mason2 or just simple HTML pages
>>
>> index,mc:
>> <p>Running with Mason</p>
>>
>> main.mc:
>> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
>>         "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";>
>> <html xmlns="http://www.w3.org/1999/xhtml";>
>> <head>
>> <meta http-equiv="Content-type" content="text/html; charset=<%
>> $.settings->{charset} %>" />
>> <title>Simple</title>
>> <link rel="stylesheet" href="<% $.request->{uri_base} %>/css/style.css" />
>>
>> </head>
>> <body>
>>  <% $.content %>
>> </body>
>> </html>
>>
>> <%args>
>> $.content
>> $.request
>> $.settings
>> </%args>
>>
>> And in config.yml
>>
>> replace:
>>   template: "simple"
>> with
>>   template: "mason2"
>>
>> Restart dancer:
>>
>> bin/app.pl
>>
>> and all is good.
>>
>> Now do it under Apache:
>>
>> Create a httpd.conf:
>>
>>     PerlModule Dancer::Template::Mason2;
>>
>>     <VirtualHost *:80>
>>
>>         ServerName www.simple.new
>>         ServerAlias simple.new
>>         DocumentRoot /home/yours/DancerTest/Simple
>>
>>         <Directory  /home/yours/DancerTest/Simple>
>>             AllowOverride None
>>             Order allow,deny
>>             Allow from all
>>         </Directory>
>>
>>         <Location />
>>             SetHandler perl-script
>>             PerlHandler Plack::Handler::Apache2
>>             PerlSetVar psgi_app /home/yours/DancerTest/Simple/bin/app.pl
>>         </Location>
>>
>>         ErrorLog  /var/log/apache2/simple_error_log
>>         CustomLog /var/log/apache2/simple_access_log common
>>     </VirtualHost>
>>
>> (This is taken from Dancers Deployment guide)
>>
>> Start apache & go to http://www.simple.new and you will get the runtime
>> error.
>>
>> I've got latest versions of Dancer, Mason2 & Dancer::Template::Mason2;
>>
>> ta for any insights
>>
>>
>> Stephen
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>> ------------------------------------------------------------------------------
>> 10 Tips for Better Web Security
>> Learn 10 ways to better secure your business today. Topics covered
>> include:
>> Web security, SSL, hacker attacks & Denial of Service (DoS), private keys,
>> security Microsoft Exchange, secure Instant Messaging, and much more.
>>
>> http://www.accelacomm.com/jaw/sfnl/114/51426210/_______________________________________________
>> Mason-users mailing list
>> Mason-users@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/mason-users
>>
>>
>>
>
> ------------------------------------------------------------------------------
> Got Input?   Slashdot Needs You.
> Take our quick survey online.  Come on, we don't ask for help often.
> Plus, you'll get a chance to win $100 to spend on ThinkGeek.
> http://p.sf.net/sfu/slashdot-survey
>
> _______________________________________________
> Mason-users mailing list
> Mason-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/mason-users
>
>
>
------------------------------------------------------------------------------
EMC VNX: the world's simplest storage, starting under $10K
The only unified storage solution that offers unified management 
Up to 160% more powerful than alternatives and 25% more efficient. 
Guaranteed. http://p.sf.net/sfu/emc-vnx-dev2dev
_______________________________________________
Mason-users mailing list
Mason-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mason-users

Reply via email to