Click here to Skip to main content
15,881,248 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello All,
We have created an API that is continuous hitting the database table and if anyone other user try to insert or update anything on that table then we are getting deadlock issue. So how we can avoid deadlock for inserting while the API also inserting data to that table

I am getting the following exception:
"Transaction (Process ID XXX) was deadlocked on lock | communication buffer resources with another process and has been chosen as the deadlock victim. Rerun the transaction"


Thanks,
Amit
Posted
Comments
DaveAuld 13-Nov-14 5:38am    
If the API is constantly hitting the DB for read ops then you need to introduce caching, the write op should hit the db and the cache updates accordingly.
amit2620 13-Nov-14 9:34am    
API and users are performing write events not read events. so one process is causing deadlock to prevent writing by other process. Can you please let me know any way to insert into table which is already locked by other process.

Thanks
Tomas Takac 13-Nov-14 5:39am    
Can you post the structure of the table?

1 solution

How about following the guidance notes in the Technet document;
Minimizing Deadlocks[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900