Deadlock in a report

Hi all,
my knowledge of obiee is very low...
When I run a report, I get this error:
ORA-00060: deadlock detected while waiting for resource at OCI call OCIStmtExecute. [nQSError: 17010] SQL statement preparation failed. (HY000)
I can't imagine why a report (a select) could get a deadlock!
Thanx

Hi Acidi,
Similar post on this,might help you check out
http://kr.forums.oracle.com/forums/thread.jspa?threadID=1129048&tstart=0
http://rnm1978.wordpress.com/2009/10/22/troubleshooting-obiee-and-ora-12154-tnscould-not-resolve-the-connect-identifier/
Hope helps you.
By,
KK

Similar Messages

  • Finding deadlock Info in Statspack report

    Hi DBA Gurus,
    Is it possible to get some information relevant to deadlocks from statspack report? I have been asked to analyze the report 1 hour before the deadlock occurred and the hour during which the deadlock occurred.
    Thanks
    Saravanan

    Hi Saravanan,
    STATSPACK report generates system wide statistics and i dont think it would be helpful to debug your deadlock , the statspack report generated for the interval when deadlock occured might show you an increase in your enqueue statistics etc. You can enable trace for your application and find out the area of contention. Is the box a Production server ?
    Thanks,
    Khalid

  • ORA-04020 dead lock ?

    I have two procedures need to call each other, like:
    create or replace procedure A
    as
    begin
    B;
    end A;
    create or replace procedure B
    as
    A;
    end B;
    when I compiled them, I got a message saying that deadlock detected.
    If I have the logic like that, and procs A and B are defenitely needed, how can I handle this issue?
    Thanks

    An interesting change in 10G. Instead of the deadlock, it immediately reports the compilation errors and running either of the procedures generates an immediate "Object is invalid" error.
    SQL> CREATE OR REPLACE PROCEDURE a (p_who IN VARCHAR2) AS
      2  BEGIN
      3     IF p_who <> 'B' THEN
      4        DBMS_OUTPUT.Put_Line('Call B');
      5     ELSE
      6        DBMS_OUTPUT.Put_Line('Called by B');
      7     END IF;
      8  END;
      9  /
    Procedure created.
    SQL> SHOW ERRORS
    No errors.
    SQL>
    SQL> CREATE OR REPLACE PROCEDURE b (p_who IN VARCHAR2) AS
      2  BEGIN
      3     IF p_who <> 'A' THEN
      4        a('B');
      5     ELSE
      6        DBMS_OUTPUT.Put_Line('Called by A');
      7     END IF;
      8  END;
      9  /
    Procedure created.
    SQL> SHOW ERRORS
    No errors.
    SQL>
    SQL> CREATE OR REPLACE PROCEDURE a (p_who IN VARCHAR2) AS
      2  BEGIN
      3     IF p_who <> 'B' THEN
      4        b('A');
      5     ELSE
      6        DBMS_OUTPUT.Put_Line('Called by B');
      7     END IF;
      8  END;
      9  /
    Procedure created.
    SQL> SHOW ERRORS
    No errors.
    SQL>
    SQL> select object_name, object_type from user_objects where status <> 'VALID' ;
    OBJECT_NAME                     OBJECT_TYPE
    A                               PROCEDURE
    B                               PROCEDURE
    2 rows selected.
    SQL> alter procedure a compile ;
    Warning: Procedure altered with compilation errors.
    SQL> show errors
    Errors for PROCEDURE A:
    LINE/COL ERROR
    4/7      PL/SQL: Statement ignored
    4/7      PLS-00905: object XXXXXXXX.B is invalid
    SQL> alter procedure b compile ;
    Warning: Procedure altered with compilation errors.
    SQL> show errors
    Errors for PROCEDURE B:
    LINE/COL ERROR
    4/7      PL/SQL: Statement ignored
    4/7      PLS-00905: object XXXXXXXX.A is invalid
    SQL> exec a ;
    BEGIN a ; END;
    ERROR at line 1:
    ORA-06550: line 1, column 7:
    PLS-00905: object XXXXXXXX.A is invalid
    ORA-06550: line 1, column 7:
    PL/SQL: Statement ignored
    SQL> exec b ;
    BEGIN b ; END;
    ERROR at line 1:
    ORA-06550: line 1, column 7:
    PLS-00905: object XXXXXXXX.B is invalid
    ORA-06550: line 1, column 7:
    PL/SQL: Statement ignored
    SQL> disconnect
    Disconnected from Oracle Database 10g Enterprise Edition Release 10.1.0.2.0 - Production
    With the Partitioning, OLAP and Data Mining options
    SQL>

  • Deadlocked error message when running crystal report

    Hi All,
    I need a bit of guidance as to the following problem.
    Seems there is a lock being created in SQL when running some crystal reports.
    When trying to run a report the following message is displayed:
    Database connection Error L 'ADO Error Code: 0x
    Source: Microsoft SQL Native Client
    Description: Transaction (Process ID 302) was deadlocked on lock resources with another process and has been chosen as the deadlock victim. Rerun the transaction.
    SQL State: 40001
    Native Error: [Database Vendor Code: 1205 ]'
    The error is happening intermittently when refreshing the report. It does not seem to happen when no users are using the system.
    Is there any way to stop this from happening? Or is this some kind of limitation with crystal and how it accesses the database?
    Many Thanks,
    Matt

    Hi Matt
    I have had this problem with long running queries as well.  I ended up doing the main part of the query in a view using WITH (NOLOCK) for each table and then reporting on the view.
    This had extra benefits of making the report much simpler and often making the query more efficient and easier to test as well.
    Rob

  • Deadlock with thread issues while generating reports with Crystal Report XI

    We are facing deadlock with thread issues while generating report with Crystal Report XI
    Version Number is 11.0 and the database used is Oracle
    In the log file on line number 74350  by 2008/12/16 13:35:54 there is a dead lock with Thread: u20184u2019 is waiting to acquire lock for 'com.crystaldecisions.reports.queryengine.av@15214b9' which is held by the Thread: '0'.
    And  a dead lock with Thread: u20180u2019 is waiting to acquire lock for 'com.crystaldecisions.reports.queryengine.av@15214b9' which is held by the Thread: '4'.
    Exactly after 10 minutes we can see the thread 4 and 0 are declared as STUCK by 2008/12/16  13:45:54 .
    Is this an existing issue with Crystal Report?
    Is there some solution for this problem?
    THE LOG FILE INFORMATION IS GIVEN BELOW
    [deadlocked thread] [ACTIVE] ExecuteThread: '4' for queue: 'weblogic.kernel.Default (self-tuning)':
    Thread '[ACTIVE] ExecuteThread: '4' for queue: 'weblogic.kernel.Default (self-tuning)'' is waiting to acquire lock 'com.crystaldecisions.reports.queryengine.av@15214b9' that is held by thread '[ACTIVE] ExecuteThread: '0' for queue: 'weblogic.kernel.Default (self-tuning)''
    Stack trace:
         com.crystaldecisions.reports.queryengine.av.V(Unknown Source)
         com.crystaldecisions.reports.queryengine.av.do(Unknown Source)
         com.crystaldecisions.reports.queryengine.as.if(Unknown Source)
         com.crystaldecisions.reports.reportdefinition.datainterface.j.c(Unknown Source)
         com.crystaldecisions.reports.reportdefinition.datainterface.j.a(Unknown Source)
         com.crystaldecisions.reports.reportdefinition.datainterface.j.a(Unknown Source)
         com.crystaldecisions.reports.reportdefinition.cy.b(Unknown Source)
         com.crystaldecisions.reports.reportdefinition.cy.long(Unknown Source)
         com.crystaldecisions.reports.reportdefinition.a1.o(Unknown Source)
         com.crystaldecisions.reports.reportdefinition.a1.a(Unknown Source)
         com.crystaldecisions.reports.common.ab.a(Unknown Source)
         com.crystaldecisions.reports.common.ab.if(Unknown Source)
         com.crystaldecisions.reports.reportdefinition.a1.if(Unknown Source)
         com.crystaldecisions.reports.reportdefinition.a1.o(Unknown Source)
         com.crystaldecisions.reports.reportengineinterface.a.a(Unknown Source)
         com.crystaldecisions.reports.reportengineinterface.a.a.b.a(Unknown Source)
         com.crystaldecisions.reports.sdk.ReportClientDocument.open(Unknown Source)
         com.sysarris.aris.crystalreports.RepServlet.generateReport(RepServlet.java:65)
         com.sysarris.aris.crystalreports.RepServlet.doPost(RepServlet.java:40)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:763)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
         weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:225)
         weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:127)
         weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:272)
         weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:165)
         weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3153)
         weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
         weblogic.security.service.SecurityManager.runAs(SecurityManager.java:121)
         weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:1973)
         weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:1880)
         weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1310)
         weblogic.work.ExecuteThread.execute(ExecuteThread.java:207)
         weblogic.work.ExecuteThread.run(ExecuteThread.java:179)
    [deadlocked thread] [ACTIVE] ExecuteThread: '0' for queue: 'weblogic.kernel.Default (self-tuning)':
    Thread '[ACTIVE] ExecuteThread: '0' for queue: 'weblogic.kernel.Default (self-tuning)'' is waiting to acquire lock 'com.crystaldecisions.reports.queryengine.av@12e0415' that is held by thread '[ACTIVE] ExecuteThread: '4' for queue: 'weblogic.kernel.Default (self-tuning)''
    Stack trace:
         com.crystaldecisions.reports.queryengine.av.V(Unknown Source)
         com.crystaldecisions.reports.queryengine.av.do(Unknown Source)
         com.crystaldecisions.reports.queryengine.as.if(Unknown Source)
         com.crystaldecisions.reports.reportdefinition.datainterface.j.c(Unknown Source)
         com.crystaldecisions.reports.reportdefinition.datainterface.j.a(Unknown Source)
         com.crystaldecisions.reports.reportdefinition.datainterface.j.a(Unknown Source)
         com.crystaldecisions.reports.reportdefinition.cy.b(Unknown Source)
         com.crystaldecisions.reports.reportdefinition.cy.long(Unknown Source)
         com.crystaldecisions.reports.reportdefinition.a1.o(Unknown Source)
         com.crystaldecisions.reports.reportdefinition.a1.a(Unknown Source)
         com.crystaldecisions.reports.common.ab.a(Unknown Source)
         com.crystaldecisions.reports.common.ab.if(Unknown Source)
         com.crystaldecisions.reports.reportdefinition.a1.if(Unknown Source)
         com.crystaldecisions.reports.reportdefinition.a1.o(Unknown Source)
         com.crystaldecisions.reports.reportengineinterface.a.a(Unknown Source)
         com.crystaldecisions.reports.reportengineinterface.a.a.b.a(Unknown Source)
         com.crystaldecisions.reports.sdk.ReportClientDocument.open(Unknown Source)
         com.sysarris.aris.crystalreports.RepServlet.generateReport(RepServlet.java:65)
         com.sysarris.aris.crystalreports.RepServlet.doPost(RepServlet.java:40)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:763)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
         weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:225)
         weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:127)
         weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:272)
         weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:165)
         weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3153)
         weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
         weblogic.security.service.SecurityManager.runAs(SecurityManager.java:121)
         weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:1973)
         weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:1880)
         weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1310)
         weblogic.work.ExecuteThread.execute(ExecuteThread.java:207)
         weblogic.work.ExecuteThread.run(ExecuteThread.java:179)
    Can you please suggest any work around for this?

    I'm not referring to Servlet threading issues.
    I'll clarify.
    You have two threads, both entering ReportClientDocument.open(...) method.
    Thread 4 is waiting to acquire 'com.crystaldecisions.reports.queryengine.av@15214b9'
    Thread 0 is waiting to acquire ''com.crystaldecisions.reports.queryengine.av@12e0415'
    So I'm thinking ??? are they the same objects?
    My specific question concerning the ReportClientDocument is that both are calling open - i.e., trying to open a new report.  You wouldn't be trying to open different reports using the same ReportClientDocument - so was wondering if you've cached the RCD and trying to open two different reports at the same time on the same instance via different threads.
    You'd normally tie a ReportClientDocument instance to a HTTP Session, to ensure each user gets their own copy.
    Sincerely,
    Ted Ueda

  • If Two Users try to schedule a report at the same time does that lead to a Deadlock?

    When Two users trying to access the same server and need to access the report for scheduling at the same time, does that lead to Deadlock Situation?
    What are the Odd's in such scenarios?
    Please help me understanding.
    Regards,
    Shiva

    When two users are say trying to schedule the same report at the same time - the relevant Job server has default capacity of running 5 concurrent jobs at a time (this value can be increased) - that means, it can run 5 schedules at the same time.
    Let's say now two users have scheduled 6 reports - now the 5 reports that were scheduled will be in the "running" state but the server has only 5 concurrent job capacity so the 6th report schedule will stay "pending" until any one of the existing jobs are completed, and then the 6th report will start "running".
    There is nothing called deadlock while scheduling. While viewing the reports, there are enough resources available in the BO system to make the report available for various users at the same time.
    Thank you,  Rahul

  • ORA-00060: Deadlock detected

    I getting error as "ORA-00060: Deadlock detected. More info in file /d01/oracle/VIS/db/tech_st/10.2.0/.................". Following are my observations on the occurence of this error.
    The deadlock is encountered first time when trying to login to applications. I have R12 vision instance on linux.
    Following the content of the alert_VIS.log file
    Mon Jun 15 04:41:41 2009
    Starting ORACLE instance (normal)
    LICENSE_MAX_SESSION = 0
    LICENSE_SESSIONS_WARNING = 0
    Picked latch-free SCN scheme 3
    Using LOG_ARCHIVE_DEST_1 parameter default value as /d01/oracle/VIS/db/tech_st/10.2.0/dbs/arch
    Autotune of undo retention is turned on.
    IMODE=BR
    ILAT =44
    LICENSE_MAX_USERS = 0
    SYS auditing is disabled
    ksdpec: called for event 13740 prior to event group initialization
    Starting up ORACLE RDBMS Version: 10.2.0.3.0.
    System parameters with non-default values:
    tracefiles_public = TRUE
    processes = 200
    sessions = 400
    timed_statistics = TRUE
    shared_pool_size = 419430400
    shared_pool_reserved_size= 41943040
    nls_language = american
    nls_territory = america
    nls_sort = binary
    nls_date_format = DD-MON-RR
    nls_numeric_characters = .,
    nls_comp = binary
    nls_length_semantics = BYTE
    sga_target = 1073741824
    control_files = /d01/oracle/VIS/db/apps_st/data/cntrl01.dbf, /d01/oracle/VIS/db/apps_st/data/cntrl02.dbf, /d01/oracle/VIS/db/apps_st/data/cntrl03.dbf
    db_block_checksum = TRUE
    db_block_size = 8192
    compatible = 10.2.0
    log_buffer = 14251008
    log_checkpoint_interval = 100000
    log_checkpoint_timeout = 1200
    db_files = 512
    log_checkpoints_to_alert = TRUE
    dml_locks = 10000
    undo_management = AUTO
    undo_tablespace = APPS_UNDOTS1
    db_block_checking = FALSE
    O7_DICTIONARY_ACCESSIBILITY= FALSE
    session_cached_cursors = 500
    utl_file_dir = /usr/tmp, /usr/tmp, /d01/oracle/VIS/db/tech_st/10.2.0/appsutil/outbound/VIS_oracleebsr12, /usr/tmp
    plsql_native_library_dir = /d01/oracle/VIS/db/tech_st/10.2.0/plsql/nativelib
    plsql_native_library_subdir_count= 149
    plsql_code_type = native
    plsql_optimize_level = 2
    job_queue_processes = 2
    systemtrig_enabled = TRUE
    cursor_sharing = EXACT
    parallel_min_servers = 0
    parallel_max_servers = 8
    background_dump_dest = /d01/oracle/VIS/db/tech_st/10.2.0/admin/VIS_oracleebsr12/bdump
    user_dump_dest = /d01/oracle/VIS/db/tech_st/10.2.0/admin/VIS_oracleebsr12/udump
    max_dump_file_size = 20480
    core_dump_dest = /d01/oracle/VIS/db/tech_st/10.2.0/admin/VIS_oracleebsr12/cdump
    db_name = VIS
    open_cursors = 600
    ifile = /d01/oracle/VIS/db/tech_st/10.2.0/dbs/VIS_oracleebsr12_ifile.ora
    sortelimination_cost_ratio= 5
    btree_bitmap_plans = FALSE
    fastfull_scan_enabled = FALSE
    sqlexecprogression_cost= 2147483647
    likewith_bind_as_equality= TRUE
    pga_aggregate_target = 1073741824
    workarea_size_policy = AUTO
    optimizer_secure_view_merging= FALSE
    aq_tm_processes = 1
    olap_page_pool_size = 4194304
    Mon Jun 15 04:42:05 2009
    WARNING:Oracle instance running on a system with low open file descriptor
    limit. Tune your system to increase this limit to avoid
    severe performance degradation.
    PSP0 started with pid=3, OS id=6824
    PMON started with pid=2, OS id=6822
    MMAN started with pid=4, OS id=6826
    DBW0 started with pid=5, OS id=6828
    CKPT started with pid=7, OS id=6832
    SMON started with pid=8, OS id=6834
    RECO started with pid=9, OS id=6836
    CJQ0 started with pid=10, OS id=6838
    LGWR started with pid=6, OS id=6830
    MMON started with pid=11, OS id=6840
    MMNL started with pid=12, OS id=6842
    Mon Jun 15 04:42:19 2009
    ALTER DATABASE MOUNT
    Mon Jun 15 04:42:25 2009
    Setting recovery target incarnation to 2
    Mon Jun 15 04:42:27 2009
    Successful mount of redo thread 1, with mount id 243370348
    Mon Jun 15 04:42:27 2009
    Database mounted in Exclusive Mode
    Completed: ALTER DATABASE MOUNT
    Mon Jun 15 04:42:28 2009
    ALTER DATABASE OPEN
    Mon Jun 15 04:42:48 2009
    Thread 1 opened at log sequence 16
    Current log# 3 seq# 16 mem# 0: /d01/oracle/VIS/db/apps_st/data/log3.dbf
    Successful open of redo thread 1
    Mon Jun 15 04:42:48 2009
    MTTR advisory is disabled because FAST_START_MTTR_TARGET is not set
    Mon Jun 15 04:42:48 2009
    SMON: enabling cache recovery
    Mon Jun 15 04:42:48 2009
    Incremental checkpoint up to RBA [0x10.a779.0], current log tail at RBA [0x10.a779.0]
    Mon Jun 15 04:43:01 2009
    Successfully onlined Undo Tablespace 18.
    Mon Jun 15 04:43:01 2009
    SMON: enabling tx recovery
    Mon Jun 15 04:43:04 2009
    Database Characterset is UTF8
    Mon Jun 15 04:43:18 2009
    replication_dependency_tracking turned off (no async multimaster replication found)
    Mon Jun 15 04:43:44 2009
    Starting background process QMNC
    QMNC started with pid=14, OS id=6884
    Mon Jun 15 04:46:48 2009
    Completed: ALTER DATABASE OPEN
    Mon Jun 15 05:03:23 2009
    Incremental checkpoint up to RBA [0x10.b1bd.0], current log tail at RBA [0x10.b1f3.0]
    Mon Jun 15 05:23:33 2009
    Incremental checkpoint up to RBA [0x10.b5b3.0], current log tail at RBA [0x10.b5c2.0]
    Mon Jun 15 05:45:12 2009
    Incremental checkpoint up to RBA [0x10.b7b0.0], current log tail at RBA [0x10.fbce.0]
    This is upto the point where all DB and application services has been started.
    Once trying to login to applications following content got appended to the log file
    Mon Jun 15 05:53:39 2009
    ORA-00060: Deadlock detected. More info in file /d01/oracle/VIS/db/tech_st/10.2.0/admin/VIS_oracleebsr12/udump/vis_ora_8149.trc.
    Mon Jun 15 05:53:51 2009
    ORA-00060: Deadlock detected. More info in file /d01/oracle/VIS/db/tech_st/10.2.0/admin/VIS_oracleebsr12/udump/vis_ora_8149.trc.
    Mon Jun 15 05:54:02 2009
    ORA-00060: Deadlock detected. More info in file /d01/oracle/VIS/db/tech_st/10.2.0/admin/VIS_oracleebsr12/udump/vis_ora_8149.trc.
    Mon Jun 15 05:54:12 2009
    ORA-00060: Deadlock detected. More info in file /d01/oracle/VIS/db/tech_st/10.2.0/admin/VIS_oracleebsr12/udump/vis_ora_8149.trc.
    Mon Jun 15 05:54:22 2009
    ORA-00060: Deadlock detected. More info in file /d01/oracle/VIS/db/tech_st/10.2.0/admin/VIS_oracleebsr12/udump/vis_ora_8149.trc.
    Mon Jun 15 05:54:28 2009
    ORA-00060: Deadlock detected. More info in file /d01/oracle/VIS/db/tech_st/10.2.0/admin/VIS_oracleebsr12/udump/vis_ora_8149.trc.
    Mon Jun 15 05:54:35 2009
    ORA-00060: Deadlock detected. More info in file /d01/oracle/VIS/db/tech_st/10.2.0/admin/VIS_oracleebsr12/udump/vis_ora_8149.trc.
    Mon Jun 15 05:54:42 2009
    ORA-00060: Deadlock detected. More info in file /d01/oracle/VIS/db/tech_st/10.2.0/admin/VIS_oracleebsr12/udump/vis_ora_8149.trc.
    Mon Jun 15 05:59:06 2009
    Process J000 died, see its trace file
    Mon Jun 15 05:59:11 2009
    kkjcre1p: unable to spawn jobq slave process
    Mon Jun 15 05:59:11 2009
    Errors in file /d01/oracle/VIS/db/tech_st/10.2.0/admin/VIS_oracleebsr12/bdump/vis_cjq0_6838.trc:
    Mon Jun 15 05:59:23 2009
    Process J000 died, see its trace file
    Mon Jun 15 05:59:24 2009
    kkjcre1p: unable to spawn jobq slave process
    Mon Jun 15 05:59:24 2009
    Errors in file /d01/oracle/VIS/db/tech_st/10.2.0/admin/VIS_oracleebsr12/bdump/vis_cjq0_6838.trc:
    Mon Jun 15 05:59:50 2009
    Process J000 died, see its trace file
    Mon Jun 15 05:59:50 2009
    kkjcre1p: unable to spawn jobq slave process
    Mon Jun 15 05:59:50 2009
    Errors in file /d01/oracle/VIS/db/tech_st/10.2.0/admin/VIS_oracleebsr12/bdump/vis_cjq0_6838.trc:
    I did the TKPROF on .trc files but the tkprof file does not show any details as such except similar to :- (don't know if I am missing anything while issuing TKPROF as $ tkprof filename.trc
    filename.txt explain=apps/apps)
    TKPROF: Release 10.2.0.3.0 - Production on Mon Jun 15 06:07:14 2009
    Copyright (c) 1982, 2005, Oracle. All rights reserved.
    Trace file: /d01/oracle/VIS/db/tech_st/10.2.0/admin/VIS_oracleebsr12/bdump/vis_cjq0_6838.trc
    Sort options: default
    count = number of times OCI procedure was executed
    cpu = cpu time in seconds executing
    elapsed = elapsed time in seconds executing
    disk = number of physical reads of buffers from disk
    query = number of buffers gotten for consistent read
    current = number of buffers gotten in current mode (usually for update)
    rows = number of rows processed by the fetch or execute call
    0 statements EXPLAINed in this session.
    Trace file: /d01/oracle/VIS/db/tech_st/10.2.0/admin/VIS_oracleebsr12/bdump/vis_cjq0_6838.trc
    Trace file compatibility: 10.01.00
    Sort options: default
    1 session in tracefile.
    0 user SQL statements in trace file.
    0 internal SQL statements in trace file.
    0 SQL statements in trace file.
    0 unique SQL statements in trace file.
    22 lines in trace file.
    0 elapsed seconds in trace file.
    Yesterday, I did login to applications after multiple attempts and tried submitting a concurrent request of a standard report (after resolving the data block corrupt issue) and got the same ORA-00060 Error.
    I have a fresh VISION R12 (12.0.4) installed without any customizations. My installation looks to be quite unstable, takes 2-3 attempts for successful login to apps.
    Can you please give any clues on this and how to overcome the problem?
    Thanks,
    Amit

    I have run cmclean.sql as per :- Re: R12 Vision install - Unable to submit concurrent request
    This is the only change made. No new patches etc. Before running cmclean.sql I believe the instance was working fine.
    Now everytime I start the application services, its causing ORA=00060: Deadlock error. There are no issues with just DB services up and running.
    And after apps services up, when trying to Login to apps it just hangs, get error as follows:
    Tue Jun 23 02:04:55 2009
    Process J001 died, see its trace file
    Tue Jun 23 02:04:55 2009
    kkjcre1p: unable to spawn jobq slave process
    Tue Jun 23 02:04:55 2009
    Errors in file /d01/oracle/VIS/db/tech_st/10.2.0/admin/VIS_oracleebsr12/bdump/vis_cjq0_6747.trc:
    Tue Jun 23 02:05:04 2009
    Process q002 died, see its trace file
    Tue Jun 23 02:05:04 2009
    ksvcreate: Process(q002) creation failed
    Tue Jun 23 02:05:55 2009
    Process J000 died, see its trace file
    Tue Jun 23 02:05:55 2009
    kkjcre1p: unable to spawn jobq slave process
    Tue Jun 23 02:05:55 2009
    Errors in file /d01/oracle/VIS/db/tech_st/10.2.0/admin/VIS_oracleebsr12/bdump/vis_cjq0_6747.trc:
    Tue Jun 23 02:06:11 2009
    Process J000 died, see its trace file
    Tue Jun 23 02:06:11 2009
    kkjcre1p: unable to spawn jobq slave process
    Tue Jun 23 02:06:11 2009
    Errors in file /d01/oracle/VIS/db/tech_st/10.2.0/admin/VIS_oracleebsr12/bdump/vis_cjq0_6747.trc:
    Tue Jun 23 02:08:51 2009
    Process J000 died, see its trace file
    Tue Jun 23 02:08:52 2009
    kkjcre1p: unable to spawn jobq slave process
    Tue Jun 23 02:08:52 2009
    Errors in file /d01/oracle/VIS/db/tech_st/10.2.0/admin/VIS_oracleebsr12/bdump/vis_cjq0_6747.trc:
    The OS also hangs (Linux) and I have to exit abnormally everytime which is frustrating.
    I am not sure the reason for the same. I have gone through the metalink notes pointed which says to install the health check engine.
    Do you have any clues based on above information as to what might be causing this problem.
    I have 4 GB RAM installed on my Windows and 2 GB has been allocated to Linux on VMware.
    Please let me know if I need to upgrade the memory.
    Any pointers would be really helpful.
    Thanks,
    Amit

  • Report template enhancement? no data found message

    I have a layout in which I want to show the excel export link in the same html table as a logo, so that code needs to be placed in the report template, but when no data is found I still want to show the logo and so all my reports have the same html code in the "no data found" field. Whenever I want to change this I have to change my template as well as all of my reports.
    Wouldn't it be a nice idea to provide for a "no data found" message in the report template instead of the report itself? I can imagine you would want to show the same "no data found" message anyway for all reports so the template would be a logical place to put this.

    There are known issues with Interactive Reports referencing :REQUEST value, probably due to some inner logic that also handles it simultaneously - potentially causing malfunction or deadlocks.
    One workaround I've learned is to create a computation to assign :REQUEST to a temporary item (a PXX_REQUEST, for instance) and reference it in the query, instead of :REQUEST. This has worked fine for me in my experience.
    Let me know if that helps - pls sign the thread as 'Useful' or 'Correct' if so, hence more people can benefit.
    tks,
    Kleber

  • How to deal with deadlock on wwv_flow_data table when http server times out

    There are some threads about a deadlock on the wwv_flow_data table. None of them contain a real explanation for this behaviour. In my case I will try to explain what I think is happening. Maybe it helps somebody who is hitting the same matter.
    In my case with APEX 3.2.1 I am navigating from one page to another. Doing this APEX will lock the table wwv_flow_data. As soon as the other page is shown the lock will be released. But now this other page contains a bad performing query (standaard report region). After 5 minutes the http server (modplsql) will time out and present the message "No response from the application server" on the screen. In the meanwhile the query is still running on the database server and the lock stays on the wwv_flow_data table.
    Normal user behaviour will be that the user will use the back button to return to the previous page and tries it again to navigate to the other page or
    the user will try to refresh the page with the bad performing query.
    And voila now you will have a deadlock on the wwv_flow_data table since a second session is trying to do the same thing while the first hasn't finished yet.
    How to deal with it?
    First of all. Have a good look at the bad performing query. Maybe you can improve it that it will succeed before the http server will timeout.
    In my case the 11gr1 optimizer couldn't handle a subquery factoring clause in the best way. After changing it back to a classical inline query the problem was solved.
    Secondly you could increase the timeout parameter of the http server. Although this not the best way.
    Maybe it would better if APEX in a next version would release the lock on the table wwv_flow_date earlier or do a rollback just before the moment that the http server is timing out.
    regards,
    Mathieu Meeuwissen

    Hello Shmoove,
    I saw your reply here and you probably understand the problems the HTTP 100 response may cause.
    I am trying to send image that was taken by getSnapshot. The problem is that the server respond with this HTTP 100 message.
    I suspect that the reason that my server doesn't recognize the file that I'm sending from J2me is that the "server to client" response to the 100 message comes after the second message of (see what the TCPIP viewer shows down here):
    POST /up01/up02.aspx HTTP/1.1
    Content-Type: multipart/form-data; boundary=xxxxyyyyzzz
    Connection: Keep-Alive
    Content-length: 6294
    User-Agent: UNTRUSTED/1.0
    Host: szekely.dnsalias.com:80
    Transfer-Encoding: chunked
    400: Client to Server (126 bytes)
    78
    --xxxxyyyyzzz
    Content-Disposition: form-data; name="pic"; filename="david.jpg"
    Content-Type: application/octet-stream
    400: Connected to Server
    400: Server to Client (112 bytes)
    HTTP/1.1 100 Continue
    Server: Microsoft-IIS/5.1
    Date: Wed, 23 Mar 2005 00:47:02 GMT
    X-Powered-By: ASP.NET
    Any help will be appreciated,
    David

  • Deadlocks with ALTER TABLE DISABLE CONSTRAINT

    Hello,
    We're deleting millions of redundant rows from a particular table in our live 10g database. This is being done online because the downtime would be unacceptable. The table in question has 30 child tables, so for speed I am disabling the foreign keys using ALTER TABLE DISABLE CONSTRAINT before the deletion (we haven't had any constraint violations for ages). Without this, deletion takes about 1 second per row i.e. a very long time.
    However, we're finding that ALTER TABLE DISABLE CONSTRAINT often reports ORA-00060: deadlock detected. This is causing problems with the live system. Can anyone think of the reason why a deadlock might occur in this situation and what we could do to prevent it happening? Note that any solution has to be doable without downtime unless it takes less than 30 minutes.
    Thanks a lot
    Ed
    Edited by: edwiles on Feb 4, 2009 6:02 AM

    look suggestions in the similar thread:
    Re: Deadlock when deleting a not linked data record in a parent table

  • JDAPI Error: ORA-04020: deadlock detected while trying to lock object

    I have written a JDAPI program to perform read-only impact analysis and report any problems.
    The following error is occurring:
    "A deadlock among DDL and parse locks is detected.
    This deadlock is usually due to user errors in the design of an application or from issuing a set of concurrent statements which can cause a deadlock.
    ORA-04020: deadlock detected while trying to lock object /NSPC6/CHECK_FOR_FORM_CHANGE"
    The error refers to a procedure in a PL/SQL library.
    In one case the error occurred after my final "end of processing" message, which is followed only by a call to "Jdapi.shutdown()".
    Any ideas?
    Thanks,
    Neville Sweet.

    I have written a JDAPI program to perform read-only impact analysis and report any problems.
    The following error is occurring:
    "A deadlock among DDL and parse locks is detected.
    This deadlock is usually due to user errors in the design of an application or from issuing a set of concurrent statements which can cause a deadlock.
    ORA-04020: deadlock detected while trying to lock object /NSPC6/CHECK_FOR_FORM_CHANGE"
    The error refers to a procedure in a PL/SQL library.
    In one case the error occurred after my final "end of processing" message, which is followed only by a call to "Jdapi.shutdown()".
    Any ideas?
    Thanks,
    Neville Sweet.

  • ORA-00060: deadlock detected while waiting for resource ON INSERT

    I am running into a deadlock while INSERTING records into a table. This seems strange to me. I've tracked it down to the following, and it feels like an Oracle bug to me, so I wanted to get another opinion:
    I have a procedure that inserts records into a table.
    That table has a Before INSERT OR UPDATE OR DELETE FOR EACH ROW trigger on it.
    The trigger has an IF UPDATING section in it; this section updates records in other tables related to this table.
    I have confirmed that the IF UPDATING section is not firing (which makes sense because I am inserting, but since I was getting a deadlock, it seemed to make sense that somehow the updating section was firing).
    Here's the part that makes this feel buggy:
    I have been able to reproduce the deadlock pretty much on command.
    I commented out the IF UPDATING section of the trigger, compiled the trigger, and then put the IF UPDATING section of the trigger back in, and compiled it. Note there was no net code change.
    I ran my procedure that inserts records and experienced NO DEADLOCK.
    However, if I compile the original version of the trigger (before I commented code out and put it back in), the deadlock reappears. To make the deadlock go away, I have to re-comment out the code, compile, put the code back, and compile again.
    I know this sounds crazy. I'm running Oracle Database 11g Release 11.2.0.2.0.
    Has anyone ever seen something like this before?

    MPL wrote:
    Thanks - there are no autonomous transactions being run. Here's the deadlock graph:
    ---------Blocker(s)--------  ---------Waiter(s)---------
    Resource Name          process session holds waits  process session holds waits
    TX-00220006-0000a762        71     207     X             70      46           S
    TX-00200020-000072ee        70      46     X             71     207           S
    session 207: DID 0001-0047-00000016     session 46: DID 0001-0046-00000021
    session 46: DID 0001-0046-00000021      session 207: DID 0001-0047-00000016
    Rows waited on:
    Session 207: obj - rowid = 00000000 - D/////AACAAAMS9AAA
    (dictionary objn - 0, file - 2, block - 50365, slot - 0)
    Session 46: obj - rowid = 0000ADF7 - AAAsJmAASAAAXYGAAA
    (dictionary objn - 44535, file - 18, block - 95750, slot - 0)
    There are various anomalies that can cause the TX locks waiting in S mode - many of them to do with indexes or unique constraints. Your rowid information may be misleading - but it's worth checking which object has object_id 44535. (I'm always inclined to assume that any reference to slot 0 is suspect, and objn 0 is clearly not a real object.)
    The trace file should be reporting the SQL that the two sessions are waiting on - does that give you any clues.
    Regards
    Jonathan Lewis

  • ORA-00060: deadlock detected while waiting for resource CLOSE cursor

    Hi,
    I am a new member of this forum. I am working with a problem we got a few weeks ago. It is from a Pro C batch executable running on 10 threads dealing with >800 data accessed from multiple tables. The error as reported came from a package.function call.
    This is the error I encountered:
    process_item~G****, D***~-60~ORA-00060: deadlock detected while waiting for resource~PACKAGE ERROR = CLOSE cursor C_***** in package R***.I*** 7641
    The cursor is a simple SELECT cursor without Table or Record locking.
    My questions are:
    *Upon the occurrence of this error, is the execution already at the CLOSE cursor line or did the error occurred between the OPEN cursor and the CLOSE cursor? There are several lines of code in between OPEN and CLOSE:
    - one that calls for a package.function that simply stores parameter values to a variable
    - another one which fetches the cursor. The group that holds the cursor values is only used by a single function in the package
    *Is it possible for this CLOSE cursor to cause a deadlock? What could have caused this?
    *From what I know, Oracle deals with deadlocks by aborting the deadlocking process while others continue, but this deadlock caused our program to hang. How is this possible? Could the root cause of the deadlock be from our threading program? This is a rare occurrence and happened only twice this year.
    Thanks,
    Raf

    Raf Serrano wrote:
    Hi,
    I am a new member of this forum. I am working with a problem we got a few weeks ago. It is from a Pro C batch executable running on 10 threads dealing with >800 data accessed from multiple tables. The error as reported came from a package.function call.
    This is the error I encountered:
    process_item~G****, D***~-60~ORA-00060: deadlock detected while waiting for resource~PACKAGE ERROR = CLOSE cursor C_***** in package R***.I*** 7641
    The cursor is a simple SELECT cursor without Table or Record locking.
    My questions are:
    *Upon the occurrence of this error, is the execution already at the CLOSE cursor line or did the error occurred between the OPEN cursor and the CLOSE cursor? There are several lines of code in between OPEN and CLOSE:
    - one that calls for a package.function that simply stores parameter values to a variable
    - another one which fetches the cursor. The group that holds the cursor values is only used by a single function in the package
    *Is it possible for this CLOSE cursor to cause a deadlock? What could have caused this?
    *From what I know, Oracle deals with deadlocks by aborting the deadlocking process while others continue, but this deadlock caused our program to hang. How is this possible? Could the root cause of the deadlock be from our threading program? This is a rare occurrence and happened only twice this year.
    Thanks,
    RafSELECT (without FOR UPDATE) statements are never involved in ORA-00060.
    only DML statements throw ORA-00060 error

  • ORA-00060: deadlock detected while adding a datafile

    Hello all,
    I found a strange error today.
    We were trying add datafile to our existing tablespace as usually but suddenly caught in a problem.
    SQL> alter tablespace erp_dat2 add datafile '/hotdata2/irsdata/erp_dat2irs_145.dbf' size 2000M;
    alter tablespace erp_dat2 add datafile '/hotdata2/irsdata/erp_dat2irs_145.dbf' size 2000M
    ERROR at line 1:
    ORA-00060: deadlock detected while waiting for resourcelooks very strange.Searched on google but not found something useful.Still searching.No trace file is generated as such.
    Any ideas will be appreciated. Is it related to any batch job running?
    OS : SunOS 5.10 Generic_142900-13 sun4u sparc SUNW,Sun-Fire (64-bit)
    RDBMS : 11.1.0.7
    Regards!
    Edited by: Nitin Joshi on Sep 30, 2010 3:41 PM
    Changed subject line

    seems like you're hitting a bug in 11.1.0.7
    Bug 8332021 - Cannot add a datafiles when sessions reporting ORA-1653 [ID 8332021.8]
    ORA-60 can occur during datafile addition when concurrent sessions
    are reporting ORA-1653 .>>Workaround:
    >> Stop the sessions getting the errors then add the datafile.

  • Service Broker Activation Deadlocking

    I have implemented a (slightly) modified version of conversation recycling using conversation timers and stored procedure activation from http://rusanu.com/2007/05/03/recycling-conversations/ . However it appears that, occasionally, deadlocks  occur
    between the send and activated procedures on the conversation group/table. The main modification is that instead of having a column to represent the SPID in the table I am using an IdentifierType and Identifier value to identify the conversation. However I
    am only using the defaults (@@SPID) so I don't think that should matter in this case.
    For the send side I have:
    CREATE PROCEDURE [dbo].[usp_SendMessage]
    @endpointCode VARCHAR(255) = NULL,
    @endpointGroup VARCHAR(255) = NULL,
    @xmlPayload XML=NULL,
    @binaryPayload VARBINARY(MAX)=NULL,
    @varcharPayload VARCHAR(MAX)=NULL,
    @identifier VARCHAR(50) = @@SPID,
    @identifierType VARCHAR(50) = '@@SPID'
    AS BEGIN
    SET NOCOUNT ON
    DECLARE @fromService SYSNAME,
    @toService SYSNAME,
    @onContract SYSNAME,
    @messageType SYSNAME,
    @conversationTimeout INT
    SELECT @fromService = FromService
    , @toService = ToService
    , @onContract = OnContract
    , @messageType = MessageType
    , @conversationTimeout = ConversationTimeout
    FROM dbo.ServiceBrokerEndpointConfig
    WHERE GroupCode = @endpointGroup
    IF @fromService IS NULL OR @toService IS NULL OR @onContract IS NULL OR @messageType IS NULL OR @conversationTimeout IS NULL
    BEGIN
    RAISERROR (
    N'Failed to get endpoint config for GroupCode ''%s''.'
    , 16, 1, @endpointGroup) WITH LOG;
    RETURN;
    END
    DECLARE @SBDialog UNIQUEIDENTIFIER
    DECLARE @Message XML
    DECLARE @counter INT
    DECLARE @error INT
    DECLARE @handle UNIQUEIDENTIFIER;
    DECLARE @NotNullCount INT = ((CASE WHEN @xmlPayload IS NULL THEN 0 ELSE 1 END)
    + (CASE WHEN @binaryPayload IS NULL THEN 0 ELSE 1 END)
    + (CASE WHEN @varcharPayload IS NULL THEN 0 ELSE 1 END))
    IF @NotNullCount > 1
    BEGIN
    RAISERROR (
    N'Failed to SEND because %i payload fields are filled in when no more than 1 is expected'
    , 16, 1, @NotNullCount) WITH LOG;
    RETURN;
    END
    SET @counter = 1
    WHILE (1=1)
    BEGIN
    SET @handle = NULL
    -- Seek an eligible conversation in [ServiceBrokerConversations]
    -- We will hold an UPDLOCK on the composite primary key
    SELECT @handle = Handle
    FROM [ServiceBrokerConversations] WITH (UPDLOCK)
    WHERE Identifier = @identifier
    AND IdentifierType = @identifierType
    AND FromService = @fromService
    AND ToService = @toService
    AND OnContract = @onContract;
    IF @handle IS NULL
    BEGIN
    -- Need to start a new conversation for the current @Id
    BEGIN DIALOG CONVERSATION @handle
    FROM SERVICE @fromService
    TO SERVICE @toService
    ON CONTRACT @onContract
    WITH ENCRYPTION = OFF;
    -- Then the sender must listen on the
    -- send queue for the http://schemas.microsoft.com/SQL/ServiceBroker/DialogTimer message type and
    -- cleanup appropriately.
    IF @conversationTimeout IS NOT NULL
    BEGIN
    BEGIN CONVERSATION TIMER (@handle) TIMEOUT = @conversationTimeout;
    END
    INSERT INTO [ServiceBrokerConversations]
    (Identifier, IdentifierType, FromService, ToService, OnContract, Handle)
    VALUES
    (@identifier, @identifierType, @fromService, @toService, @onContract, @handle);
    END;
    IF @xmlPayload IS NOT NULL
    BEGIN
    -- Attempt to SEND on the associated conversation
    ;SEND ON CONVERSATION @handle
    MESSAGE TYPE @messageType (@xmlPayload);
    END ELSE IF @binaryPayload IS NOT NULL
    BEGIN
    ;SEND ON CONVERSATION @handle
    MESSAGE TYPE @messageType (@binaryPayload);
    END ELSE BEGIN
    ;SEND ON CONVERSATION @handle
    MESSAGE TYPE @messageType (@varcharPayload);
    END
    SELECT @error = @@ERROR;
    IF @error = 0
    BEGIN
    -- Successful send, just exit the loop
    BREAK;
    END
    SELECT @counter = @counter+1;
    IF @counter > 10
    BEGIN
    -- We failed 10 times in a row, something must be broken
    RAISERROR (
    N'Failed to SEND on a conversation for more than 10 times. Error %i.'
    , 16, 1, @error) WITH LOG;
    BREAK;
    END
    -- Delete the associated conversation from the table and try again
    DELETE FROM [ServiceBrokerConversations]
    WHERE Handle = @handle;
    SET @handle = NULL;
    END
    END
    And for the activation on the initiator queue I have:
    CREATE PROCEDURE [dbo].[usp_InitiatorQueueHandler]
    AS
    BEGIN
    SET NOCOUNT ON
    DECLARE @handle UNIQUEIDENTIFIER;
    DECLARE @messageTypeName SYSNAME;
    DECLARE @messageBody VARBINARY(MAX);
    WHILE (1=1)
    BEGIN
    BEGIN TRAN;
    ;WAITFOR (RECEIVE TOP(1)
    @handle = conversation_handle,
    @messageTypeName = message_type_name,
    @messageBody = message_body
    FROM [InitiatorQueue]), TIMEOUT 5000;
    IF (@@ROWCOUNT = 0)
    BEGIN
    COMMIT TRAN;
    BREAK;
    END
    -- Call the base stored procedure to handle ending the conversation
    EXEC dbo.usp_BrokerHandleInitiator @handle, @messageTypeName, @messageBody
    COMMIT TRAN;
    END
    END
    GO
    ALTER QUEUE [InitiatorQueue]
    WITH ACTIVATION (
    STATUS=ON,
    PROCEDURE_NAME=dbo.usp_InitiatorQueueHandler,
    EXECUTE AS OWNER,
    MAX_QUEUE_READERS=10
    GO
    CREATE PROCEDURE [dbo].[usp_BrokerHandleInitiator]
    @handle UNIQUEIDENTIFIER,
    @messageTypeName SYSNAME,
    @messageBody VARBINARY(MAX)
    AS
    BEGIN
    SET NOCOUNT ON
    IF @handle IS NOT NULL
    BEGIN
    -- Delete the message from the [ServiceBrokerConversations] table
    -- before sending the [EndOfStream] message. The order is
    -- important to avoid deadlocks.
    IF @messageTypeName = N'http://schemas.microsoft.com/SQL/ServiceBroker/DialogTimer'
    OR @messageTypeName = N'http://schemas.microsoft.com/SQL/ServiceBroker/EndDialog'
    BEGIN
    DELETE FROM [ServiceBrokerConversations]
    WHERE [Handle] = @handle;
    END
    IF @messageTypeName = N'http://schemas.microsoft.com/SQL/ServiceBroker/DialogTimer'
    BEGIN
    ;SEND ON CONVERSATION @handle
    MESSAGE TYPE [EndOfStream];
    END
    ELSE IF @messageTypeName = N'http://schemas.microsoft.com/SQL/ServiceBroker/EndDialog'
    BEGIN
    END CONVERSATION @handle;
    END
    ELSE IF @messageTypeName = N'http://schemas.microsoft.com/SQL/ServiceBroker/Error'
    BEGIN
    END CONVERSATION @handle;
    -- We could send a notification or store the error in a table for further inspection
    DECLARE @error INT;
    DECLARE @description NVARCHAR(4000);
    WITH XMLNAMESPACES (N'http://schemas.microsoft.com/SQL/ServiceBroker/Error' AS ssb)
    SELECT
    @error = CAST(@messageBody AS XML).value(
    '(//ssb:Error/ssb:Code)[1]', 'INT'),
    @description = CAST(@messageBody AS XML).value(
    '(//ssb:Error/ssb:Description)[1]', 'NVARCHAR(4000)')
    -- Maybe log to audit log instead?
    RAISERROR(N'Received error Code:%i Description:"%s"',
    16, 1, @error, @description) WITH LOG;
    END;
    END
    END
    The deadlock XML is:
    <deadlock>
    <victim-list>
    <victimProcess id="process807dbd0c8" />
    </victim-list>
    <process-list>
    <process id="process807dbd0c8" taskpriority="0" logused="0" waitresource="METADATA: database_id = 21 CONVERSATION_GROUP($hash = 0xff26c7e1:0x478840de:0xd403bb)" waittime="2600" ownerId="8333217736" transactionname="GetDialogByHandle" lasttranstarted="2015-03-23T10:53:58.683" XDES="0x87f251c90" lockMode="X" schedulerid="2" kpid="7220" status="suspended" spid="110" sbid="0" ecid="0" priority="0" trancount="2" lastbatchstarted="2015-03-23T10:53:58.683" lastbatchcompleted="2015-03-23T10:53:58.683" lastattention="1900-01-01T00:00:00.683" clientapp=".Net SqlClient Data Provider" hostname="COLFOQA2" hostpid="1436" loginname="dev" isolationlevel="read committed (2)" xactid="8333217704" currentdb="21" lockTimeout="4294967295" clientoption1="673185824" clientoption2="128056">
    <executionStack>
    <frame procname="MYDB.dbo.usp_SendMessage" line="116" stmtstart="7540" stmtend="7696" sqlhandle="0x03001500aada77428391a0005da4000001000000000000000000000000000000000000000000000000000000">
    SEND ON CONVERSATION @handle
    MESSAGE TYPE @messageType (@xmlPayload); </frame>
    </executionStack>
    <inputbuf>
    Proc [Database Id = 21 Object Id = 1115151018] </inputbuf>
    </process>
    <process id="process869a5e558" taskpriority="0" logused="588" waitresource="KEY: 21:72057594039959552 (1f1ae6770d1b)" waittime="2600" ownerId="8333217730" transactionname="user_transaction" lasttranstarted="2015-03-23T10:53:58.683" XDES="0x3e28456a8" lockMode="U" schedulerid="4" kpid="6720" status="background" spid="22" sbid="0" ecid="0" priority="0" trancount="2">
    <executionStack>
    <frame procname="MYDB.dbo.usp_BrokerHandleInitiator" line="28" stmtstart="1996" stmtend="2144" sqlhandle="0x03001500f704cd06e691a0005da4000001000000000000000000000000000000000000000000000000000000">
    DELETE FROM [ServiceBrokerConversations]
    WHERE [Handle] = @handle; </frame>
    <frame procname="MYDB.dbo.usp_InitiatorQueueHandler" line="29" stmtstart="1014" stmtend="1172" sqlhandle="0x03001500316f56101694a0005da4000001000000000000000000000000000000000000000000000000000000">
    EXEC dbo.usp_BrokerHandleInitiator @handle, @messageTypeName, @messageBody </frame>
    </executionStack>
    <inputbuf>
    </inputbuf>
    </process>
    </process-list>
    <resource-list>
    <metadatalock subresource="CONVERSATION_GROUP" classid="$hash = 0xff26c7e1:0x478840de:0xd403bb" dbid="21" id="lock54fdb1800" mode="X">
    <owner-list>
    <owner id="process869a5e558" mode="X" />
    </owner-list>
    <waiter-list>
    <waiter id="process807dbd0c8" mode="X" requestType="wait" />
    </waiter-list>
    </metadatalock>
    <keylock hobtid="72057594039959552" dbid="21" objectname="MYDB.dbo.ServiceBrokerConversations" indexname="PK__ServiceB__877FDFD18DF079BD" id="lock6c65b1a00" mode="U" associatedObjectId="72057594039959552">
    <owner-list>
    <owner id="process807dbd0c8" mode="U" />
    </owner-list>
    <waiter-list>
    <waiter id="process869a5e558" mode="U" requestType="wait" />
    </waiter-list>
    </keylock>
    </resource-list>
    </deadlock>
    I have a clustered index on the fields I am SELECTing by and a UNIQUE index on the Handle (for the DELETE). When running the SELECT/DELETE statements against the table the query plan reports index seeks are being used:
    CREATE TABLE [dbo].[ServiceBrokerConversations] (
    [Identifier] VARCHAR (50) NOT NULL,
    [IdentifierType] VARCHAR (50) NOT NULL,
    [FromService] [sysname] NOT NULL,
    [ToService] [sysname] NOT NULL,
    [OnContract] [sysname] NOT NULL,
    [Handle] UNIQUEIDENTIFIER NOT NULL,
    [CreateDate] DATETIME2 (7) NULL,
    PRIMARY KEY CLUSTERED ([Identifier] ASC, [IdentifierType] ASC, [FromService] ASC, [ToService] ASC, [OnContract] ASC) ON [PRIMARY],
    UNIQUE NONCLUSTERED ([Handle] ASC) ON [PRIMARY]
    ) ON [PRIMARY];
    What appears to be happening is the DELETE is somehow deadlocking with the SEND but I am not sure how since I am using them in the same order in both the send procedure and the activated procedure. Also, RCSI is enabled on the database I am receiving the
    deadlocks on.
    EDIT:
    I think I have found the culprit with lock acquisition order:
    - In the usp_SendMessage proc:
    The SELECT locks the conversation record
    The SEND locks the conversation group
    - In the timer activated proc on the initiator queue:
    The RECEIVE locks the conversation group
    The DELETE locks the conversation record
    Given that I think there may be a few solutions:
    There is some subtle difference between my code and the code from the article that I am not noticing that when fixed will resolve the deadlocking. I am hoping this is the case since it seems that others have used this pattern without issues as far as I
    know.
    Or...The deadlocking is inherent to the pattern the code is using and I can either:
    Deal with the deadlocking by adjusting the deadlock priority on the activated stored procedure so that it becomes the victim, and I can implement retry logic.
    Remove conversation timers and activation all together and resort to some sort of job that expires the conversation by polling it, where I can control the ordering.
    My ultimate goal is to eliminate any deadlocking on usp_SendMessage so that it "never" fails.
    I appreciate any feedback!
    Thanks

    I can understand why the deadlock happens. As you point out the activation procedure and the send SP acquire locks on the resources in reverse order.
    Really why Remus does not consider this in his blog post, I don't know. But may I ask, since you have replaced @@spid as a key with two other columns, does this also mean that multiple processes can use the same conversation? I'm not so sure that
    this is a good idea. I worked with an SB implementation which reuses conversations some months ago, and I recall that considered channing the pattern, but that I decided against it the end although I don't remember the exact details.
    But so much is clear, if multiple processes can use the same handle, they will serialise on the SELECT with UPDLOCK. That will not happen if you change to REPEATABLEREAD, but I guess they will serialiase on the SEND instead.
    The best way to address the problem appears to use SET LOCK_TIMEOUT 0 in the activation procedure and trap the the timeout error in a CATCH block, and let the message go back to the queue. This should be better than SET DEADLOCK_PRIORITY, since the there
    will never be a deadlock that upholds the the sender.
    Erland Sommarskog, SQL Server MVP, [email protected]

Maybe you are looking for

  • IPad 1 connector/plug problem

    I have an iPad 1. I bought the camera connector kit and the AV adapter, but the 30-pin plugs are too big, they don't fit all the way in. Both accessories say they are compatatible with the iPad 1, and so did they guy at the Apple Store, so I'm not su

  • Shift key appears to be stuck...

    I just recently installed Snow Leopard on my MacBook Air, and I can no longer type numbers. It seems as if the Shift key is being pressed. Any advice?

  • In Logic X printing to pdf gives me strange drop shadows after the notes, text.. etc.

    I'm doing a score layout in logic pro X and sended some PDF print files to my client, but he said there were drop shadows on the notes and text. It's really annoying and I can't figure out what the solution for this problem could be. I opened an olde

  • Acrobat 7.0 - Lost "pages" docked on side as tab

    I need some assistance figuring out how to get my "pages" tab docked back on the left hand side of Adobe.  I used to be able to go to view, navigation tabs, and select pages but that would open a box.  This doesn't help me as when i open another docu

  • Cannot open adobe reader x online

    When I try to open a workbook pdf file on my store builder online, either a blank screen comes up, a download strip which goes nowhere, or a box which says there is a problem with your adobe acrobat/reader.  If it is open, close it and try again.  We