Item2563: crashes with uninitialized value in many cases

pencil
Priority: Urgent
Current State: Closed
Released In: 1.1.0
Target Release: minor
Applies To: Engine
Component:
Branches:
Reported By: KennethLavrsen
Waiting For:
Last Change By: CrawfordCurrie
In trunk only

I have seen several times that if the topic contains an INCLUDE or similar that points to a non existing topic the code crashes.

It seems to be a result of the recent refactoring.

the error in the browser is this when I look at UserRegistration

Use of uninitialized value in -e at /var/www/foswiki/core/lib/Foswiki/Store/VC/Handler.pm line 423.
 at /usr/lib/perl5/5.8.8/CGI/Carp.pm line 314
   CGI::Carp::realdie('Use of uninitialized value in -e at /var/www/foswiki/core/lib...') called at /usr/lib/perl5/5.8.8/CGI/Carp.pm line 385
   CGI::Carp::die('Use of uninitialized value in -e at /var/www/foswiki/core/lib...') called at /var/www/foswiki/core/lib/Foswiki.pm line 145
   Foswiki::__ANON__('Use of uninitialized value in -e at /var/www/foswiki/core/lib...') called at /var/www/foswiki/core/lib/Foswiki/Store/VC/Handler.pm line 423
   Foswiki::Store::VC::Handler::storedDataExists('Foswiki::Store::VC::RcsWrapHandler=HASH(0xa503f00)') called at /var/www/foswiki/core/lib/Foswiki/Store/VC/Store.pm line 342
   Foswiki::Store::VC::Store::topicExists('Foswiki::Store::RcsWrap=HASH(0x9730e7c)', '', 'BaseGroup') called at /var/www/foswiki/core/lib/Foswiki.pm line 3226
   Foswiki::topicExists('Foswiki=HASH(0x9730b10)', '', 'BaseGroup') called at /var/www/foswiki/core/lib/Foswiki/If/OP_istopic.pm line 33
   Foswiki::If::OP_istopic::evaluate('Foswiki::If::OP_istopic=HASH(0xa2ad8a0)', 'Foswiki::If::Node=HASH(0xa527ec4)', 'tom', 'Foswiki::Meta=HASH(0xa4c66e8)', 'data', 'Foswiki::Meta=HASH(0xa4c66e8)') called at /var/www/foswiki/core/lib/Foswiki/Query/Node.pm line 121
   Foswiki::Query::Node::evaluate('Foswiki::If::Node=HASH(0xa527ec4)', 'tom', 'Foswiki::Meta=HASH(0xa4c66e8)', 'data', 'Foswiki::Meta=HASH(0xa4c66e8)') called at /var/www/foswiki/core/lib/Foswiki/Query/OP_not.pm line 25
   Foswiki::Query::OP_not::evaluate('Foswiki::Query::OP_not=HASH(0xa25bfb4)', 'Foswiki::If::Node=HASH(0xa527f0c)', 'tom', 'Foswiki::Meta=HASH(0xa4c66e8)', 'data', 'Foswiki::Meta=HASH(0xa4c66e8)') called at /var/www/foswiki/core/lib/Foswiki/Query/Node.pm line 121
   Foswiki::Query::Node::evaluate('Foswiki::If::Node=HASH(0xa527f0c)', 'tom', 'Foswiki::Meta=HASH(0xa4c66e8)', 'data', 'Foswiki::Meta=HASH(0xa4c66e8)') called at /var/www/foswiki/core/lib/Foswiki/Macros/IF.pm line 33
   Foswiki::__ANON__() called at /usr/lib/perl5/vendor_perl/5.8.8/Error.pm line 415
   eval {...} called at /usr/lib/perl5/vendor_perl/5.8.8/Error.pm line 407
   Error::subs::try('CODE(0xa4cdfc8)', 'HASH(0xa4f16d0)') called at /var/www/foswiki/core/lib/Foswiki/Macros/IF.pm line 50
   Foswiki::IF('Foswiki=HASH(0x9730b10)', 'Foswiki::Attrs=HASH(0xa4f15d4)', 'Foswiki::Meta=HASH(0xa4c66e8)') called at /var/www/foswiki/core/lib/Foswiki.pm line 2857
   Foswiki::_expandMacroOnTopicRendering('Foswiki=HASH(0x9730b10)', 'IF', '"not istopic \'%MAINWEB%.BaseGroup\'" then="<nop>" else="%MAI...', 'Foswiki::Meta=HASH(0xa4c66e8)') called at /var/www/foswiki/core/lib/Foswiki.pm line 2758
   Foswiki::_processMacros('Foswiki=HASH(0x9730b10)', '<!-- changegroup -->\x{a}<input type="checkbox" name="Twk0AddToGr...', 'CODE(0x9459784)', 'Foswiki::Meta=HASH(0xa4c66e8)', 16) called at /var/www/foswiki/core/lib/Foswiki.pm line 2557
   Foswiki::innerExpandMacros('Foswiki=HASH(0x9730b10)', 'SCALAR(0xa4c6c1c)', 'Foswiki::Meta=HASH(0xa4c66e8)') called at /var/www/foswiki/core/lib/Foswiki/Macros/INCLUDE.pm line 273
   Foswiki::__ANON__() called at /usr/lib/perl5/vendor_perl/5.8.8/Error.pm line 415
   eval {...} called at /usr/lib/perl5/vendor_perl/5.8.8/Error.pm line 407
   Error::subs::try('CODE(0xa4c6b50)', 'HASH(0xa4ecc2c)') called at /var/www/foswiki/core/lib/Foswiki/Macros/INCLUDE.pm line 320
   Foswiki::INCLUDE('Foswiki=HASH(0x9730b10)', 'Foswiki::Attrs=HASH(0xa4cd680)', 'Foswiki::Meta=HASH(0xa4c625c)') called at /var/www/foswiki/core/lib/Foswiki.pm line 2857
   Foswiki::_expandMacroOnTopicRendering('Foswiki=HASH(0x9730b10)', 'INCLUDE', '"System.UserRegistration"\x{a}  section="changegroup"\x{a}  groupname...', 'Foswiki::Meta=HASH(0xa4c625c)') called at /var/www/foswiki/core/lib/Foswiki.pm line 2758
   Foswiki::_processMacros('Foswiki=HASH(0x9730b10)', '<!-- rendergroup -->\x{a}%INCLUDE{"%WEB%.%TOPIC%"\x{a}  section="%IF{...', 'CODE(0x9459784)', 'Foswiki::Meta=HASH(0xa4c625c)', 16) called at /var/www/foswiki/core/lib/Foswiki.pm line 2557
   Foswiki::innerExpandMacros('Foswiki=HASH(0x9730b10)', 'SCALAR(0xa4c6058)', 'Foswiki::Meta=HASH(0xa4c625c)') called at /var/www/foswiki/core/lib/Foswiki/Macros/INCLUDE.pm line 273
   Foswiki::__ANON__() called at /usr/lib/perl5/vendor_perl/5.8.8/Error.pm line 415
   eval {...} called at /usr/lib/perl5/vendor_perl/5.8.8/Error.pm line 407
   Error::subs::try('CODE(0xa4c63ac)', 'HASH(0xa4c65bc)') called at /var/www/foswiki/core/lib/Foswiki/Macros/INCLUDE.pm line 320
   Foswiki::INCLUDE('Foswiki=HASH(0x9730b10)', 'Foswiki::Attrs=HASH(0xa4130d4)', 'Foswiki::Meta=HASH(0x9fd4c6c)') called at /var/www/foswiki/core/lib/Foswiki.pm line 2857
   Foswiki::_expandMacroOnTopicRendering('Foswiki=HASH(0x9730b10)', 'INCLUDE', '"System.UserRegistration"\x{a}         section="rendergroup"\x{a}    ...', 'Foswiki::Meta=HASH(0x9fd4c6c)') called at /var/www/foswiki/core/lib/Foswiki.pm line 2758
   Foswiki::_processMacros('Foswiki=HASH(0x9730b10)', '%INCLUDE{"System.UserRegistration" section="rendergroupheader...', 'CODE(0x9459784)', 'Foswiki::Meta=HASH(0x9fd4c6c)', 15) called at /var/www/foswiki/core/lib/Foswiki.pm line 2774
   Foswiki::_processMacros('Foswiki=HASH(0x9730b10)', '---+ %MAKETEXT{"Registration"}%\x{a}\x{a}%IF{"context registration_su...', 'CODE(0x9459784)', 'Foswiki::Meta=HASH(0x9fd4c6c)', 16) called at /var/www/foswiki/core/lib/Foswiki.pm line 2557
   Foswiki::innerExpandMacros('Foswiki=HASH(0x9730b10)', 'SCALAR(0x96c3878)', 'Foswiki::Meta=HASH(0x9fd4c6c)') called at /var/www/foswiki/core/lib/Foswiki.pm line 3021
   Foswiki::expandMacros('Foswiki=HASH(0x9730b10)', '---+ %MAKETEXT{"Registration"}%\x{a}\x{a}%IF{"context registration_su...', 'Foswiki::Meta=HASH(0x9fd4c6c)') called at /var/www/foswiki/core/lib/Foswiki/Meta.pm line 2429
   Foswiki::Meta::expandMacros('Foswiki::Meta=HASH(0x9fd4c6c)', '---+ %MAKETEXT{"Registration"}%\x{a}\x{a}%IF{"context registration_su...') called at /var/www/foswiki/core/lib/Foswiki/UI/View.pm line 434
   Foswiki::UI::View::_prepare('---+ %MAKETEXT{"Registration"}%\x{a}\x{a}%IF{"context registration_su...', 'Foswiki::Meta=HASH(0x9fd4c6c)', 0) called at /var/www/foswiki/core/lib/Foswiki/UI/View.pm line 414
   Foswiki::UI::View::view('Foswiki=HASH(0x9730b10)') called at /var/www/foswiki/core/lib/Foswiki/UI.pm line 303
   Foswiki::UI::__ANON__() called at /usr/lib/perl5/vendor_perl/5.8.8/Error.pm line 415
   eval {...} called at /usr/lib/perl5/vendor_perl/5.8.8/Error.pm line 407
   Error::subs::try('CODE(0x91c6448)', 'HASH(0x97308c4)') called at /var/www/foswiki/core/lib/Foswiki/UI.pm line 410
   Foswiki::UI::_execute('Foswiki::Request=HASH(0x96f3c18)', 'CODE(0x96fb694)', 'view', 1) called at /var/www/foswiki/core/lib/Foswiki/UI.pm line 270
   Foswiki::UI::handleRequest('Foswiki::Request=HASH(0x96f3c18)') called at /var/www/foswiki/core/lib/Foswiki/Engine/CGI.pm line 29
   Foswiki::Engine::CGI::run('Foswiki::Engine::CGI=HASH(0x9619dec)') called at /var/www/foswiki/core/bin/view line 45.

