Out of swapping space?

#1
Im using the cache feature and keep getting the following error, anyone know why?

[xx.xx.xx.xx:38749-0#proxy-cache] out of swapping space while terminating GZIP stream!
 

mistwang

LiteSpeed Staff
#2
Should change the static gzip cache directory under "server"->"tuning" tab. By default it uses /tmp/lshttpd/swap . I recommend using "$SERVER_ROOT/cache" or any directory you want to use, just make sure the partition has enough free space.
 
#3
Same problem. Changing dir's doesn't helped. 10GB of free space.

Filesystem 1K-blocks Used Avail Capacity Mounted on
/dev/vd0 102400000 91597412 10802588 89% /


using php script for compression
PHP:
<?php
global $GZIP;
if($GZIP == 1 and $indexphp == 1) {
header("Content-Encoding: gzip");
ob_start(); 
ob_implicit_flush(0); 
function CheckCanGzip(){
    global $HTTP_ACCEPT_ENCODING; 
    if (headers_sent() || connection_aborted()){
        return 0; 
    }
    if (strpos($HTTP_ACCEPT_ENCODING,  'x-gzip') !== false) return "x-gzip"; 
    if (strpos($HTTP_ACCEPT_ENCODING, 'gzip') !== false) return "gzip"; 
    return 0; 
}

function GzDocOut($level=3, $debug=0){
    $ENCODING = CheckCanGzip(); 
    if ($ENCODING){
        $Contents = ob_get_contents(); 
        ob_end_clean(); 
        if ($debug){
            $s = "<br style=\"clear: both\"><center><font style='color:#C0C0C0;
                  font-size:9px; font-family:tahoma'>Not compress
                  length: ".strlen($Contents).";  "; 
            $s .= "Compressed length: ".
                   strlen(gzcompress($Contents, $level)).
                   "</font></center>"; 
            $Contents .= $s; 
        }
        header("Content-Encoding: $ENCODING"); 
        print "\x1f\x8b\x08\x00\x00\x00\x00\x00"; 
        $Size = strlen($Contents); 
        $Crc = crc32($Contents); 
        $Contents = gzcompress($Contents, $level); 
        $Contents = substr($Contents,  0,  strlen($Contents) - 4); 
        print $Contents; 
        print pack('V', $Crc); 
        print pack('V', $Size); 
        exit; 
    }else{
        ob_end_flush(); 
        exit; 
    }
}

}

?>
 
#7
total used free shared buffers cached
Mem: 49415496 47558976 1856520 0 1074120 41267960
-/+ buffers/cache: 5216896 44198600
Swap: 8189936 22380 8167556

**************************
Filesystem Inodes IUsed IFree IUse% Mounted on
rootfs 117M 872K 116M 1% /
devtmpfs 5.9M 848 5.9M 1% /dev
tmpfs 5.9M 29 5.9M 1% /dev/shm
/dev/md3 117M 872K 116M 1% /
/dev/md2 128K 47 128K 1% /boot
 

NiteWave

Administrator
#8
"out of swapping space while terminating GZIP stream" comes from lsws.
your code is in PHP and try to gzip something.
so It looks lsws try to gzip something already gzipped by php.

to identify the issue, can you disable gzip in php code. if the request headers contains "Accept-Encoding: gzip", lsws will gzip the response body automatically, no need php do the compression.

on the other hand, if the response headers contains "Content-Encoding: gzip" from backend php process, lsws should stop gzip response body one more time. --- if it does, should be a bug. need further confirmation.
 
#9
php.ini >> zlib.output_compression = off
phpinfo >> gzip compression: enabled
I tried to re compile php without '--with-zlib' in Configure Parameters; in phpinfo the gzip compression status changed to: "disabled (install ext/zlib)" but my site do not load completely and js files has problem
 
#12
we need confirm where the root cause is first before any solution.
if you modify the code as I suggested, then no error message
" out of swapping space while terminating GZIP stream!"
any more, will help to narrow down the scope greatly.
if the error message is still there, then likely not the double-gzip cause at all.
 
#14
Sorry, I thought you posted the php source code at #3, which actually from DangerD
But so far there is no enough info to identify your issue.
can you post the exact error message in your error or stderr log ?
how frequently the error appear in the error/stderr log ? e.g, number of same errors/per day.
we need more information about your configuration.
if we can reproduce the issue in our lab based on your description, that'll be ideal.
 
#18
looks problem ...
Static GZIP Cache Directory:$SERVER_ROOT/cache

what's the permission of $SERVER_ROOT/cache ?
#ls -ald /usr/local/lsws/cache

and images/gif should not be in "Compressible Types"
to trouble shoot this issue, you can revert the settings to original. then change one by one. see which one causes the error.
 
#19
images/gif removed; problem still there
drwx------ 18 apache apache 4096 Feb 5 22:05 /usr/local/lsws/cache
litespeed also running as user(apache) : group(apache)
 
#20
please follow
to trouble shoot this issue, you can revert the settings to original. then change one by one. see which one causes the error.
if revert to original default settings, the error is gone, then it's something related the change of "GZIP Compression".
if the error still continue, your change should be ok.
 
Top