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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]