It's all about the answers!

Ask a question

Deadlock occures often on ramDB when trying to add asset relationship via java api


idris yuce (13145) | asked May 23 '13, 7:25 a.m.
Hi ,
 I m using RAM 7.5.1 using with  SQL Server 2008 db

I'm having deadlock problems while trying to add relations of assets via RAM java api.

my relations are as following in an excel file.

Caller Asset name   called Asset Name
------------------  ------------------
ARD240   ATSTAB   
ARD240   AMDTAB   
ARD240   ATCCAB   
ARD240   ABSOAB   
ARD245   AMCRAB   
ARD245   AMSLAB   
ARD245   AMLDAB   
........

i m reading caller and called assets from excel file and then finding those assets in RAM and then adding relations.
However after a time (lets say 30-40 relations  ) i get deadlock errors on ramdb as shown below.

ERROR [main] (Monitoring.java:44) 2013-05-23 13:43:30,800 - The asset ARD240[1.0] was not updated.
com.ibm.ram.internal.client.RAMServiceException: Repository exception trying to submit asset - ARD240 - ID#AC1F65D0-0D5F-C93D-DFE4-357EE6678A10 Version#1.0: Transaction (Process ID 147) was deadlocked on lock resources with another process and has been chosen as the deadlock victim. Rerun the transaction.[500]
at com.ibm.ram.internal.client.RAMClient.uploadAsset(RAMClient.java:1535)
at com.ibm.ram.client.RAMSession.putAsset(RAMSession.java:3212)
at com.ibm.ram.client.RAMSession.put(RAMSession.java:5029)
at com.akbank.ram.asset.MFRelationshipManager.addRelationInExcel(MFRelationshipManager.java:106)
at com.akbank.ram.asset.MFRelationshipManager.createRelations(MFRelationshipManager.java:37)
at com.akbank.ram.asset.MFRelationshipManager.main(MFRelationshipManager.java:27)
I searched forum and google and saw setting  R"EAD_COMMITTED_SNAPSHOT" property to "ON"  on SQLSErver can help 
https://jazz.net/forum/questions/94116/i-see-a-deadlock-on-my-ccm-sql-server-database-is-there-a-way-to-prevent-it

Did anyone faced that problem on ramdb and could see that setting this variable to "ON" helped?

Regards.

One answer



permanent link
Rich Kulp (3.6k38) | answered May 23 '13, 9:54 a.m.
FORUM MODERATOR / JAZZ DEVELOPER
Do not change database settings. RAM will not work properly if flags like that are changed.

The problem is probably you are doing too many independent updates of interrelated assets. In 7.5.1, which is ancient, when you update a related asset link, the other asset is updated at the same time. If you are going back and forth updating assets that are pointing to each other and you do this fast and in parallel there could be deadlocks. When there is a deadlock you need to re-get the asset in question and try again. Deadlocks are always possible in a multi-threaded complicated environment such as RAM.

However, your better bet is to step up to RAM 7512. The whole architecture of doing related assets has changed. In 7512 when you update an asset to have a relationship to another asset that other asset is not immediately changed. It is changed later so you would not be running into deadlock situations, or at least very rarely.

There have been many many fixes and enhancements since 7.5.1.

Comments
idris yuce commented May 27 '13, 3:11 a.m.

Thanks Richard,

 Our exact Ram version is 7.5.1.1. I put 50 seconds delay on each relation creation but the same deadlock problem happened after creation of 1150 relations. There is about 100K relations need to be created in RAM . 

We will asses to upgrade 7.5.1.2 but i think  50 seconds is pretty long time for such a db related operation.


Gili Mendel commented May 28 '13, 8:43 a.m.
JAZZ DEVELOPER

50sec. may not always work ... as Rich noted, 7512 addressed these collisions issues.

Your answer


Register or to post your answer.