-- KennethLavrsen - 03 Jan 2010

Looking at the stack trace I don't think this is anything to do with a non-existing topic; though it's not easy to tell. I can't reproduce the problem, so I'm guessing when I suggest that:
    return 0 unless $this->{file};
at line 424 of Foswiki/Store/VC/Handler.pm will cure it. On the other hand, it may just move the problem elsewhere.

Marked waiting for feedback, until someone can describe how to reproduce the problem.

-- CrawfordCurrie - 19 Jan 2010

I run with TWikiCompatibilityPlugin disabled.

And because of Item2661 this meant that UserRegistration passed this where MAINWEB is undefined

So even if this removes the error from UserRegistration the error is in the code.

To reproduce. revert 2261 and disable TWikiCompatibilityPlugin, remove any preference setting of MAINWEB, and view UserRegistration

-- KennethLavrsen - 20 Jan 2010

OK, I was able to reproduce it in the end, after a lot of mucking about. The problem is the implementation of istopic, which doesn't check the validity of the web.

-- CrawfordCurrie - 20 Jan 2010

ItemTemplate edit

Summary crashes with uninitialized value in many cases
ReportedBy KennethLavrsen
Codebase
SVN Range
AppliesTo Engine
Component
Priority Urgent
CurrentState Closed
WaitingFor
Checkins distro:22691f83db4a
TargetRelease minor
ReleasedIn 1.1.0
Topic revision: r4 - 20 Jan 2010, CrawfordCurrie
The copyright of the content on this website is held by the contributing authors, except where stated elsewhere. See Copyright Statement. Creative Commons License    Legal Imprint    Privacy Policy