Uploaded image for project: 'Hive'
  1. Hive
  2. HIVE-24363

Current order of transactional event listeners is prone to deadlock in backend DB connections

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • None
    • None
    • None

    Description

      Currently the AcidEventListener is added to the end of list of transactional event listeners. When DbNotificationListener is configured as 'hive.metastore.transactional.event.listeners'. The final list will be formed as :

      {"DbNotificationListener" , "AcidEventListener"}

      This will result in backend DB lock acquisition in this order:

       lock(a) {
              // perform some op on a
              lock(b) {
                // perform some op on b
              }
        }
      

      On the other hand, there are some HMS API say for example commit_txn(), which calls the TxnHandler method directly, followed by DbNotificationListener processing. Which will result in the lock acquisition in reverse order:

      lock(b) {
          // perform some op on b        
          lock(a) {
              // perform some op on a
          }   
       }
      

      Note: 'a' and 'b' above are backend  DB lock and not jvm locks.

      Attachments

        1. HIVE-24363.02.patch
          3 kB
          Pravin Sinha
        2. HIVE-24363.01.patch
          1 kB
          Pravin Sinha

        Issue Links

          Activity

            People

              pkumarsinha Pravin Sinha
              pkumarsinha Pravin Sinha
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 2h 20m
                  2h 20m