Bug 86416

Summary: Threading is broken
Product: [Retired] Red Hat Linux Reporter: Konstantin Ryabitsev <icon>
Component: pythonAssignee: Mihai Ibanescu <mihai.ibanescu>
Status: CLOSED ERRATA QA Contact: Brock Organ <borgan>
Severity: high Docs Contact:
Priority: high    
Version: 9CC: mitr, wtogami
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2003-07-08 21:19:56 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Konstantin Ryabitsev 2003-03-21 17:42:47 UTC
Programs using threading tend to lock up consistently -- it seems that some
threads are either never unblocked, or they never exit. Same code on rhl-7.3
(python2) runs without locking issues. Could this be caused by NPTL?

Here is the code I'm using:

#!/usr/bin/python2 -tt
import threading
import socket
import random

class TestThread(threading.Thread):
    def __init__(self, ip, semaphore):
        threading.Thread.__init__(self)
        self.ip = ip
        self.semaphore = semaphore
        
    def run(self):
        self.semaphore.acquire()
        try:
            host = socket.gethostbyaddr(self.ip)
            self.host = host[0]
        except:
            self.host = self.ip
        print '%s resolves to %s' % (self.ip, self.host)
        self.semaphore.release()

semaphore = threading.Semaphore(50)

threads = []
for i in range(0, 100):
    a = random.randint(1, 250)
    b = random.randint(1, 250)
    ip = '152.3.%d.%d' % (a, b)
    t = TestThread(ip, semaphore)
    threads.append(t)
    t.start()

hosts = {}
for t in threads:
    t.join()
    hosts[t.ip] = t.host

print 'Results:'
print hosts

Comment 1 Konstantin Ryabitsev 2003-03-24 22:17:43 UTC
As a temporary workaround:

LD_ASSUME_KERNEL=2.4.19

This fixes the lockup issues. Which makes NPTL highly suspect. :)

Comment 2 Mihai Ibanescu 2003-03-25 15:08:56 UTC
Thanks for the bug report, I'll run it through the glibc people.

Comment 3 Jakub Jelinek 2003-04-08 16:43:33 UTC
Can you please try ftp://people.redhat.com/jakub/glibc/errata/9/ ?

Comment 4 Konstantin Ryabitsev 2003-04-08 19:26:25 UTC
Yes, those do fix the lock-up problem. I'm still running some tests, but so far
it's been running smoothly. :D

Comment 5 Mihai Ibanescu 2003-07-08 21:16:29 UTC
If you are satisfied with the result, can you please close the bug?