Hi Dave,
From what I understand, there is nothing "magical" about the stash,
it's basically a hash reference, used once per request, that is all.
So, I would suggest you look at debugging more the objects you're
storing in the stash, and how they may change during the request cycle.
You would need to supply more code samples/examples.
If you can, start stripping away what's not necessary and still be able
to re-produce the problem, it will most probably highlight the issue by
itself.
Otherwise, reply back with a full working example.
Ideally use something like http://paste.scsys.co.uk to paste your code
snippets, post as much as you can, it's usually the subtle bits you
don't think are important where the actual issue lies.
Rob
On 04/25/2014 08:08 PM, David Trudgian wrote:
Hi,
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->model('CPFP')->schema->resultset('Searches')->find($sch_id);
$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.
_______________________________________________
List: [email protected]
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/[email protected]/
Dev site: http://dev.catalyst.perl.org/
_______________________________________________
List: [email protected]
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/[email protected]/
Dev site: http://dev.catalyst.perl.org/