Note: This is a public test instance of Red Hat Bugzilla. The data contained within is a snapshot of the live data so any changes you make will not be reflected in the production Bugzilla. Email is disabled so feel free to test any aspect of the site that you want. File any problems you find or give feedback at bugzilla.redhat.com.
Bug 86416 - Threading is broken
Summary: Threading is broken
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Linux
Classification: Retired
Component: python
Version: 9
Hardware: All
OS: Linux
high
high
Target Milestone: ---
Assignee: Mihai Ibanescu
QA Contact: Brock Organ
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2003-03-21 17:42 UTC by Konstantin Ryabitsev
Modified: 2014-01-21 22:48 UTC (History)
2 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2003-07-08 21:19:56 UTC
Embargoed:


Attachments (Terms of Use)

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?


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