potiuk edited a comment on pull request #21431:
URL: https://github.com/apache/airflow/pull/21431#issuecomment-1034841394


   That could indeed explain it @uranusjr :
   
   It was this part of the code. It was raised in the 
`Pool.slots_stats(lock_rows=True` but it is just "after" the advisory lock 
execute that looks like might be the root cause though - (at least in theory) 
the lock SHOULD be acquired in this case.
   
   ```
           if session.get_bind().dialect.name == "postgresql":
               # Optimization: to avoid littering the DB errors of "ERROR: 
canceling statement due to lock
               # timeout", try to take out a transactional advisory lock 
(unlocks automatically on
               # COMMIT/ROLLBACK)
               lock_acquired = session.execute(
                   text("SELECT pg_try_advisory_xact_lock(:id)").bindparams(
                       id=DBLocks.SCHEDULER_CRITICAL_SECTION.value
                   )
               ).scalar()
               if not lock_acquired:
                   # Throw an error like the one that would happen with NOWAIT
                   raise OperationalError(
                       "Failed to acquire advisory lock", params=None, 
orig=RuntimeError('55P03')
                   )
   
           # Get the pool settings. We get a lock on the pool rows, treating 
this as a "critical section"
           # Throws an exception if lock cannot be obtained, rather than 
blocking
           pools = models.Pool.slots_stats(lock_rows=True, session=session)
   ```


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to