This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Default RLock does not work well for Manager Condition
Type: behavior Stage: resolved
Components: Versions:
process
Status: closed Resolution: works for me
Dependencies: Superseder:
Assigned To: Nosy List: Misko Dzamba, davin, iritkatriel, pitrou
Priority: normal Keywords:

Created on 2020-06-10 00:09 by Misko Dzamba, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Messages (3)
msg371146 - (view) Author: Misko Dzamba (Misko Dzamba) Date: 2020-06-10 00:09
I get unexpected behavior from Condition when using a Manager. I expected that if I call Condition.acquire() in one thread (or process) and then call .acquire() if another thread (or process) without first releasing the condition that it should block. However it seems like Condition.acquire() never blocks... 

from multiprocessing import Pool,Manager
import time

def f(x):
    cv,t=x
    cv.acquire()
    print(t,"Got cv")
    return 

if __name__ == '__main__':
    m=Manager()
    cv=m.Condition(m.RLock())
    p = Pool(5)
    print(p.map(f, [ (cv,x) for x in range(10) ]))
msg375014 - (view) Author: Irit Katriel (iritkatriel) * (Python committer) Date: 2020-08-07 18:26
I was unable to reproduce what you're seeing on windows 10, master branch. 

Please provide more information regarding the python version and system you are seeing this problem on.
msg381625 - (view) Author: Irit Katriel (iritkatriel) * (Python committer) Date: 2020-11-22 17:51
I tried this script on Windows 10, MacOs and Linux and it blocked in all cases. If you are still seeing this issue please create a new issue with full system and env information.
History
Date User Action Args
2022-04-11 14:59:32adminsetgithub: 85106
2020-11-22 17:51:42iritkatrielsetstatus: open -> closed
resolution: works for me
messages: + msg381625

stage: resolved
2020-08-07 18:26:43iritkatrielsetnosy: + iritkatriel
messages: + msg375014
2020-06-10 07:36:48ned.deilysetnosy: + pitrou, davin
2020-06-10 00:09:42Misko Dzambacreate