Spurious error being presented to users

On our production system, we are occasionally getting the following
error presented to users on the web page:

Can’t use string (“RT::User”) as a HASH ref while “strict refs” in use
at /opt/perl/lib/site_perl/5.8.8/DBIx/SearchBuilder/Record.pm line 389.

It appears to be sporadic, perhaps load related. It typically happens
when someone replies to a ticket (so in Ticket/Update.html) but not
always. I can’t - of course - reproduce it in our dev/test environment.

Does anyone know

a) What might be causing it (I know what the error means from a Perl
POV, I just don’t know why it is happening occasionally; perhaps it’s
caused by an RT::User object that isn’t being properly checked for
initialisation before being used?)
b) Why it’s being dumped to the screen instead of the log (because of
this, I’m not sure how to catch it to get a stack trace)

Thanks in advance,

Olly

On our production system, we are occasionally getting the following
error presented to users on the web page:

What version of RT are you folks running?

Jesse Vincent wrote:

What version of RT are you folks running?

Sorry, should have said. 3.8.1

Not yet worked out if it’s custom code or stock code that’s producing
the error, because not yet worked out how to trap it…

Olly

Jesse Vincent wrote:

What version of RT are you folks running?

Sorry, should have said. 3.8.1

Not yet worked out if it’s custom code or stock code that’s producing
the error, because not yet worked out how to trap it…

It sounds like something is working with RT user objects without
RT::User having been loaded. This sounds like a big we fixed around
3.6.5, so that’s clearly not it :wink:

Olly Stephens wrote:

On our production system, we are occasionally getting the following
error presented to users on the web page:

Can’t use string (“RT::User”) as a HASH ref while “strict refs” in use
at /opt/perl/lib/site_perl/5.8.8/DBIx/SearchBuilder/Record.pm line

OK, I’ve tracked down one place where it’s occurring and it’s mea culpa.

In my custom override for RT::User::CanonicalizeEmailAddress I was
assuming that I was being called as an object method but in fact it’s as
a class method. So $_[0] is the string ‘RT::User’ rather than a valid
object. I was using it to call other RT::User methods that expect a
valid object and this error was occurring when they were trying to test
fields.

I discovered this because the error occurred in a different place in my
development world and included a stack trace. So I’m not 100% convinced
it’s the same instance but the only way to see is to push a fix out to
production and see if it stops the error from occurring.

Olly