Page 1 of 1

Deadlock When Deleting (SQL Server)

PostPosted: Fri May 03, 2019 4:53 pm
by bcusick
Hey Guys,

I have a number of headless clients (10) that work on a batch process to download data and then normalize that data into our schema.

I've recently been getting a bunch of these types of errors when the process deletes all the records in a small foundset (like 3-4 records):

Code: Select all
)com.servoy.j2db.dataprocessing.DataException: Transaction (Process ID 58) was deadlocked on lock | communication buffer resources with another process and has been chosen as the deadlock victim.


I'm not sure how to code around this. Anyone have any suggestions?

MUCH appreciated!

Bob

Re: Deadlock When Deleting (SQL Server)

PostPosted: Sat May 04, 2019 12:00 pm
by ROCLASI
Hi Bob,

What database vendor is this? MSSQL Server?
Also is this table you delete records from used anywhere in your solution(s)? Or other external apps? Just to identity who might hold a lock (and why).

Re: Deadlock When Deleting (SQL Server)

PostPosted: Sat May 04, 2019 5:50 pm
by bcusick
Hey Robert,

The tables are used in different parts of the solution - but there are no users logged in when this batch process runs.

Basically - I spawn about 10 headless instances (one for each tenant) that goes to a government site - logs in as the tenant - and downloads information.

Then, that data is manipulated to fit my own schema. As part of that process - I have to delete some data (small sets - like 4 records) - but I have to delete a LOT of them.

This is SQL Server 2016.

Thanks for any advice!

Bob

Re: Deadlock When Deleting (SQL Server)

PostPosted: Sun May 05, 2019 5:26 pm
by ROCLASI
Hi Bob,

Are you running anything inside database transactions ? If so, how long are they open?

Re: Deadlock When Deleting (SQL Server)

PostPosted: Sun May 05, 2019 6:27 pm
by bcusick
Hey Robert,

I don't use any transactions at all.

Bob