[Coldbox 6.0.0] [CBORM 2.5.0] ConcurrentModificationException

瀏覽次數:56 次
跳到第一則未讀訊息

jcho...@gmail.com

未讀,
2020年9月30日 下午1:56:492020/9/30
收件者:ColdBox Platform
Hi all,

The last mention of the error above was 5 years ago, so I thought I'd give it a comeback!  My aim is to save an entity and then return a list which includes this new entity - in the same request.

I save a new entity from a standard AJAX POST request:
var bookingSimple = populateModel( 
    model = bookingSimpleService.new(), 
    composeRelationships = true
);
This saves successfully.

In the same request, I trigger an event that runs a newCriteria() which should return a list containing the previously saved entity: [I have removed a number of other "joinTo", "eq" and "isTrue" 's for simplicity. [A MapObject can have many BookingSimples]]:

prc.BookedMapObjects = mapObjectService.newCriteria()
    .joinTo( "BookingSimples", "BookingSimple" )
    .list();

It gives me the ConcurrentModificationException.

I can successfully run this event independently from the save.

The only workaround I can think of is to make 2 AJAX requests....any other suggestions?

jcho...@gmail.com

未讀,
2020年10月1日 清晨6:23:212020/10/1
收件者:ColdBox Platform
After another strong coffee, I think I have resolved this - but I don't know why a ConcurrentModificationException was being triggered. 

The rc contains an element "BookingDate" which is in dd/mm/yyyy format. I convert this to a 'proper date' before populateModel and saving (otherwise the month and day get switched in the database). However the list event also requires a rc.BookingDate in dd/mm/yyyy format (in order to prepare a list of bookings). The first part of this function is again, to convert rc.BookingDate to a proper date - even though it is now (due to the save event) already in the correct format.

Converting the date back to dd/mm/yyyy format after the save has resolved the error.  Why the second event was triggering a ConcurrentModificationException and not some sort of array error (i.e. not finding a '/' to split my formatted date into it's parts), I don't know.

I'll have to chalk this one up to experience.

Brad Wood

未讀,
2020年10月1日 中午12:36:432020/10/1
收件者:col...@googlegroups.com
Firstly, without you providing the full stack trace, it's really impossible to tell what's happening.  Secondly, this is 99.9% chance a bug in Lucee or possibly the incredibly old version of Hibernate that Lucee ships.  I would post to the Lucee ticket system with repro code and a stack trace

Thanks!

~Brad

Developer Advocate
Ortus Solutions, Corp 

ColdBox Platform: http://www.coldbox.org 



--
--
You received this message because you are subscribed to the Google Groups "ColdBox Platform" group.
For News, visit http://blog.coldbox.org
For Documentation, visit http://wiki.coldbox.org
For Bug Reports, visit https://ortussolutions.atlassian.net/browse/COLDBOX
---
You received this message because you are subscribed to the Google Groups "ColdBox Platform" group.
To unsubscribe from this group and stop receiving emails from it, send an email to coldbox+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/coldbox/408599bb-3789-4365-acfb-c0e37f84f4d8n%40googlegroups.com.

jcho...@gmail.com

未讀,
2020年10月20日 清晨7:49:002020/10/20
收件者:ColdBox Platform
  Hi Brad,

Understood. I am now getting an increasing number of ConcurrentModificationException's for errors that have nothing to do with database interactions. So I am trying to delve a bit deeper......

I have attached a stack trace for the following example. 
function index( event, rc, prc )
{    
    prc.test1 = checkinService.newCriteria().list();
    prc.test2 = bookingSimpleService.newCriteria().list();
    event.setView( "test/index" ).noLayou();
}

This gives ConcurrentModificationException - but when I add the "t" (making "noLayout"), everything is fine. One thing to note: bookingSimple can have many checkin's.

Individually, prc.test1 and prc.test2 throw the correct exception.

Correcting noLayout, and putting an incorrect variable name in the view, also results in ConcurrentModificationException rather than a unknown variable error.

I have tried a variety of other 'services' and but it looks like something specific to bookingSimple and checkin, so I have also attached these. 

However, once the error has been triggered once, it does not matter which service I replace for test1 and test2. Any 2 x calls to any 2 x services will fail with ConcurrentModificationException (unless the noLayout corrrection is applied). There's no difference in the symptoms with a fwreinit, so a server restart is required to allow non-related services to throw the correct error.




stacktrace.txt

jcho...@gmail.com

未讀,
2020年10月20日 清晨7:50:542020/10/20
收件者:ColdBox Platform
BookingSimple.cfc and Checkin.cfc

models.zip
回覆所有人
回覆作者
轉寄
0 則新訊息