Re: [tkined] segfault in multithread app when 'waiting'

From: Juergen Schoenwaelder (schoenw@ibr.cs.tu-bs.de)
Date: Fri Jun 23 2000 - 08:59:55 MET DST


>>>>> Matthew Krenzer writes:

Matthew> I'm using Tnm (3.0.0) inside of tclhttpd (3.0.2) with the
Matthew> Thread (2.0) package. I create several threads that perform
Matthew> async requests but if ever two threads call 'snmp wait' or
Matthew> 'snmp# wait' I get a segmentation fault. That's right, the
Matthew> whole tclsh crashes. If only one thread ever dose a wait
Matthew> then there is no problem - only when multiple threads do
Matthew> waits. Dose anyone have any idea why this might be? Is tnm
Matthew> not thread safe? are just the 'wait' commands not thread
Matthew> safe? I have tried every concevable combination of using the
Matthew> two types of 'wait' provided by Tnm::snmp.

The Tnm extension is right now not thread-safe. I have some more
patches sitting in the queue to make it more robust.

The SNMP implementation itself maintains a global list of outstanding
requests and the wait commands operate on that list. Making this list
interpreter local does not work since the SNMP engine does some
traffic shaping (which is pretty useless if you do it on a per thread
basis).

So the answer is to stick some mutexes into the code so that the
global data structures are properly protected.

/js

-- 
Juergen Schoenwaelder      Technical University Braunschweig
<schoenw@ibr.cs.tu-bs.de>  Dept. Operating Systems & Computer Networks
Phone: +49 531 391 3289    Bueltenweg 74/75, 38106 Braunschweig, Germany
Fax:   +49 531 391 5936    <URL:http://www.ibr.cs.tu-bs.de/~schoenw/>

-- !! This message is brought to you via the `tkined & scotty' mailing list. !! Please do not reply to this message to unsubscribe. To subscribe or !! unsubscribe, send a mail message to <tkined-request@ibr.cs.tu-bs.de>. !! See http://wwwsnmp.cs.utwente.nl/~schoenw/scotty/ for more information.



This archive was generated by hypermail 2b29 : Mon Jan 08 2001 - 15:27:47 MET