database-deadlocks

Entity Framework deadlock problem

那年仲夏 提交于 2020-01-15 08:43:25
问题 I'm having a strange problem with new Entity Framework for .NET 4 I have a SQL Server 2005 (EXPRESS) database and my service writes data to two tables using entity framework. Let's say tables are TableA and TableB. TableB has foreign key to TableA. In my program there are several threads that writes data in parallel. Each thread has its own ObjectContext. The program creats TableA object and puts it in the object context. Then objects for TableB are created and put to object context. This

MySQL InnoDB deadlock problem with two same queries (different parameters)

元气小坏坏 提交于 2020-01-14 17:51:20
问题 I have the following table CREATE TABLE IF NOT EXISTS `task` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `job_id` int(10) unsigned NOT NULL COMMENT 'The id of the related job', `server_id` tinyint(4) NOT NULL DEFAULT '0' COMMENT 'job/task owner', `jobtype_id` int(10) unsigned NOT NULL DEFAULT '0', `node_id` int(10) unsigned NOT NULL COMMENT 'The id of the user currently executing this task', `status` enum('QUEUED','EXECUTING','COMPLETED','CANCELED','TERMINATED','PAUSED','FAILED') NOT

How to find out the cause of an Oracle deadlock

好久不见. 提交于 2020-01-13 18:42:10
问题 When testing my application with multiple users, I have encountered an ORA-00060 deadlock error. I'm not sure how to determine the cause of this error, so if anyone could help me it would be greatly appreciated. I looked in the trace file generated for this event and it shows me which query caused this: UPDATE TABLE_A SET CK=CK+1 WHERE A_ID=( SELECT A_ID FROM TABLE_B WHERE SOME_COLUMN=:SOMECOLUMN ) It also generated this: [Transaction Deadlock] The following deadlock is not an ORACLE error.

How to find out the cause of an Oracle deadlock

非 Y 不嫁゛ 提交于 2020-01-13 18:42:06
问题 When testing my application with multiple users, I have encountered an ORA-00060 deadlock error. I'm not sure how to determine the cause of this error, so if anyone could help me it would be greatly appreciated. I looked in the trace file generated for this event and it shows me which query caused this: UPDATE TABLE_A SET CK=CK+1 WHERE A_ID=( SELECT A_ID FROM TABLE_B WHERE SOME_COLUMN=:SOMECOLUMN ) It also generated this: [Transaction Deadlock] The following deadlock is not an ORACLE error.

Using foreign key in SQL server and DB locks

大城市里の小女人 提交于 2020-01-03 15:34:12
问题 I have been working with SQL Server for a long time I always use FKs and indexes when a logic connection between tables exist Example: MyTable1 { ID BIGINT IDENTITY (1, 1) NOT NULL, SomeData NVARCHAR(255) NOT NULL, MyFK BIGINT NULL -- this is a FK to MyTable2.ID } MyTable2 { ID BIGINT IDENTITY (1, 1) NOT NULL, SomeData NVARCHAR(255) NOT NULL } Now to the problem, When I execute some bulk update operations on MyTable1 that update MyFK, and in the same time execute an insert statements to

SQL Simultaneous transactions ignore each other's locks??? DEADLOCK [InnoDB, Python]

妖精的绣舞 提交于 2019-12-24 21:23:27
问题 Good day! I've run into a head burner. My client requires me to repurpose a python program to work with MySQL instead of Microsoft's SQL Server. I'm having trouble finding an equivalent solution in SQL. I can't seem to create a proper update lock on a row. When two identical transactions execute simultaneously, they both read the row despite opening a transaction at the serialize isolation level, and with SELECT ... FOR UPDATE. Maybe my code will explain it better: execute("SET TRANSACTION

handle locks in redshift

删除回忆录丶 提交于 2019-12-24 08:46:40
问题 I have a python script that executes multiple sql scripts (one after another) in Redshift. Some of the tables in these sql scripts can be queried multiple times. For ex. Table t1 can be SELECTed in one script and can be dropped/recreated in another script. This whole process is running in one transaction. Now, sometimes, I am getting deadlock detected error and the whole transaction is rolled back. If there is a deadlock on a table, I would like to wait for the table to be released and then

SELECT FOR UPDATE with Subquery results in Deadlock

浪子不回头ぞ 提交于 2019-12-23 03:41:11
问题 I have query when executed from different session is resulting in deadlock. TAB1 (ID, TARGET, STATE, NEXT) AND ID is primary key Column ID is the primary key. SELECT * FROM TAB1 WHERE NEXT = (SELECT MIN(NEXT) FROM TAB1 WHERE TARGET=? AND STATE=?) AND TARGET=? AND STATE=? FOR UPDATE In the Oracle trace file, I see the statement: DEADLOCK DETECTED Current SQL statement for this session: SELECT ID, TARGET, NEXT, STATE FROM TAB1 WHERE NEXT=(SELECT MIN(NEXT) FROM TAB1 WHERE (TARGET='$any') AND (

How do I identify a deadlock in SQL Azure?

淺唱寂寞╮ 提交于 2019-12-22 04:08:18
问题 I have a Windows Azure role that consists of two instances. Once in a while a transaction will fail with an SqlException with the following text Transaction (Process ID N) was deadlocked on lock resources with another process and has been chosen as the deadlock victim. Rerun the transaction. Now I've Googled for a while and read this post about identifying deadlocks using SQL Server logs. The problem is... How do I do it in SQL Azure? What tools do I use to access the internals of SQL Azure

how to avoid deadlocks with neo4j

泄露秘密 提交于 2019-12-21 17:27:33
问题 I just learnt that when I create a relationship between 2 nodes in neo4j, both of them are locked (http://docs.neo4j.org/chunked/stable/transactions-locking.html). However, in our project, we have elements that we can instanciate and we finnaly have two nodes in the graph linked by a "INSTANCE_OF" relationship. For exemple if I instanciate element B, I have a new element B1. They are stored in the graph like B<-INSTANCE_OF-B1. My problem is that many users can instanciate element B on same