Problem with CHI in Catalyst application

35 views
Skip to first unread message

cub.uanic

unread,
Jan 18, 2011, 6:05:08 AM1/18/11
to Perl-Cache Discuss
Hello guys,

Sorry for posting in several groups/mainling list, but seems all of
them are (or may be) related to this problem.

I have problem with CHI. Seems, it independent from used CHI Driver.
Here is error message that I get:
===================
[error] Caught exception in
RVI::Bonvoyage::Web::Controller::Search->show_search_result "Can't
call method "constructor_params" on an undefined value at
/home/cub/share/perl/lib/perl5/CHI/Driver/Metacache.pm line 17."
===================

I tried to solve it on IRC, but this was deep night, and too few
peoples was online. But I did several pastes:
1) http://paste.scsys.co.uk/83116 - this is method in model class,
contain call to CHI->compute()
2) http://paste.scsys.co.uk/83117 - this is beginning of CHI/Driver/
Metacache.pm, with mark on line 17
3) http://paste.scsys.co.uk/83118 - this is config of CHI, changing
driver to "Null" doesn't solve problem, and get exact same error
4) http://paste.scsys.co.uk/83119 - this is backtrace, up to first
line of CHI::Driver::Metacache::_build_meta_cache()
5) http://paste.scsys.co.uk/83129 - this is variables dump, right
before line 17

Error occurs only on first call to $self->cache->compute() for given
args. Next calls with same args working fine, and don't throw any
errors. Restarting app lead to error on first call again. Seems, this
is related to CHI::set() only? Nevertheless, even with error, value in
cache IS set. After exception call stack return control to Catalyst,
and he ready to accept next request, and on next request I'm not only
don't have error, but CHI::compute() give me correct value from cache.

Will be glad to get any help or ideas.

Thanks in advance,
Good luck!

--
Sincerely yours,
Oleg Kostyuk (CUB-UANIC)

Jonathan Swartz

unread,
Jan 20, 2011, 7:45:10 PM1/20/11
to Oleg Kostyuk, Perl-Cache Discuss
It seems like the owner_cache attribute of CHI::Driver::Metacache, which is a weak reference, is getting undefined because the parent cache is garbage collected. Either that or it was never initialized.

* If you remove max_size from the config, does the error goes away?
* If you change the compute() call to a more standard get()/set() pattern, does the error go away?
* If you change owner_cache (line 9 of Metacache.pm) to be 'required => 1', does a new error occur?

Thanks
Jon


On Jan 17, 2011, at 10:02 PM, Oleg Kostyuk wrote:

> Hello guys,
>
> Sorry for posting in several groups/mainling list, but seems all of
> them are (or may be) related to this problem.
>
> I have problem with CHI.
> Seems, it independent from used CHI Driver.
>
> Here is error message that I get:
> ===================
> [error] Caught exception in
> RVI::Bonvoyage::Web::Controller::Search->show_search_result "Can't
> call method "constructor_params" on an undefined value at
> /home/cub/share/perl/lib/perl5/CHI/Driver/Metacache.pm line 17."
> ===================
>
> I tried to solve it on IRC, but this was deep night, and too few
> peoples was online. But I did several pastes:
> 1) http://paste.scsys.co.uk/83116 - this is method in model class,
> contain call to CHI->compute()
> 2) http://paste.scsys.co.uk/83117 - this is beginning of

> CHI/Driver/Metacache.pm, with mark on line 17

Oleg Kostyuk

unread,
Jan 24, 2011, 6:57:32 AM1/24/11
to Jonathan Swartz, Perl-Cache Discuss
Hello Jonathan,

2011/1/20 Jonathan Swartz <swa...@pobox.com>:


> It seems like the owner_cache attribute of CHI::Driver::Metacache, which is a weak reference,
> is getting undefined because the parent cache is garbage collected. Either that or it was never initialized.
>
> * If you remove max_size from the config, does the error goes away?

Yes, without max_size all working as expected and without any errors.

> * If you change the compute() call to a more standard get()/set() pattern, does the error go away?

With defined max_cache and using get/set, leads to error:

[error] Caught exception in
RVI::Bonvoyage::Web::Controller::Search->show_search_result
"Can't call method "constructor_params" on an undefined value at

/home/cub/share/perl/lib/perl5/CHI/Driver/Metacache.pm line 18."

> * If you change owner_cache (line 9 of Metacache.pm) to be 'required => 1', does a new error occur?

Yes, exactly as in previous scenario.

Sorry for a delay, I was to busy with work. I'm hope this response
help you with solving the issue. Don't hesitate to send more testing
scenarios.

Will wait for your response,
Good luck!

Oleg Kostyuk

unread,
Jan 25, 2011, 3:46:11 PM1/25/11
to Jonathan Swartz, Perl-Cache Discuss
Any update, please ?


2011/1/24 Oleg Kostyuk <cub....@gmail.com>:

Jonathan Swartz

unread,
Jan 27, 2011, 7:34:27 PM1/27/11
to Oleg Kostyuk, Perl-Cache Discuss
Do all the CHI tests pass on your system? There are a number tests that exercise size awareness.

The best (only?) way for us to help you would be for you to come up with a minimal reproduction of the bug. In particular, get it out of Catalyst into a script, then remove pieces until you are down to the minimal script that fails. In the process, you may well figure out where things are going wrong.

Jon

Reply all
Reply to author
Forward
0 new messages