Item11191: afterSaveHandler doesn't work when the topic is updated in a REST handler
Priority: Normal
Current State: Closed
Released In: n/a
Target Release: n/a
The stack trace includes a call to Core::getDB([name of my plugin]). During the initPlugin() method,
DBCachePlugin saves the name of the first two arguments. These are the name of my plugin and the name of my REST handler, respectively.
Workaround
I was able to get things working by setting the global variables
DBCachePlugin::baseWeb and ::baseTopic in my rest handler.
--
KipLubliner - 21 Oct 2011
Could you attach your stack trace place?
--
MichaelDaum - 21 Oct 2011
I found more problems that explains what is going on. I am using Windows server with ActiveState. Cwd::abs_path works differently on Windows and Unix:
Cwd::abs_path("C:/kip/dev/Foswiki-1.1.2/data/Web")
--> dies : No such file or directory at test.pl line 3
Cwd::abs_path("/export/home/fidev/junk")
--> returns "/export/home/fidev/junk"
I worked around this by removing the call to Cwd::abs_path, as I have an absolute path for DataDir anyway.
--
KipLubliner - 21 Oct 2011
View of a topic that contains "Web.FooBarBaz" (There is no such Web)
| 2011-10-21T19:27:16Z warning | C:/kip/dev/Foswiki-1.1.2/data/Web: No such file or directory at C:/kip/dev/Foswiki-1.1.2/lib/Foswiki/Plugins/DBCachePlugin/Core.pm line 1074
at C:/perl/lib/Cwd.pm line 316
Cwd::_croak('C:/kip/dev/Foswiki-1.1.2/data/Web: No such file or directory') called at C:/perl/lib/Cwd.pm line 592
Cwd::fast_abs_path('C:/kip/dev/Foswiki-1.1.2/data/Web') called at C:/kip/dev/Foswiki-1.1.2/lib/Foswiki/Plugins/DBCachePlugin/Core.pm line 1074
Foswiki::Plugins::DBCachePlugin::Core::getDB('Web') called at C:/kip/dev/Foswiki-1.1.2/lib/Foswiki/Plugins/DBCachePlugin/Core.pm line 202
Foswiki::Plugins::DBCachePlugin::Core::getTopicTitle('Web', 'FooBarBaz') called at C:/kip/dev/Foswiki-1.1.2/lib/Foswiki/Plugins/DBCachePlugin/Core.pm line 104
Foswiki::Plugins::DBCachePlugin::Core::renderWikiWordHandler('FooBarBaz', undef, 'Web', 'FooBarBaz') called at C:/kip/dev/Foswiki-1.1.2/lib/Foswiki/Plugins/DBCachePlugin.pm line 194
Foswiki::Plugins::DBCachePlugin::renderWikiWordHandler('FooBarBaz', undef, 'Web', 'FooBarBaz') called at C:/kip/dev/Foswiki-1.1.2/lib/Foswiki/Plugin.pm line 285
Foswiki::Plugin::invoke('Foswiki::Plugin=HASH(0x22dde04)', 'renderWikiWordHandler', 'FooBarBaz', undef, 'Web', 'FooBarBaz') called at C:/kip/dev/Foswiki-1.1.2/lib/Foswiki/Plugins.pm line 331
Foswiki::Plugins::dispatch('Foswiki::Plugins=HASH(0x1ef8864)', 'renderWikiWordHandler', 'FooBarBaz', undef, 'Web', 'FooBarBaz') called at C:/kip/dev/Foswiki-1.1.2/lib/Foswiki/Render.pm line 534
Foswiki::Render::internalLink('Foswiki::Render=HASH(0x286e8cc)', 'Web', 'FooBarBaz', 'FooBarBaz', '', 1, '', undef) called at C:/kip/dev/Foswiki-1.1.2/lib/Foswiki/Render.pm line 724
Foswiki::Render::_handleWikiWord('Foswiki::Render=HASH(0x286e8cc)', 'Foswiki::Meta=HASH(0x2806c6c)', 'C:/kip/dev/Foswiki-1.1.2/bin', undef, undef) called at C:/kip/dev/Foswiki-1.1.2/lib/Foswiki/Render.pm line 1306
Foswiki::Render::getRenderedVersion('Foswiki::Render=HASH(0x286e8cc)', 'Web.FooBarBaz\x{a}', 'Foswiki::Meta=HASH(0x2806c6c)') called at C:/kip/dev/Foswiki-1.1.2/lib/Foswiki/Meta.pm line 3031
Foswiki::Meta::renderTML('Foswiki::Meta=HASH(0x2806c6c)', 'Web.FooBarBaz\x{a}') called at C:/kip/dev/Foswiki-1.1.2/lib/Foswiki/UI/View.pm line 401
Foswiki::UI::View::_prepare('Web.FooBarBaz\x{a}', 'Foswiki::Meta=HASH(0x2806c6c)', 0) called at C:/kip/dev/Foswiki-1.1.2/lib/Foswiki/UI/View.pm line 380
Foswiki::UI::View::view('Foswiki=HASH(0x1ea90ac)') called at C:/kip/dev/Foswiki-1.1.2/lib/Foswiki/UI.pm line 316
Foswiki::UI::__ANON__() called at C:/perl/site/lib/Error.pm line 415
eval {...} called at C:/perl/site/lib/Error.pm line 407
Error::subs::try('CODE(0x182b39c)', 'HASH(0x1ea8dcc)') called at C:/kip/dev/Foswiki-1.1.2/lib/Foswiki/UI.pm line 435
Foswiki::UI::_execute('Foswiki::Request=HASH(0x1e8af4c)', 'CODE(0x1a0fdcc)', 'view', 1) called at C:/kip/dev/Foswiki-1.1.2/lib/Foswiki/UI.pm line 277
Foswiki::UI::handleRequest('Foswiki::Request=HASH(0x1e8af4c)') called at C:/kip/dev/Foswiki-1.1.2/lib/Foswiki/Engine/CGI.pm line 37
Foswiki::Engine::CGI::run('Foswiki::Engine::CGI=HASH(0x1a9e834)') called at C:/kip/dev/Foswiki-1.1.2/bin/view line 24.
|
----
Running my REST handler
| 2011-10-21T19:29:55Z warning | C:/kip/dev/Foswiki-1.1.2/data/MyCustomPlugin: No such file or directory at C:/kip/dev/Foswiki-1.1.2/lib/Foswiki/Plugins/DBCachePlugin/Core.pm line 1074
at C:/perl/lib/Cwd.pm line 316
Cwd::_croak('C:/kip/dev/Foswiki-1.1.2/data/MyCustomPlugin: No such file...') called at C:/perl/lib/Cwd.pm line 592
Cwd::fast_abs_path('C:/kip/dev/Foswiki-1.1.2/data/MyCustomPlugin') called at C:/kip/dev/Foswiki-1.1.2/lib/Foswiki/Plugins/DBCachePlugin/Core.pm line 1074
Foswiki::Plugins::DBCachePlugin::Core::getDB('MyCustomPlugin') called at C:/kip/dev/Foswiki-1.1.2/lib/Foswiki/Plugins/DBCachePlugin/Core.pm line 148
Foswiki::Plugins::DBCachePlugin::Core::afterSaveHandler('Catalog', 'Change000038') called at C:/kip/dev/Foswiki-1.1.2/lib/Foswiki/Plugins/DBCachePlugin.pm line 152
Foswiki::Plugins::DBCachePlugin::afterSaveHandler('%META:TOPICINFO{author="KipLubliner" comment="save topic" dat...', 'Change000038', 'Catalog', undef, 'Foswiki::Meta=HASH(0x27f8884)') called at C:/kip/dev/Foswiki-1.1.2/lib/Foswiki/Plugin.pm line 285
Foswiki::Plugin::invoke('Foswiki::Plugin=HASH(0x22d31d4)', 'afterSaveHandler', '%META:TOPICINFO{author="KipLubliner" comment="save topic" dat...', 'Change000038', 'Catalog', undef, 'Foswiki::Meta=HASH(0x27f8884)') called at C:/kip/dev/Foswiki-1.1.2/lib/Foswiki/Plugins.pm line 331
Foswiki::Plugins::dispatch('Foswiki::Plugins=HASH(0x1eea5fc)', 'afterSaveHandler', '%META:TOPICINFO{author="KipLubliner" comment="save topic" dat...', 'Change000038', 'Catalog', undef, 'Foswiki::Meta=HASH(0x27f8884)') called at C:/kip/dev/Foswiki-1.1.2/lib/Foswiki/Meta.pm line 1830
Foswiki::Meta::save('Foswiki::Meta=HASH(0x27f8884)') called at C:/kip/dev/Foswiki-1.1.2/lib/Foswiki/Plugins/MyCustomPlugin/Meta.pm line 143
Foswiki::Plugins::MyCustomPlugin::Meta::_metaMultiAddRemove('Foswiki=HASH(0x1ebbbcc)', 'MyCustomPlugin', 'MultiAddRemoveMeta', 'Foswiki::Response=HASH(0x1ebbdbc)') called at C:/kip/dev/Foswiki-1.1.2/lib/Foswiki/Plugins/MyCustomPlugin.pm line 149
Foswiki::Plugins::MyCustomPlugin::_metaMultiAddRemove('Foswiki=HASH(0x1ebbbcc)', 'MyCustomPlugin', 'MultiAddRemoveMeta', 'Foswiki::Response=HASH(0x1ebbdbc)') called at C:/kip/dev/Foswiki-1.1.2/lib/Foswiki/Func.pm line 667
Foswiki::Func::__ANON__('Foswiki=HASH(0x1ebbbcc)', 'MyCustomPlugin', 'MultiAddRemoveMeta', 'Foswiki::Response=HASH(0x1ebbdbc)') called at C:/kip/dev/Foswiki-1.1.2/lib/Foswiki/UI/Rest.pm line 242
Foswiki::UI::Rest::rest('Foswiki=HASH(0x1ebbbcc)') called at C:/kip/dev/Foswiki-1.1.2/lib/Foswiki/UI.pm line 316
Foswiki::UI::__ANON__() called at C:/perl/site/lib/Error.pm line 415
eval {...} called at C:/perl/site/lib/Error.pm line 407
Error::subs::try('CODE(0x182b81c)', 'HASH(0x1ebb8ec)') called at C:/kip/dev/Foswiki-1.1.2/lib/Foswiki/UI.pm line 435
Foswiki::UI::_execute('Foswiki::Request=HASH(0x19005bc)', 'CODE(0x190035c)', 'rest', 1) called at C:/kip/dev/Foswiki-1.1.2/lib/Foswiki/UI.pm line 277
Foswiki::UI::handleRequest('Foswiki::Request=HASH(0x19005bc)') called at C:/kip/dev/Foswiki-1.1.2/lib/Foswiki/Engine/CGI.pm line 37
Foswiki::Engine::CGI::run('Foswiki::Engine::CGI=HASH(0x1a814c4)') called at C:/kip/dev/Foswiki-1.1.2/bin/rest line 24.
|
--
KipLubliner - 21 Oct 2011
I haven't seen this error anymore. Please reopen as needed.
--
MichaelDaum - 06 May 2013