VMware Cloud Community
TimDScott
Enthusiast
Enthusiast

Error: "Transaction was marked for rollback only; cannot commit" whilst doing CRUD over configuration categories/elements

Hi All,

I've written some script to create / update / delete configuration categories / elements. Once out of around 3 runs I'm getting this error:

2019-03-14 15:07:14.094] [E] (com.xxxx.library/processMasterServerMapping) Error in (Dynamic Script Module name : processMasterServerMapping#81) Wrapped java.lang.RuntimeException: ch.dunes.util.DunesServerException: org.springframework.orm.jpa.JpaSystemException: Transaction was marked for rollback only; cannot commit; nested exception is org.hibernate.TransactionException: Transaction was marked for rollback only; cannot commit

Code is attached, I've tried adding some sleep commands, but this doesn't seem to have made any difference.

Would appreciate any feedback!

Thanks,

Tim.

Reply
0 Kudos
4 Replies
iiliev
VMware Employee
VMware Employee

OK, it reports the location of the error - line# 81 - but there is not enough context.

Could you check the log file /var/log/vco/app-server/server.log for more info about this error (like a Java stack trace, etc.)? This should help to identify what is the actual error.

Reply
0 Kudos
TimDScott
Enthusiast
Enthusiast

Hi Llian,

Stacktrace attached, thanks!

Reply
0 Kudos
iiliev
VMware Employee
VMware Employee

The stacktrace says that the root cause of the error is an attempt to create a configuration element category with name 'VCSADemo3.xxxxdemo.com' but there is already a category with the same name and the same parent category, which violates the database constraints.

Reply
0 Kudos
qc4vmware
Virtuoso
Virtuoso

Sounds like a classic race condition to me.  If you are testing with the same value sets over and over you might be getting a collision from concurrent workflow runs, a cache needs some time to sync, or the database is still doing some work.  If sleeps are not working you might try using locking so that only one instance of the workflow is running that is attempting to manipulate elements for a given path.

Paul

Reply
0 Kudos