Strange Error handling after moving from Railo to Lucee

145 views
Skip to first unread message

Jason Morris

unread,
Jul 28, 2015, 3:32:39 AM7/28/15
to Lucee
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











Jon Clausen

unread,
Jul 28, 2015, 11:02:39 AM7/28/15
to lu...@googlegroups.com
A thought and a question:

Have you tried Javacast in the setters on all of your variables that aren’t strings (e.g. - empty values as nulls, integers)?  I see specific type checks on arguments.ref1 and arguments.ref2.  

I noticed some additional fussiness about java types, - “short”,”long”,”float”,and “integer”, specifically - when I moved from Railo 4 to Lucee 4.5.  Not sure if that’s due to a change with Lucee or the hibernate version being used. I solved it globally by adding an ORM Decorator that overloads the save() method for all persistent entities, inspects the component metadata for the “ormtype” property attribute and checks for the correct type cast.

Are the errors thrown in the sequence caused by variables that would have been generated by the UsageStat database entry?

Jon
--
You received this message because you are subscribed to the Google Groups "Lucee" group.
To unsubscribe from this group and stop receiving emails from it, send an email to lucee+un...@googlegroups.com.
To post to this group, send email to lu...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/lucee/3fdeafd1-df51-4a4c-a652-80d8537e73e4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages