[vtkusers] vtkTkRenderWidget:Linux:Python and VTK threaded:each render spawns zombie

donna at v1.wustl.edu donna at v1.wustl.edu
Wed Mar 12 12:03:28 EST 2003


Build environment:
	Linux RedHat 6.1 (Cartman) 2.2.12-20 (uni-processor)
	gcc 3.2.2
	Python 2.1.3
	VTK cvs co -D "10/5/2002"
	both python and vtk configured with threads

When I run the following simple python script on a dual processor host
running Linux RedHat 8.0 (Psyche) 2.4.18-26.8.0smp, each render spawns a
zombie python process:

http://pulvinar.wustl.edu/donna/SureFit/Linux/volview.py

(This script is a simplified version of
http://public.kitware.com/cgi-bin/cvsweb.cgi/VTK/Examples/Medical/Python/Medical3.py;
thanks to will and prabhu for making it available.)

Keypress 'i' or 'd' in the image widget (increment or decrement the
slice displayed from VTK_DATA_ROOT + "/Data/headsq/quarter") triggers a
vtkTkRenderWidget render.  Running python in gdb, with several printf
messages inserted into VTK/Common/vtkDataObject.cxx and
VTK/Common/vtkImageData.cxx, produces this output:

*** DISPLAYING slice 30
...vtkImageData::UpdateData ...
...vtkDataObject::UpdateData begin...
...propagate the UpdateData to the source...
...Source->UpdateData...
...vtkImageData::UpdateData ...
...vtkDataObject::UpdateData begin...
...vtkDataObject::UpdateData end...
...checking this->UpdateNumberOfPieces == 1 ...
...confirmed this->UpdateNumberOfPieces == 1 ...
[New Thread 24580 (LWP 668)]
...this->UpdatePiece...
...this->UpdateNumberOfPieces...
...this->UpdateGhostLevel...
...vtkDataObject::UpdateData end...
...checking this->UpdateNumberOfPieces == 1 ...
...confirmed this->UpdateNumberOfPieces == 1 ...

The modified versions of vtkDataObject.cxx and vtkImageData.cxx are here
-- just printf statements added to see where the thread is being
spawned:

http://pulvinar.wustl.edu/donna/SureFit/Linux/vtkDataObject.cxx
http://pulvinar.wustl.edu/donna/SureFit/Linux/vtkImageData.cxx

The thread is being spawned when vtkImageData::UpdateData returns to
vtkDataObject::UpdateData, because this->UpdateNumberOfPieces == 1. 
There seems to be some recursion here.  Can anyone help me understand
why python is spawning a new thread here?  These threads look like this
in ps -efl output:

044 Z donna     1590  1589  0  75   0    -     0 do_exi 10:59 pts/2   
00:00:00 [python <defunct>]
044 Z donna     1591  1589  0  80   0    -     0 do_exi 10:59 pts/2   
00:00:00 [python <defunct>]
044 Z donna     1592  1589  0  80   0    -     0 do_exi 10:59 pts/2   
00:00:00 [python <defunct>]
044 Z donna     1593  1589  0  76   0    -     0 do_exi 10:59 pts/2   
00:00:00 [python <defunct>]

They have caused crashes for one user, whose soft maxproc limit is
1024.  My application has numerous render events, and in his case
several threads are being spawned per render.  When the number of
zombies approaches 1000, my application crashes.  This seems to happen
despite increasing the maxproc limit.  (Python seems to be crashing at
the machine's soft limit, regardless of the user's environment.)

I can rebuild python and vtk without threads, and the user doesn't
crash.  But I'd like to understand why the renders are spawning these
threads.  Any ideas are appreciated.

Thanks,

Donna Hanlon



More information about the vtkusers mailing list