Item10084: Ldap Group normalisation crashes on 1.0.9
Priority: Urgent
Current State: Closed
Released In: n/a
Target Release: n/a
Applies To: Extension
Component: LdapContrib. core
Branches:
happens when I
?refreshldap=on
, and then it never refreshes again - the
cache.db_tmp
is never cleaned up, so Ldap gets very stuck.
Fri Nov 26 08:24:37 2010] [error] [client 203.214.118.65] - LdapContrib - WARNING: updating cache
[Fri Nov 26 08:24:37 2010] [error] [client 203.214.118.65] [Fri Nov 26 08:24:37 2010] view: Can't call method "normalizeWebTopicName" on an undefined value at /home/customer/foswiki/lib/Foswiki/Func.pm line 1197, <DATA> line 613.
[Fri Nov 26 08:24:37 2010] [error] [client 203.214.118.65] [Fri Nov 26 08:24:37 2010] view: at /home/customer/foswiki/lib/Foswiki/Func.pm line 1197
[Fri Nov 26 08:24:37 2010] [error] [client 203.214.118.65] [Fri Nov 26 08:24:37 2010] view: \tFoswiki::Func::topicExists('Main', 'Workgroup') called at /home/customer/foswiki/lib/Foswiki/Contrib/LdapContrib.pm line 1316
[Fri Nov 26 08:24:37 2010] [error] [client 203.214.118.65] [Fri Nov 26 08:24:37 2010] view: \tFoswiki::Contrib::LdapContrib::normalizeWikiName('Foswiki::Contrib::LdapContrib=HASH(0xa8db4e8)', 'Workgroup') called at /home/customer/foswiki/lib/Foswiki/Contrib/LdapContrib.pm line 1216
[Fri Nov 26 08:24:37 2010] [error] [client 203.214.118.65] [Fri Nov 26 08:24:37 2010] view: \tFoswiki::Contrib::LdapContrib::cacheGroupFromEntry('Foswiki::Contrib::LdapContrib=HASH(0xa8db4e8)', 'Net::LDAP::Entry=HASH(0xa97cf78)', 'HASH(0xa8198c0)', 'HASH(0xa82d060)') called at /home/customer/foswiki/lib/Foswiki/Contrib/LdapContrib.pm line 927
[Fri Nov 26 08:24:37 2010] [error] [client 203.214.118.65] [Fri Nov 26 08:24:37 2010] view: \tFoswiki::Contrib::LdapContrib::refreshGroupsCache('Foswiki::Contrib::LdapContrib=HASH(0xa8db4e8)', 'HASH(0xa8198c0)') called at /home/customer/foswiki/lib/Foswiki/Contrib/LdapContrib.pm line 697
[Fri Nov 26 08:24:37 2010] [error] [client 203.214.118.65] [Fri Nov 26 08:24:37 2010] view: \tFoswiki::Contrib::LdapContrib::refreshCache('Foswiki::Contrib::LdapContrib=HASH(0xa8db4e8)') called at /home/customer/foswiki/lib/Foswiki/Contrib/LdapContrib.pm line 658
[Fri Nov 26 08:24:37 2010] [error] [client 203.214.118.65] [Fri Nov 26 08:24:37 2010] view: \tFoswiki::Contrib::LdapContrib::initCache('Foswiki::Contrib::LdapContrib=HASH(0xa8db4e8)') called at /home/customer/foswiki/lib/Foswiki/Contrib/LdapContrib.pm line 287
[Fri Nov 26 08:24:37 2010] [error] [client 203.214.118.65] [Fri Nov 26 08:24:37 2010] view: \tFoswiki::Contrib::LdapContrib::getLdapContrib('Foswiki=HASH(0x9f162a8)') called at /home/customer/foswiki/lib/Foswiki/Users/LdapPasswdUser.pm line 59
[Fri Nov 26 08:24:37 2010] [error] [client 203.214.118.65] [Fri Nov 26 08:24:37 2010] view: \tFoswiki::Users::LdapPasswdUser::new('Foswiki::Users::LdapPasswdUser', 'Foswiki=HASH(0x9f162a8)') called at /home/customer/foswiki/lib/Foswiki/Users/TopicUserMapping.pm line 83
[Fri Nov 26 08:24:37 2010] [error] [client 203.214.118.65] [Fri Nov 26 08:24:37 2010] view: \tFoswiki::Users::TopicUserMapping::new('Foswiki::Users::LdapUserMapping', 'Foswiki=HASH(0x9f162a8)') called at /home/customer/foswiki/lib/Foswiki/Users/LdapUserMapping.pm line 52
[Fri Nov 26 08:24:37 2010] [error] [client 203.214.118.65] [Fri Nov 26 08:24:37 2010] view: \tFoswiki::Users::LdapUserMapping::new('Foswiki::Users::LdapUserMapping', 'Foswiki=HASH(0x9f162a8)') called at /home/customer/foswiki/lib/Foswiki/Users.pm line 123
[Fri Nov 26 08:24:37 2010] [error] [client 203.214.118.65] [Fri Nov 26 08:24:37 2010] view: \tFoswiki::Users::new('Foswiki::Users', 'Foswiki=HASH(0x9f162a8)') called at /home/customer/foswiki/lib/Foswiki.pm line 1442
[Fri Nov 26 08:24:37 2010] [error] [client 203.214.118.65] [Fri Nov 26 08:24:37 2010] view: \tFoswiki::new('Foswiki', undef, 'Foswiki::Request=HASH(0xa0610b0)', 'HASH(0xa264d80)') called at /home/customer/foswiki/lib/Foswiki/UI.pm line 293
[Fri Nov 26 08:24:37 2010] [error] [client 203.214.118.65] [Fri Nov 26 08:24:37 2010] view: \tFoswiki::UI::_execute('Foswiki::Request=HASH(0xa0610b0)', 'CODE(0xa060c70)', 'view', 1) called at /home/customer/foswiki/lib/Foswiki/UI.pm line 275
[Fri Nov 26 08:24:37 2010] [error] [client 203.214.118.65] [Fri Nov 26 08:24:37 2010] view: \tFoswiki::UI::handleRequest('Foswiki::Request=HASH(0xa0610b0)') called at /home/customer/foswiki/lib/Foswiki/Engine/CGI.pm line 29
[Fri Nov 26 08:24:37 2010] [error] [client 203.214.118.65] [Fri Nov 26 08:24:37 2010] view: \tFoswiki::Engine::CGI::run('Foswiki::Engine::CGI=HASH(0xa1663d0)') called at /home/customer/foswiki/bin/view line 45
--
SvenDowideit - 26 Nov 2010
Here's a patch. Could you give it a try, Sven?
--- lib/Foswiki/LoginManager/LdapApacheLogin.pm (revision 10065)
+++ lib/Foswiki/LoginManager/LdapApacheLogin.pm (working copy)
@@ -26,6 +26,11 @@
my ($class, $session) = @_;
my $this = bless( $class->SUPER::new($session), $class );
+
+ # setting the SESSION var rather early; some foswiki engines do that a bit later than
+ # calling for a login manager. otherwise all of the Foswiki::Func API can't be used. see Item10084
+ $Foswiki::Plugins::SESSION = $session;
+
$this->{ldap} = Foswiki::Contrib::LdapContrib::getLdapContrib($session);
return $this;
}
--
MichaelDaum - 26 Nov 2010
nope, that won't do it, I'm using
TemplateAuth.
just to be clear, you are (imo correctly) pointing out that $Foswiki::Plugins::SESSION should be initialised a heck of a lot earlier - which we can fix in 1.1.x and 1.2.x, and hack this way
but that leaves the other issue that is ldap specific - the dump.db_tmp is left lying around due to a crash, or because apache might kill the process etc - can we add some protection to time out the _tmp file - and perhaps add a specific pointer to the file in the log file, so someone trying to debug the situation in future has a pointer to what the issue could be?
I'd put the SESSION init into the
UserMapping::new as well, to cater for non-LdapApace users on 1.0.x and 1.1.2 (who knows what other
LoginManagers might be written)
(and that works here for me)
--
SvenDowideit - 27 Nov 2010
Okay, so while above patch alleviates the pain for people running basic auth, template login users have to hack the core as there's no way to trick in the SESSION via
LdapContrib. Can you provide a patch for what you did to UserMapping so that we can create a "known-issues" thingy?
The _tmp file that was lingering around in the wor_area is definitely due to foswiki crashing.
Once the above or your patch is applied this won't happen again.
We also had some reports on other plugins (
AliasPlugin was it I guess) where the plugin ran into an undefined $Foswiki::Plugin::SESSION while
processing one of its handlers. This seems to substrantiate the suspicion that there's some deeper bug in 1.0.x and possibly on trunk.
--
MichaelDaum - 27 Nov 2010
there
is a way to do it from
LdapContrib - I put the same code you have into the
LdapUserMapper.pm's new - problem solved.
--
SvenDowideit - 27 Nov 2010
I've put the above patch directly into the LdapContrib constructor ... which is code executed by
any login manager early enuf.
Released in 4.20
--
MichaelDaum - 01 Dec 2010