SQL query timing out but previously working fine
Question

I have a simple delete SQL query that has been running fine for months and all of a sudden it is failing to execute with the error:

"Execution Timeout Expired.  The timeout period elapsed prior to completion of the operation or the server is not responding. The statement has been terminated."

There are no protect rules on it (it's just temporary data) and there are only 2 rows in the database, but for some reason it's timing out and failing to execute.

I cut and pasted the code into another module and it worked fine so not sure what is going on?  I have already tried closing and reopening OS to no avail.

mvp_badge
MVP

Hi Sienna,

Could be a race run? Some other thread locking up the records and thus the delete keeps waiting until it finally times out?

Cheers.

It's one of the first things that runs (it's in the preparation).

But weirdly....and thankfully....all of a sudden it has resolved itself without me doing anything at all, I didn't even close the module between it not working and working.  It didn't work for about an hour though, so it's rather disconcerting not to know why in case it happens again.

mvp_badge
MVP

Hi Sienna,

This seems a lot with a network/database server problem.
But if it is working, it's ok.

You can investigate the server logs, including the windows server logs, database logs, etc, to see if you can find a reason to what happened.

But usually is not that easy...

Cheers.

Yes I did check before but no clues as to why.  Oh well, hopefully that'll be the end of it.  Thanks for your time!

Hi, 

I seem to have the same problem. I am trying to delete a row from a table which has dummy data. I am able to delete all the rows except 2 of them. The sql is timing out when it tries to delete these two rows. I can't seem to find the reason. I am using cloud version. Any inputs you can provide would help greatly. Thank you. 



I am facing similar issue. There are around 75 rows in a multi tenant table with some test data. and out of which the first set of rows are getting deleted.(this includes rows with different tenants no issues there) . but as soon as the iterator hits a specific row number eg. with id 47 in the attached screenshot the thread does not respond. The debugger is still attached but with no response and eventually times out. 

I have also tried it by writing advanced sql and played around with different filter criteria's   but when i try to delete a record with some specific  ID  eg. Id > 47  or 48  same issue.   

There is no referential integrity that prevents this delete operation. Attached a screen shot  here to give a better picture. (from bottom up.. the delete operation works but there is no response while deleting for the rows above the line in the screenshot).  

also tried to alter the table by adding a column but facing  the same timeout issue. Any ideas Kindly let me know?

Capture.PNG

mvp_badge
MVP

This problem occurs due to a lock on a specific table record that was not released. I have seen this problem so now and then on Oracle databases. Can you check if you are running an Oracle or Ms SQL database?

When it’s Oracle, the cause could be various. When it’s Ms SQL, you are probably calling a GetTableForUpdate, which locks the record until the next CommitTransaction.

To fix your environment, you can restart the services from LifeTime or when you are OnPremise, you can check the database to find the specific lock issue and solve it directly.

Hope this helps!

Remco Dekkinga

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.