[horde] CPU frying due to gigantic line in description field of a kronolith event

Luis Felipe Marzagao lfbm.andamentos at gmail.com
Thu Feb 11 02:19:43 UTC 2010


Unfortunatelly, I'm not experienced in programming or in php, so I'm not 
sure how could I provide useful info. I've made a trace with apd, which 
can be processed by pprofp script. Here is an example that seems 
interesting. The total time running was 65 seconds, and 99% of this was 
used solely by iconv_substr function:

Trace for /var/www/html/horde/kronolith/index.php
Total Elapsed Time = 65.29
Total System Time  = 0.11
Total User Time    = 65.16


          Real         User        System             secs/    cumm
%Time (excl/cumm)  (excl/cumm)  (excl/cumm) Calls    call    s/call  
Memory Usage Name
--------------------------------------------------------------------------------------
99.3 64.71 64.71  64.68 64.68  0.01 0.01   550  0.1176   
0.1176            0 iconv_substr
0.1 0.08 0.08  0.06 0.06  0.00 0.00  4217  0.0000   0.0000            0 
strlen
0.1 0.05 0.05  0.05 0.05  0.00 0.00   875  0.0001   0.0001            0 
utf8_decode
0.1 0.05 0.05  0.05 0.05  0.01 0.01  3088  0.0000   0.0000            0 
is_null
0.1 0.04 0.04  0.04 0.04  0.01 0.01  1320  0.0000   0.0000            0 
preg_match
0.0 0.02 0.02  0.03 0.03  0.00 0.00  1107  0.0000   0.0000            0 
Kronolith_Event_sql->lower
0.0 0.03 0.03  0.02 0.02  0.01 0.01   255  0.0001   0.0001            0 
define
0.0 0.02 0.02  0.02 0.02  0.01 0.01  3177  0.0000   0.0000            0 
str_repeat
0.0 0.02 0.02  0.01 0.01  0.00 0.00  1396  0.0000   0.0000            0 
error_reporting
0.0 0.02 0.20  0.01 0.17  0.00 0.03  3312  0.0000   0.0001            0 
preg_replace
0.0 0.01 0.01  0.01 0.01  0.00 0.00  1350  0.0000   0.0000            0 
is_array
0.0 0.01 0.15  0.01 0.11  0.00 0.04    40  0.0002   0.0027            0 
require_once
0.0 0.01 0.01  0.01 0.01  0.00 0.00   477  0.0000   0.0000            0 is_a
0.0 0.00 0.00  0.01 0.01  0.00 0.00   391  0.0000   0.0000            0 
in_array
0.0 0.00 0.00  0.01 0.01  0.00 0.00   193  0.0000   0.0000            0 
strpos
0.0 0.00 0.00  0.01 0.01  0.00 0.00   354  0.0000   0.0000            0 
htmlspecialchars
0.0 0.01 0.01  0.01 0.01  0.00 0.00   674  0.0000   0.0000            0 
function_exists
0.0 0.01 0.01  0.01 0.01  0.00 0.00   520  0.0000   0.0000            0 _
0.0 0.01 0.01  0.01 0.01  0.00 0.00   279  0.0000   0.0000            0 date
0.0 0.01 0.01  0.00 0.00  0.00 0.00     1  0.0050   0.0050            0 
stream_wrapper_register

If you instruct me, I can make some other tests and provide more info. I 
just need to know what to do.

Thanks,
Luis Felipe


Em 10-02-2010 15:39, Michael M Slusarz escreveu:
> Quoting Luis Felipe Marzagao <lfbm.andamentos at gmail.com>:
>
>> Yes, limiting the field allowed text would be a solution, but the 
>> real problem is not the amount of text. It can work with a lot of 
>> text, as long as it is not condensed in one single line. In other 
>> words, if you add "enters" and "break" that gigantic line, then it 
>> works just fine.
>
> Sounds potentially like a preg issue - namely a preg that is not 
> optimized for searching on a single line.  If you could trace the code 
> to determine where that issue potentially is, that would be great.
>
> michael
>


More information about the horde mailing list