• Do not register here on develop.twiki.org, login with your twiki.org account.
• Use View topic Item7848 for generic doc work for TWiki-6.1.1. Use View topic Item7851 for doc work on extensions that are not part of a release. More... Close
• Anything you create or change in standard webs (Main, TWiki, Sandbox etc) will be automatically reverted on every SVN update.
Does this site look broken?. Use the LitterTray web for test cases.

Item6739: Using MapIP2SID causes Perl "Can't locate" error

Item Form Data

AppliesTo: Component: Priority: CurrentState: WaitingFor: TargetRelease ReleasedIn
Engine (unknown) Normal New   n/a  

Edit Form Data

Reported By:
Applies To:
Current State:
Waiting For:
Target Release:
Released In:


I first reported this in SID-01188. I have a TWiki 4.1 on an old Solaris server that I am migrating to TWiki 5 on a new Linux server. I set the Priority to Urgent because my users are used to persistent sessions, and will not tolerate having to log in every day, so I can't migrate till this is fixed.

The problem: We use MapIP2SID in TWiki 4.1 and it works. But in TWiki 5 when I turn on {Sessions}{MapIP2SID} in configure, viewing any TWiki page (except configure) breaks with a Perl error. Edit pages seem to load, but in the edit box where the topic content would be, I get There was a problem retrieving http://btnintra01//rest/WysiwygPlugin/tml2html: GENERAL 500. If I turn off MapID2SID, the errors go away and TWiki functions normally. From the Apache error log:

[Thu May 12 12:33:18 2011] [error] 
[Thu May 12 12:33:18 2011] -e: Can't locate object method "address" via package "TWiki::Request" at /web/twiki/lib/TWiki/LoginManager.pm line 235.\n
[Thu May 12 12:33:18 2011] -e:  at /web/twiki/lib/TWiki/LoginManager.pm line 235\n
    my $ip = $this->{twiki}->{request}->address;
[Thu May 12 12:33:18 2011] -e: \tTWiki::LoginManager::_IP2SID('TWiki::LoginManager::TemplateLogin=HASH(0x1e241640)') called at /web/twiki/lib/TWiki/LoginManager.pm line 316\n
        my $sid = $this->_IP2SID();
[Thu May 12 12:33:18 2011] -e: \tTWiki::LoginManager::loadSession('TWiki::LoginManager::TemplateLogin=HASH(0x1e241640)', 'undef') called at /web/twiki/lib/TWiki/Users.pm line 116\n
    $this->{loginManager} = TWiki::LoginManager::makeLoginManager( $session );
      $this->{loginManager}->loadSession( $session->{remoteUser} );
[Thu May 12 12:33:18 2011] -e: \tTWiki::Users::new('TWiki::Users', 'TWiki=HASH(0x1e1ebd60)') called at /web/twiki/lib/TWiki.pm line 1566\n
    my( $class, $login, $query, $initialContext ) = @_;
    my $this = bless( {}, $class );
[Thu May 12 12:33:18 2011] -e: \tTWiki::new('TWiki', 'undef', 'TWiki::Request=HASH(0x1e1f2dd0)', 'HASH(0x1e0138c0)') called at /web/twiki/lib/TWiki/UI.pm line 191\n
[Thu May 12 12:33:18 2011] -e: \tTWiki::UI::execute('TWiki::Request=HASH(0x1e1f2dd0)', 'CODE(0x1d580ff0)', 'view', 1) called at /web/twiki/lib/TWiki/UI.pm line 175\n
[Thu May 12 12:33:18 2011] -e: \tTWiki::UI::handleRequest('TWiki::Request=HASH(0x1e1f2dd0)') called at /web/twiki/lib/TWiki/Engine/CGI.pm line 47\n
[Thu May 12 12:33:18 2011] -e: \tTWiki::Engine::CGI::run('TWiki::Engine::CGI=HASH(0x1db95510)') called at /web/twiki/bin/view line 43\n
[Thu May 12 12:33:18 2011] -e: \tModPerl::ROOT::ModPerl::Registry::web_twiki_bin_view::handler('Apache2::RequestRec=SCALAR(0x1d86cd80)') called at /usr/lib64/perl5/site_perl/5.8.8/x86_64-linux-thread-multi/ModPerl/RegistryCooker.pm line 204\n
[Thu May 12 12:33:18 2011] -e: \teval {...} called at /usr/lib64/perl5/site_perl/5.8.8/x86_64-linux-thread-multi/ModPerl/RegistryCooker.pm line 204\n
[Thu May 12 12:33:18 2011] -e: \tModPerl::RegistryCooker::run('ModPerl::Registry=HASH(0x1d631600)') called at /usr/lib64/perl5/site_perl/5.8.8/x86_64-linux-thread-multi/ModPerl/RegistryCooker.pm line 170\n
[Thu May 12 12:33:18 2011] -e: \tModPerl::RegistryCooker::default_handler('ModPerl::Registry=HASH(0x1d631600)') called at /usr/lib64/perl5/site_perl/5.8.8/x86_64-linux-thread-multi/ModPerl/Registry.pm line 31\n
[Thu May 12 12:33:18 2011] -e: \tModPerl::Registry::handler('ModPerl::Registry', 'Apache2::RequestRec=SCALAR(0x1d86cd80)') called at -e line 0\n
[Thu May 12 12:33:18 2011] -e: \teval {...} called at -e line 0\n

