[Bug 747134] New: cryptsetup hangs when called from multiple python threads in parallel
https://bugzilla.novell.com/show_bug.cgi?id=747134 https://bugzilla.novell.com/show_bug.cgi?id=747134#c0 Summary: cryptsetup hangs when called from multiple python threads in parallel Classification: openSUSE Product: openSUSE 12.1 Version: Final Platform: Other OS/Version: openSUSE 12.1 Status: NEW Severity: Normal Priority: P5 - None Component: Other AssignedTo: bnc-team-screening@forge.provo.novell.com ReportedBy: Yarny@public-files.de QAContact: qa@suse.de Found By: --- Blocker: --- User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:10.0) Gecko/20100101 Firefox/10.0 I use python do get the key slot usage of several luks partitions. To this end, I create a couple of python threads, and each thread calls the cryptsetup binary for one of the devices. This sometimes fails: One of the calls seems to hang without actually calling cryptsetup (or cryptsetup doing nothing?). Reproducible: Always Steps to Reproduce: I tried this inside a VirtualBox (hosted on oS 11.4 on a x86_64 MacBooc) with the oS 12.1 LiveCD, booted with "splash=off 3". The host has two processors and the VirtualBox sees both. Run this shell script. It will create 7 loop devices with fresh luks headers. ################################################################ #!/bin/bash echo -n abc > /tmp/lukskey for k in $(seq 7) do dd if=/dev/null of=/tmp/loop$k bs=1K seek=1M count=0 losetup /dev/loop$k /tmp/loop$k cryptsetup \ --batch-mode \ --iter-time 1 \ luksFormat /dev/loop$k /tmp/lukskey done ################################################################ Run this python script. It will repeatedly call luksDump on every loop-device, using 4 threads. ################################################################ #!/usr/bin/python -3Wd from subprocess import call,check_output,STDOUT from threading import Thread from Queue import Queue,Empty from operator import methodcaller from sys import stdout #mycall = call # Use this to see luksDump output mycall = check_output def worker(srcq): try: while True: n = srcq.get_nowait() mycall(( "cryptsetup", "--debug", "--batch-mode", "luksDump","/dev/loop%d"%n, ),stderr=STDOUT) srcq.task_done() except Empty: pass while True: stdout.write(".") # Dot indicates a cycle to the user stdout.flush() srcq = Queue() map(srcq.put,range(1,8)) threads = list(Thread(target=worker,args=(srcq,)) for d in range(4)) map(methodcaller("start"),threads) # thread count ^ map(methodcaller("join"),threads) ################################################################ Actual Results: Each cycle will write a dot (".") to stdout. On my machine, I see see a couple of dots, but they suddenly stop (after 10 or 20 dots). I have to change the terminal and use kill to terminate the python process. Ctrl-C is not working. Expected Results: The Python loop runs without stopping. I failed to reproduce this with an ordinary shell script. The following shell script does /not/ show this problem on my machine. ################################################################ #!/bin/bash declare -A pids while true do for k in $(seq 7) do cryptsetup --debug --batch-mode luksDump /dev/loop$k & pids[$k]=$! done wait ${pids[*]} done ################################################################ Maybe the way Python calls subprocesses is part of the problem. This bug is a regression. The scripts above do not show this bug when called from the 11.4 LiveCD. (Mysteriously, the bug-triggering loop also runs much faster in 11.4 than it does in 12.1 before stopping completely.) -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.
https://bugzilla.novell.com/show_bug.cgi?id=747134
https://bugzilla.novell.com/show_bug.cgi?id=747134#c1
--- Comment #1 from Yarny Yarny
https://bugzilla.novell.com/show_bug.cgi?id=747134
https://bugzilla.novell.com/show_bug.cgi?id=747134#c
Yarny Yarny
https://bugzilla.novell.com/show_bug.cgi?id=747134
https://bugzilla.novell.com/show_bug.cgi?id=747134#c2
Yarny Yarny
https://bugzilla.novell.com/show_bug.cgi?id=747134
https://bugzilla.novell.com/show_bug.cgi?id=747134#c
kk zhang
https://bugzilla.novell.com/show_bug.cgi?id=747134
https://bugzilla.novell.com/show_bug.cgi?id=747134#c3
--- Comment #3 from Yarny Yarny
https://bugzilla.novell.com/show_bug.cgi?id=747134
https://bugzilla.novell.com/show_bug.cgi?id=747134#c4
--- Comment #4 from Yarny Yarny
https://bugzilla.novell.com/show_bug.cgi?id=747134
https://bugzilla.novell.com/show_bug.cgi?id=747134#c5
Yarny Yarny
participants (1)
-
bugzilla_noreply@novell.com