We recently moved a large application from a Railo Server to Lucee Server.
All works without glitch, with the exception of one rather large problem
that we have spent days trying to resolve without success.
The app is in Coldbox, and we have a Security Interceptor that intercepts
all events and logs them to a DB using a UsageStat model that is created,
populated and saved… The code in the interceptor is within a try catch
block.
We also have a global exception handler which logs error details and just
returns a simple message to the user.
SOME users are experiencing a wierd error … or sequence of errors on
certain events.
It starts with the UsageStat model not being able to save. This is one
issue, but although it is inside a try/block, it seems to continue bubbling
up and causing issues further up the stacktrace, and we end up with about 3
errors being logged from the one initial exception.
This issue did not exist on Railo.
Has anyone experienced anything similar when moving to Lucee?
Here is the code that contains the error. The error is being thrown at
‘stat.save()’, and the error “is could not insert: [UsageStat]”
try {
var stat = orm.new(“UsageStat”);
stat.setTypeID(arguments.type);
stat.setUserID(arguments.userid);
stat.setTstamp(now());
if (structKeyExists(arguments,‘ip’))
stat.setRemoteIP(arguments.ip);
if (structKeyExists(arguments,‘string1’))
stat.setString1(arguments.string1);
if (structKeyExists(arguments,‘ref1’) and isNumeric(arguments.ref1))
stat.setRef1(arguments.ref1);
if (structKeyExists(arguments,‘ref2’) and isNumeric(arguments.ref2))
stat.setRef2(arguments.ref2);
stat.save();
} catch(any excVar){
logbox.error( “ERROR: at usagestatsservice.log” );
logbox.error( excVar.stacktrace );
}
Given it is in a try block, I would expect it to be contained here and not
effect further excecution, but then we get another error “null id in
UsageStat entry (don’t flush the Session after an exception occurs)”, which
seems to be part of the same session.
Can anyone suggest what might be happening here? It is very inermittent
and only happening to some users so very hard to isolate.
Many Thanks for any advice