See the SID-01188 attachment if you need my configure output.

-- TWiki:Main/JohnWorsley - 2011-06-01

I have made two changes to the code which appear to have fixed the problem.

Regarding the first one, there is no TWiki::Request::address method, but there is a remoteAddress method which appears to do exactly what address was expected to do.

Regarding the second one, LoginManager::Session::load is being passed the SID in the parameter which that $ENV{REMOTE_ADDR} line expects to be a method. The line appears to be unnecessary.

--- LoginManager.pm.orig        2010-10-10 23:15:40.000000000 -0700
+++ LoginManager.pm     2011-06-08 16:27:26.000000000 -0700
@@ -232,7 +232,7 @@
 sub _IP2SID {
     my( $this, $sid ) = @_;

-    my $ip = $this->{twiki}->{request}->address;
+    my $ip = $this->{twiki}->{request}->remoteAddress();

     return undef unless $ip; # no IP address, can't map

--- LoginManager/Session.pm.orig        2010-10-10 23:15:40.000000000 -0700
+++ LoginManager/Session.pm     2011-06-08 16:25:48.000000000 -0700
@@ -42,7 +42,7 @@
 sub load {
     my $this = shift;
     # local %ENV; # TWikibug:Item6583 - commented out
-    $ENV{REMOTE_ADDR} = @_ == 1 ? $_[0]->remoteAddress : $_[1]->remoteAddress;
+#    $ENV{REMOTE_ADDR} = @_ == 1 ? $_[0]->remoteAddress() : $_[1]->remoteAddress();

-- TWiki:Main.JohnWorsley - 2011-06-09

Thanks John for debugging and for the proposed fix, appreciated! It is important to set $ENV{REMOTE_ADDR}, I think this issue needs some more debugging.

-- TWiki:Main.PeterThoeny - 2011-06-17

I'm sure it does! I have not encountered any problems so far with that line commented out; I would rather have corrected the way $ENV{REMOTE_ADDR} is set, but don't have time right now. This is my first time poking around in the TWiki core, so it takes me a long time to figure anything out.

-- TWiki:Main.JohnWorsley - 2011-06-20

Decided at TWiki:Codev.KampalaReleaseMeeting2017x12x21 to reprioritize to "normal".

-- TWiki:Main.PeterThoeny - 2017-12-21

Summary Using MapIP2SID causes Perl "Can't locate" error
ReportedBy TWiki:Main.JohnWorsley
Codebase 5.0.1
SVN Range TWiki-5.1.0-trunk, Sun, 22 May 2011, build 21317
AppliesTo Engine
Component (unknown)
Priority Normal
CurrentState New


TargetRelease n/a

Edit | Attach | Watch | Print version | History: r5 < r4 < r3 < r2 < r1 | Backlinks | Raw View |  Raw edit | More topic actions
Topic revision: r5 - 2017-12-21 - PeterThoeny
This site is powered by the TWiki collaboration platform Powered by PerlCopyright © 2008-2022 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback