You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@texera.apache.org by "Yicong-Huang (via GitHub)" <gi...@apache.org> on 2026/05/03 02:12:52 UTC
[I] AtomicInteger.get_and_set deadlocks because of non-reentrant lock [texera]
Yicong-Huang opened a new issue, #4794:
URL: https://github.com/apache/texera/issues/4794
### What happened?
`amber/src/main/python/core/util/thread/atomic.py::AtomicInteger.get_and_set` acquires `self._lock` and then reads `self.value`. The `value` getter is a `@property` that *also* tries to acquire `self._lock`. The lock is a non-reentrant `threading.Lock`, so the second acquisition blocks forever — calling `get_and_set` deadlocks the calling thread the moment it is invoked.
The fix is either to switch the lock to `threading.RLock`, or to inline the read inside the existing critical section (`old_value = self._value` instead of `old_value = self.value`).
### How to reproduce?
```python
import threading
from core.util.thread.atomic import AtomicInteger
a = AtomicInteger(10)
done = threading.Event()
def attempt():
a.get_and_set(99)
done.set()
threading.Thread(target=attempt, daemon=True).start()
done.wait(timeout=0.5)
print(done.is_set()) # False — the call never returns
```
### Version
1.1.0-incubating (Pre-release/Master)
--
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: notifications-unsubscribe@texera.apache.org.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] AtomicInteger.get_and_set deadlocks because of non-reentrant lock [texera]
Posted by "Yicong-Huang (via GitHub)" <gi...@apache.org>.
Yicong-Huang closed issue #4794: AtomicInteger.get_and_set deadlocks because of non-reentrant lock
URL: https://github.com/apache/texera/issues/4794
--
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: notifications-unsubscribe@texera.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] AtomicInteger.get_and_set deadlocks because of non-reentrant lock [texera]
Posted by "nathant27 (via GitHub)" <gi...@apache.org>.
nathant27 commented on issue #4794:
URL: https://github.com/apache/texera/issues/4794#issuecomment-4415491706
I was able to reproduce the deadlock on my end using your sample code. I am planning on doing the minimal swap towards the inline read instead of reentrant lock since swapping to a reentrant lock to avoid unnecessary overhead, and because that change seems like the proper way to access the attribute given the context of already having the lock during access.
--
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: notifications-unsubscribe@texera.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] AtomicInteger.get_and_set deadlocks because of non-reentrant lock [texera]
Posted by "chenlica (via GitHub)" <gi...@apache.org>.
chenlica commented on issue #4794:
URL: https://github.com/apache/texera/issues/4794#issuecomment-4415899442
@nathant27 Thanks. Feel free to add a reply with "[forwardslash]take" and the issue will be assigned to you.
--
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: notifications-unsubscribe@texera.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org