I have a perl script which does some mysql connections to fire select query. I used DBI perl module to do the same.
Sometimes it consumes 100% cpu and does nothing. I got gdb backtrace of the live process while it was consuming 99% to 100% cpu.
#0 0x0000003990a7c680 in memcpy () from /lib64/libc.so.6
#1 0x0000003992ae6e27 in Perl_regexec_flags () from /usr/lib64/perl5/5.8.8/x86_64-linux-thread-multi/CORE/libperl.so
#2 0x0000003992a922d5 in Perl_pp_subst () from /usr/lib64/perl5/5.8.8/x86_64-linux-thread-multi/CORE/libperl.so
#3 0x0000003992a8a39e in Perl_runops_standard () from /usr/lib64/perl5/5.8.8/x86_64-linux-thread-multi/CORE/libperl.so
#4 0x0000003992a37ecc in perl_run () from /usr/lib64/perl5/5.8.8/x86_64-linux-thread-multi/CORE/libperl.so
#5 0x00000000004017bc in main ()
what should i do ? (I am using CentOS release 5.8 (Final) kernel-2.6.18-308.el5)
Sometimes a regexp processing could take a forever, even on moderate amount of data.
Let say you have a regexp like this:
my $data =~ s!.*findit:(.+)!$1!gis;
This regexp do the same but it is much faster:
my $data =~ s!\A.*findit:(.+)\z!$1!is;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With