bito-code-review[bot] commented on PR #43563:
URL: https://github.com/apache/superset/pull/43563#issuecomment-5431555081

   <!-- Bito Reply -->
   The flagged issue is correct. Holding a lock with a fixed TTL across a 
database transaction that might exceed that TTL creates a race condition where 
the lock expires, allowing a concurrent process to acquire it and potentially 
cause a unique-constraint failure.
   
   To resolve this, you should ensure the lock duration is sufficient for the 
transaction or implement a heartbeat/renewal mechanism. Given the current 
implementation, a robust approach is to ensure the lock is held for the 
duration of the transaction and to enforce a timeout that is safely below the 
TTL, or to use a lock provider that supports extending the lease.
   
   Would you like me to fetch all other comments on this PR to validate and 
implement fixes for them as well?
   
   **superset/commands/tasks/submit.py**
   ```
   # Acquire the lock around the whole transaction (see docstring): it is
           # released only after _create_or_join commits.
           with task_lock(dedup_key, timeout=5):  # Example: enforce a timeout 
safely below the 10s TTL
               return self._create_or_join(task_type, task_key, scope, user_id, 
guest_key)
   ```


-- 
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]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to