Bug 86416 - Threading is broken
Threading is broken
Status: CLOSED ERRATA
Product: Red Hat Linux
Classification: Retired
Component: python (Show other bugs)
9
All Linux
high Severity high
: ---
: ---
Assigned To: Mihai Ibanescu
Brock Organ
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2003-03-21 12:42 EST by Konstantin Ryabitsev
Modified: 2014-01-21 17:48 EST (History)
2 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2003-07-08 17:19:56 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Konstantin Ryabitsev 2003-03-21 12:42:47 EST
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 17:17:43 EST
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 10:08:56 EST
Thanks for the bug report, I'll run it through the glibc people.
Comment 3 Jakub Jelinek 2003-04-08 12:43:33 EDT
Can you please try ftp://people.redhat.com/jakub/glibc/errata/9/ ?
Comment 4 Konstantin Ryabitsev 2003-04-08 15:26:25 EDT
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 17:16:29 EDT
If you are satisfied with the result, can you please close the bug?

Note You need to log in before you can comment on or make changes to this bug.