Menu

#26 segfault when create thread in plugin(perl)

v1.0 (example)
closed-fixed
nobody
None
5
2022-06-18
2010-04-29
No

sample plugin code:

package th1;
#: Version: 1.1
#: Description: try thread
#: Author: Fu Huizhong
use threads;
sub confirm{
$::world->echo('hello\n')
}
our $tid = 0;
sub show{
$tid = threads->create( \&confirm );
$tid->detach();
}
###################################
kernel message:
==============
Apr 28 10:41:07 fhz-laptop kernel: [12623.779625] kildclient[2723]: segfault at c ip 053c9bcf sp bfa52f50 error 4 in encoding.so[53c5000+6000]
Apr 28 10:44:30 fhz-laptop kernel: [12826.905507] kildclient[2734]: segfault at c ip 00e41bcf sp bfba9fb0 error 4 in encoding.so[e3d000+6000]

Discussion

  • Eduardo M Kalinowski

    I can confirm the segfault. At this moment I don't know what causes it or how to fix, but I'll investigate it further.

     
  • Eduardo M Kalinowski

    Even though I didn't do anything specific to treat this bug, your code now works, and I was able to confirm it is running in the background. Maybe changes in libperl or the fact that now KC itself is multi-threaded.

    That said, starting threads in Perl is something that has not been test, and there might be unexpected effects, including crashes. So I'd call it an unsupported feature.

     
  • Eduardo M Kalinowski

    • status: open --> closed-fixed
    • Group: --> v1.0 (example)
     

Log in to post a comment.