The test script should be runned for several times, and thread 1
have its chance to hang.
Hi Ayal and Dan,
Attachment is the file reproducing the bug, it is verified on
python2.7.2(fedora16) and python2.7.2+(ubuntu). Related discuss on
python issue tracker:
It is similar to what I observed, program hangs on a thread calling
subprocess pipe. Issue conclusion is that, it is fixed in python 3.2 but
not python 2.7. My test case is that one thread hanging at
subprocess pipe call while another thread call start(). So more
validation is needed on python 3.2 to see if it covers the situation.

Test .py file content:

#! /usr/bin/python

import subprocess
import threading
import time
import random
import logging

myLogger = logging.getLogger('My')
sleeptime = 0

global test_cycle
test_cycle = 200
global result
result = 0

def execCmd(command):
infile = subprocess.PIPE
outfile = subprocess.PIPE
err = subprocess.PIPE
p = subprocess.Popen(command, stdin=infile, stdout=outfile, stderr=err,
#p = subprocess.Popen(command, stdin=subprocess.PIPE)
(out, err) = p.communicate()"cmd is %s, out is %s, err is %s.", command, out, err)

class StorageThread(threading.Thread):
def __init__(self):

def run(self):
global result
thread_c = 0
while thread_c < test_cycle:
thread_c += 1"call pipe for %d times.", thread_c)
ran = random.random()

print "@@@@@@@thread all excuted!"
result = 1

class StatsThread(threading.Thread):
def __init__(self):

def run(self):"simple thread started")

formatstr =
logging.basicConfig(format=formatstr, level=logging.DEBUG)
handler = logging.StreamHandler()
logging.addLevelName(5, 'TRACE')
logging.TRACE = 5
#handler = logging.FileHandler("/var/log/vdsm/testlog.txt")

storage_thread = StorageThread()

thread_m = 0
while thread_m < test_cycle:
new_thread = StatsThread()

ran = random.random()
thread_m += 1

print "waiting for thread calling pipe complete"
while result == 0:
print "succeed!"
print "sleeping"

vdsm-devel mailing list

vdsm-devel mailing list

Reply via email to