[Catalyst] Inconsistency when retrieving objects from stash

David Trudgian David.Trudgian at UTSouthwestern.edu
Fri Apr 25 19:08:44 GMT 2014


I'm observing a frustrating problem where the following happens:

A Catalyst controller retrieves a 'search' object and the related parent 'submission' object from a DBIC schema instance. It puts them into the stash:

  $c->stash->{search}     = $search;
  $c->stash->{submission} = $search->submission;

Now, the relationships here mean it's always the case that $search->submission->sub_id = $submission->sub_id

However, when forwarded to the view (TT2 HTML or Excel Template Plus based), occasionally the search and submission pulled back out of the stash in the template are inconsistent. The following trap in the template will throw an error:

[% IF search.submission.sub_id != submission.sub_id %]
  [% THROW mismatch "Fatal Error SCH-SUB-ID != SUB-ID" %]
[% END %]

I don't understand how this is possible, given the way the stash values are set in the controller. It occurs infrequently, and I can't find a situation that reproducibly causes it. The app is running under fastcgi on Apache.

Any thoughts on what to look at would be much appreciated. I was considering session crossover as a cause, so ensured there was entropy on the server, set no-cache headers for proxies etc. However, I have now seen this occur on a development machine with only me connected to the app. I don't understand well enough how the stash works in order to know what might affect the consistency like this.

Any help greatly appreciated!

Dave Trudgian


UT Southwestern Medical Center
The future of medicine, today.

More information about the Catalyst mailing list