ioslave terminating mechanism

Malte Starostik malte at kde.org
Wed Apr 17 16:11:47 BST 2002


Hi,

kio_thumbnail sometimes keeps hanging around after receiving SIGTERM and has 
to be KILLed. This happens when a HTML preview is being generated while the 
slave is killed, e.g. when you go to somewhere else in konq during preview 
generation.
I've seen different bt's, mostly:
* KHTMLPart's dtor result in XFlush() due to the (actually already hidden 
widget being hidden) => ~90% CPU, most of it system
* Some kdDebug() stuff ending in sigsuspend() => 0% CPU but still hanging 
there.

Not sure, but I suspect that this code in slavebase.cpp is rather dangerous:

void genericsig_handler(int sigNumber)
{
   signal(sigNumber,SIG_IGN);
   //I don't think we can have the same problem here as in the sigsegv handler
   kdDebug()<<"kioslave : exiting due to signal "<<sigNumber<<endl;
   //call the dtor of the slave and exit
   if (globalSlave!=0)
      globalSlave->~SlaveBase();
   exit(2);
};

Both the kdDebug() and the slave's dtor might do stuff that is very 
inappropriate to call from a signal handler (?).

Attached patch seems to terminate kio_thumbnail a lot more reliably, however I 
get these Header read failed messages:

kio_thumbnail: kioslave : exiting due to signal 15
khtml: KHTMLFactory::~KHTMLFactory
kparts: Part::~Part 0x80fb2d0
kparts: deleting widget [KHTMLView pointer (0x810d568) to unnamed widget, 
geometry=640x409+320+307] unnamed
kio (KIOConnection): ERROR: Header read failed, errno=104
kio (KIOConnection): ERROR: Header has invalid size (-1)
kdeinit: PID 30644 terminated.

The patch is preliminary, therefore all the commented out instead of moved 
stuff.
Opinions welcome.
-- 
Malte Starostik
PGP: 1024D/D2F3C787 [C138 2121 FAF3 410A 1C2A  27CD 5431 7745 D2F3 C787]
-------------- next part --------------
A non-text attachment was scrubbed...
Name: slavebase.diff
Type: text/x-diff
Size: 2592 bytes
Desc: not available
URL: <http://mail.kde.org/pipermail/kde-core-devel/attachments/20020417/c82eae8b/attachment.diff>


More information about the kde-core-devel mailing list