Jump to content


Photo

Database locks when application crashes

database sql server lock firedac

  • Please log in to reply
3 replies to this topic

#1 mika

mika

    Advanced Member

  • uniGUI Subscriber
  • PipPipPipPip
  • 136 posts

Posted 01 September 2017 - 06:47 AM

When user is waiting fairly time consuming SQL query to finish and application crashes (halts without a trace but that's a another problem) for some reason, database connection might leave table(s) locked. This will cause said table to be unreadable (without dirty read) until database server is restarted.

 

I thought that any and all database connections will be disconnected and any possible locks will be released when application crashes but that doesn't seem to be case.

 

Do any of you have any suggestions how to track down and solve this problem?

 

Database backend is Microsoft SQL Server 2014 Express and I use FireDAC access it. uniGUI version is 1.0.0.1406 (Complete).

 

// Mika


  • 0

#2 Farshad Mohajeri

Farshad Mohajeri

    Administrator

  • Administrators
  • 10540 posts

Posted 01 September 2017 - 08:41 AM

This seems to be a weird case. Under no circumstances one should be able to lock a table in such a way that will require a sql server restart


  • 0

#3 mika

mika

    Advanced Member

  • uniGUI Subscriber
  • PipPipPipPip
  • 136 posts

Posted 01 September 2017 - 11:01 AM

Yes. I totally agree. It shouldn't be possible.

 

I'm pretty sure I must be overlooking something. I'll keep investigating.

 

// Mika


  • 0

#4 zilav

zilav

    Advanced Member

  • uniGUI Subscriber
  • PipPipPipPip
  • 451 posts

Posted 04 September 2017 - 05:30 PM

SET XACT_ABORT ON

 

By default lost connection to SQL server does NOT considered an error to rollback open transactions and so affected tables stay locked.


  • 1





Also tagged with one or more of these keywords: database, sql server, lock, firedac

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users