May 26, 2017 at 9:56 am
Hi everyone,
in our company we have this issue that is plaguing us from a month.
Looks like that the sp_tables stored_procedures is suddenly called and blocks every other transaction.
We could replicate the issue everytime a particular DELETE fails because of a foreign key constraint.
This provokes an error like this and soon after an sp_tables start:
org.springframework.dao.
at org.springframework.orm.
at org.springframework.orm.
at org.springframework.orm.
at org.springframework.
at org.springframework.
at org.springframework.
at org.springframework.
at org.springframework.
at org.springframework.aop.
at org.springframework.aop.
at it.sabacom.service.
at sun.reflect.
at sun.reflect.
at sun.reflect.
at java.lang.reflect.Method.
at flex.messaging.services.
at flex.messaging.services.
at flex.messaging.MessageBroker.
at flex.messaging.endpoints.
at flex.messaging.endpoints.
at org.springframework.cglib.
at org.springframework.aop.
at org.springframework.aop.
at org.springframework.flex.core.
at org.springframework.aop.
at org.springframework.aop.
at org.springframework.aop.
at org.springframework.aop.
at flex.messaging.endpoints.
at flex.messaging.endpoints.amf.
at flex.messaging.endpoints.amf.
at flex.messaging.endpoints.amf.
at flex.messaging.endpoints.amf.
at flex.messaging.endpoints.amf.
at flex.messaging.endpoints.
at flex.messaging.endpoints.
Caused by: org.hibernate.exception.
at org.hibernate.exception.
at org.hibernate.exception.
at org.hibernate.engine.jdbc.spi.
at org.hibernate.engine.jdbc.spi.
at org.hibernate.engine.jdbc.
at org.hibernate.engine.jdbc.
at org.hibernate.persister.
at org.hibernate.persister.
at org.hibernate.action.internal.
at org.hibernate.engine.spi.
at org.hibernate.engine.spi.
at org.hibernate.event.internal.
at org.hibernate.event.internal.
at org.hibernate.internal.
at org.hibernate.internal.
at org.hibernate.engine.
at org.hibernate.engine.
at org.springframework.orm.
... 88 more
Caused by: com.microsoft.sqlserver.jdbc.
at com.microsoft.sqlserver.jdbc.
at com.microsoft.sqlserver.jdbc.
at com.microsoft.sqlserver.jdbc.
at com.microsoft.sqlserver.jdbc.
at com.microsoft.sqlserver.jdbc.
at com.microsoft.sqlserver.jdbc.
at com.microsoft.sqlserver.jdbc.
at com.microsoft.sqlserver.jdbc.
at com.microsoft.sqlserver.jdbc.
at com.mchange.v2.c3p0.impl.
at org.hibernate.engine.jdbc.
We never ever explicitly call an sp_tables in our code, so we are kinda puzzled by this.
We could better design our code in order to avoid this kind of errors, but it doesn't always happen for every failed delete, I can't understand this.
So, why an sp_tables sould be called after a failed insert? And why should it lock all other transactions focing us to manually issuye a KILL command?
The db is a Sql Server 2012, the transactions are executed through Hibernate.
Thanks
May 26, 2017 at 12:05 pm
francesco.giusto.sb - Friday, May 26, 2017 9:56 AM
We never ever explicitly call an sp_tables in our code, so we are kinda puzzled by this.
We could better design our code in order to avoid this kind of errors, but it doesn't always happen for every failed delete, I can't understand this.So, why an sp_tables sould be called after a failed insert? And why should it lock all other transactions focing us to manually issuye a KILL command?
The db is a Sql Server 2012, the transactions are executed through Hibernate.
Thanks
Hibernate often calls sp_tables have no idea why. Just a simple call to sp_tables is highly unlikely to be the root cause of the issues. You'd see a lot of reports about this if it were to be the issue. So something along the lines of the application, hibernate but something in your environment.
You would need to monitor the blocking/locking to get a better idea of what is going on. There are many resources for doing this. You could download WhoIsActive and find the lead blockers with this.
You can capture the blocking using the blocked process report with extended events. There is a great article by Erin Stellato on sqlskills that will walk you through setting this up:
Capture Blocking Information with Extended Events and the Blocked Process Report
You can also just query some of the DMVs to get the information you need. Here is an example from the sys.dm_trans_lock documentation: SELECT
t1.resource_type,
t1.resource_database_id,
t1.resource_associated_entity_id,
t1.request_mode,
t1.request_session_id,
t2.blocking_session_id
FROM sys.dm_tran_locks as t1
INNER JOIN sys.dm_os_waiting_tasks as t2
ON t1.lock_owner_address = t2.resource_address;
Sue
Viewing 2 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply