Possibly a sessions problem?

#1
Hi,

I have a website on an nginx server which runs with no problems.

I cloned the exact same website onto a litespeed server, but now I'm running into a few problems.

After the first page, loading time for each new page you click to takes extremely long before it loads. I looked for the problem in the forums and think that it might be a session problem. I tried the various fixes there, chowning the sessions directory and changing the session.save path to /tmp, but those didn't work.

Another possibility I found while searching was maybe my mod rewrite rules wasn't working properly, so I turned on rewrite at level 9 logging and restarted the server.

Checking the logs, I didnt see any errors. The rewrites that were there were rewriting.

Anyone else have a idea how I should start to debug this problem? I checked inspect element in chrome, but that didn't shed any light. (But maybe I didn't know what I was looking for).

Thank you
 

webizen

Well-Known Member
#2
You may want to strace the process (litespeed or lsphp5, etc) and see where it stucks.

What's your server environment (OS version, LS version, etc)?
 
#3
So I did a top to see what processes I have:

Code:
 5317 nobody    16   0 73368  14m 3116 S  0.0  0.4   0:00.98 lsphp5
 5626 nobody    16   0 73588  14m 3048 S  0.0  0.4   0:00.31 lsphp5
 5629 nobody    15   0 73584  14m 3036 S  0.0  0.4   0:00.09 lsphp5
 5627 nobody    15   0 73076  14m 3080 S  0.0  0.4   0:00.30 lsphp5
 5623 nobody    16   0 67668 9056 3052 S  0.0  0.2   0:00.11 lsphp5
 5675 nobody    15   0 67680 8956 2940 S  0.0  0.2   0:00.21 lsphp5
 5628 nobody    15   0 67648 8896 2912 S  0.0  0.2   0:00.09 lsphp5
 5625 nobody    15   0 66624 7872 2912 S  0.0  0.2   0:00.04 lsphp5
 5308 nobody    15   0 64108 4892 2808 S  0.0  0.1   0:00.00 lsphp5
The lsphp5 definitely has inconsistencies- it ranges from 14m to 8900+!

Here's an strace of one of them:

Code:
[example@domain ~]# strace -p5675
Process 5675 attached - interrupt to quit
fcntl(6, F_SETFL, O_RDWR)               = 0
close(6)                                = 0
writev(3, [{"LS\6\0\323\0\0\0", 8}, {"PHP Warning:  file_get_contents("..., 203}], 2) = 211
rt_sigaction(SIGPIPE, {0x1, [PIPE], SA_RESTORER|SA_RESTART, 0x32a08302d0}, {0x1, [PIPE], SA_RESTORER|SA_RESTART, 0x32a08302d0}, 8) = 0
poll([{fd=5, events=POLLIN|POLLPRI}], 1, 0) = 0 (Timeout)
write(5, "\1\0\0\0\1", 5)               = 5
shutdown(5, 2 /* send and receive */)   = 0
close(5)                                = 0
rt_sigaction(SIGPIPE, {0x1, [PIPE], SA_RESTORER|SA_RESTART, 0x32a08302d0}, {0x1, [PIPE], SA_RESTORER|SA_RESTART, 0x32a08302d0}, 8) = 0
chdir("/usr/local/lsws/fcgi-bin")       = 0
lseek(4, 0, SEEK_SET)                   = 0
write(4, "saved_ip|s:12:\"76.173.46.98\";sys"..., 297) = 297
close(4)                                = 0
umask(022)                              = 0
brk(0x1b1b5000)                         = 0x1b1b5000
open("/dev/urandom", O_RDONLY)          = 4
read(4, "8F\260\303\263\334Hj", 8)      = 8
close(4)                                = 0
open("/dev/urandom", O_RDONLY)          = 4
read(4, "\355\34\256\344\206\310\257\270", 8) = 8
close(4)                                = 0
open("/dev/urandom", O_RDONLY)          = 4
read(4, "P\206\325.%\372!!", 8)         = 8
close(4)                                = 0
setitimer(ITIMER_PROF, {it_interval={0, 0}, it_value={0, 0}}, NULL) = 0
writev(3, [{"LS\3\0>\1\0\0\6\0\0\0\224\1\0\0\30\0'\0N\0\21\0]\0'\0", 28}, {"X-Powered-By: PHP/5.2.9\0Expires:"..., 290}, {"LS\4\0\320\0\0\0", 8}, {"\nWarning: file_get_contents(http"..., 200}, {"LS\5\0\10\0\0\0", 8}], 5) = 534
select(4, [3], NULL, NULL, {1, 0})      = 0 (Timeout)
getppid()                               = 5308
select(4, [3], NULL, NULL, {1, 0})      = 0 (Timeout)
getppid()                               = 5308
select(4, [3], NULL, NULL, {1, 0})      = 0 (Timeout)
getppid()                               = 5308
select(4, [3], NULL, NULL, {1, 0})      = 0 (Timeout)
getppid()                               = 5308
select(4, [3], NULL, NULL, {1, 0})      = 0 (Timeout)
getppid()                               = 5308
select(4, [3], NULL, NULL, {1, 0})      = 0 (Timeout)
getppid()                               = 5308
Theres a ton of timeouts that happen after.

Would this then be a problem with PHP coding or MySQL?

I'm running Centos 5.5, Litespeed 4.0.18 Std, Memcached v1.4.5, eaccelerator 0.9.6.1, PHP 5.3, MySQL 5.0
 

NiteWave

Administrator
#4
writev(3, [{"LS\6\0\323\0\0\0", 8}, {"PHP Warning: file_get_contents("..., 203}], 2) = 211
any error message in error.log or stderr.log?

if your php script are fetching contents from outside URL, it may take time to finish, and that is why:
loading time for each new page you click to takes extremely long before it loads
Theres a ton of timeouts that happen after.
can you specify how it looks like under nginx.
 
#5
There was a quick PHP bug in the error as suggested by Nitewave (thanks!), but still having the slow load issue.

We're not fetching any data from an outside URL.

We never did an strace on the processes under Nginx as we never had a problem with it.

I've done a little bit more researching and think it might be an issue with the mod_rewrite.

I'm running .htaccess file on virtual and server level enabled. I've posted my rewrite .htaccess in case there is a problem with it.

Thanks for all your help so far!

Code:
# PHP config
php_flag  register_globals       0
php_flag  register_long_arrays   0
php_flag  register_argc_argv     0
php_flag  magic_quotes_gpc       0
php_flag  magic_quotes_runtime   0
php_flag  display_errors         1
php_flag  display_startup_errors 1
php_value log_errors             2047
php_value error_reporting        0
php_value post_max_size          50M
php_value max_input_time         300
php_value upload_max_filesize    48M
php_value memory_limit           48M
#php_value error_log              '/www/d5dev/users/d5dev-scribble/www/error_log'
php_value default_mimetype       'text/html'
php_value default_charset        'utf-8'

DirectoryIndex index.php

#ErrorDocument 403 /index.php?mod=page&pn=404
#ErrorDocument 404 /index.php?mod=page&pn=404

# </ Base settings >

RewriteEngine On
RewriteBase /

RewriteRule ^u/(.+)$                files/images/u/$1            [L]
RewriteRule ^a/(.+)$                files/images/a/$1            [L]
RewriteRule ^b/(.+)$                files/images/b/$1            [L]
RewriteRule ^g/(.+)$                files/images/g/$1            [L]
RewriteRule ^c/(.+)$                files/images/c/$1            [L]
RewriteRule ^m/(.+)$                files/mc/$1                  [L]
RewriteRule ^i/(.+\.(gif|png|jpg))$ includes/templates/images/$1 [L]
RewriteRule ^j/(.+\.[a-z]+)$        includes/templates/js/$1     [L]
RewriteRule ^f/(.+\.(swf))$         includes/templates/flash/$1  [L]
RewriteRule ^f/(.+\.(swz))$         includes/templates/flash/$1  [L]
RewriteRule ^s/(.+\.(css|stl))$     includes/templates/css/$1    [L]


RewriteRule ^materials/(.+)$     							includes/templates/flash/materials/$1    [L]

RewriteRule ^open_uploader_data.xml$	index.php?type=profile&mod=albums&what=updtempl [L,NC,QSA]
RewriteRule ^id([0-9]+)/open_group_uploader_data.xml$	index.php?type=groups&mod=albums&what=updtempl&gid=$1 [L,NC,QSA]

RewriteRule ^users/([a-z0-9._-]+)/blog/?$            index.php?type=base&mod=blog&loginx=$1 [L,NC,QSA]
RewriteRule ^users/([a-z0-9._-]+)/blog/cid([0-9]+)$  index.php?type=base&mod=blog&loginx=$1&cid=$2 [L,NC,QSA]
RewriteRule ^users/([a-z0-9._-]+)/blog/id([0-9]+)$   index.php?type=base&mod=blog&loginx=$1&id=$2 [L,NC,QSA]
RewriteRule ^users/([a-z0-9._-]+)/blog/([^0-9]+)$    index.php?type=base&mod=blog&loginx=$1&what=$2 [L,NC,QSA]
RewriteRule ^users/([a-z0-9._-]+)/blog/([^0-9]+)$    index.php?type=base&mod=blog&loginx=$1&what=$2 [L,NC,QSA]

RewriteRule ^users/([a-z0-9._-]+)/friends/([^0-9]+)$    index.php?type=base&mod=$3&loginx=$1 [L,NC,QSA]
RewriteRule ^users/([a-z0-9._-]+)/friends/?$            index.php?type=base&mod=friends&loginx=$1 [L,NC,QSA]

RewriteRule ^groups/id([0-9]+)/reviews/([^/]+)?$    index.php?type=groups&mod=reviews&what=$2&id=$1 [L,NC,QSA]
RewriteRule ^groups/id([0-9]+)/reviews/edit?$    index.php?type=groups&mod=reviews&what=edit&id=$1 [L,NC,QSA]
RewriteRule ^groups/id([0-9]+)/reviews/?$    index.php?type=groups&mod=reviews&what=index&id=$1 [L,NC,QSA]

RewriteRule ^groups/id([0-9]+)/feeds/([^/]+)?$			index.php?type=groups&mod=feeds&what=$2&id=$1 [L,NC,QSA]
RewriteRule ^groups/id([0-9]+)/feeds/?$			index.php?type=groups&mod=feeds&what=index&id=$1 [L,NC,QSA]

RewriteRule ^groups/id([0-9]+)/announce/([^/]+)?$			index.php?type=groups&mod=announce&what=$2&id=$1 [L,NC,QSA]
RewriteRule ^groups/id([0-9]+)/announce/?$			index.php?type=groups&mod=announce&what=index&id=$1 [L,NC,QSA]

RewriteRule ^groups/id([0-9]+)/resources/([^/]+)$         index.php?type=groups&mod=resources&what=$2&id=$1 [L,NC,QSA]
RewriteRule ^groups/id([0-9]+)/resources/?$               index.php?type=groups&mod=resources&what=index&id=$1 [L,NC,QSA]

RewriteRule ^groups/id([0-9]+)/dis/id([0-9]+)/([^/]+)$    index.php?type=groups&id=$1&mod=dis&what=$3&id_dis=$2 [L,NC,QSA]
RewriteRule ^groups/id([0-9]+)/dis/id([0-9]+)$            index.php?type=groups&id=$1&mod=dis&what=getdisinsidelist&id_dis=$2 [L,NC,QSA]
RewriteRule ^groups/id([0-9]+)/dis/([^/]+)$               index.php?type=groups&id=$1&mod=dis&what=$2 [L,NC,QSA]
RewriteRule ^groups/id([0-9]+)/dis/?$                     index.php?type=groups&mod=dis&what=index&id=$1 [L,NC,QSA]

RewriteRule ^groups/id([0-9]+)/events/id([0-9]+)$  index.php?type=groups&id=$1&mod=events&what=geteventsinsideinfo&id_ev=$2 [L,NC,QSA]
RewriteRule ^groups/id([0-9]+)/events/([^/]+)$     index.php?type=groups&id=$1&mod=events&what=$2 [L,NC,QSA]
RewriteRule ^groups/id([0-9]+)/events/?$           index.php?type=groups&mod=events&what=index&id=$1 [L,NC,QSA]


RewriteRule ^groups/id([0-9]+)/gallery/([0-9]+)/$		   index.php?type=base&mod=groups&what=changeGallery&gid=$1&page=$2 [L,NC,QSA]
RewriteRule ^groups/id([0-9]+)/albums/?$		   index.php?type=groups&mod=albums&what=gealb&gid=$1 [L,NC,QSA]
RewriteRule ^groups/id([0-9]+)/albums/uplilist/?$    		 		index.php?type=groups&mod=albums&what=uplilist&gid=$1 [L,NC,QSA]
RewriteRule ^groups/id([0-9]+)/albums/uplimg/?$    		 			index.php?type=groups&mod=albums&what=uplimg&gid=$1 [L,NC,QSA]

RewriteRule ^groups/id([0-9]+)/albums/([0-9]+)/([^/]+)/([0-9]+)/?$     		index.php?type=groups&mod=albums&what=$3&gid=$1&aid=$2&id=$4 [L,NC,QSA]
RewriteRule ^groups/id([0-9]+)/albums/([0-9]+)/([^/]+)/?$     			index.php?type=groups&mod=albums&what=$3&gid=$1&aid=$2 [L,NC,QSA]
RewriteRule ^groups/id([0-9]+)/albums/?$                				index.php?type=groups&mod=albums&gid=$1 [L,NC,QSA]
RewriteRule ^groups/id([0-9]+)/albums/updxmlf/?$  							index.php?type=groups&mod=albums&what=updxmlf&gid=$1 [L,NC,QSA]
RewriteRule ^groups/id([0-9]+)/albums/galbxmlf/?$  					index.php?type=groups&mod=albums&what=galbxmlf&gid=$1 [L,NC,QSA]

RewriteRule ^groups/id([0-9]+)/albums/?$           index.php?type=groups&mod=albums&what=get_groups_albums&id=$1 [L,NC,QSA]

RewriteRule ^groups/id([0-9]+)/members/?$           index.php?type=base&mod=groups&what=members&id=$1 [L,NC,QSA]

RewriteRule ^users/([a-z0-9._-]+)/questions/?$       index.php?type=profile&mod=questions&loginx=$1 [L,NC,QSA]
RewriteRule ^users/([a-z0-9._-]+)/questions/([^/]+)$ index.php?type=profile&mod=questions&what=$2&loginx=$1 [L,NC,QSA]

RewriteRule ^users/([a-z0-9._-]+)/comments/?$           index.php?type=profile&mod=comments&loginx=$1 [L,NC,QSA]
RewriteRule ^users/([a-z0-9._-]+)/comments/([^/]+)$     index.php?type=profile&mod=comments&what=$2&loginx=$1 [L,NC,QSA]

RewriteRule ^users/([a-z0-9._-]+)/phcomments/?$           index.php?type=profile&mod=phcomments&what=getlist&loginx=$1 [L,NC,QSA]
RewriteRule ^users/([a-z0-9._-]+)/phcomments/([^/]+)$     index.php?type=profile&mod=phcomments&what=$2&loginx=$1 [L,NC,QSA]

RewriteRule ^users/([a-z0-9._-]+)/hgroups/?$           index.php?type=profile&mod=groups&what=getlist&loginx=$1 [L,NC,QSA]
RewriteRule ^users/([a-z0-9._-]+)/hgroups/([^/]+)$     index.php?type=profile&mod=groups&what=$2&loginx=$1 [L,NC,QSA]

RewriteRule ^users/([a-z0-9._-]+)/manage/settings/([^/]+)$           index.php?type=profile&mod=aboutme&what=$2 [L,NC,QSA]
RewriteRule ^users/([a-z0-9._-]+)/manage/settings/?$                 index.php?type=profile&mod=aboutme&what=getset [L,NC,QSA]

RewriteRule ^users/([a-z0-9._-]+)/manage/customcolors/?$                index.php?type=profile&mod=customcolors&loginx=$1 [L,NC,QSA]
RewriteRule ^users/([a-z0-9._-]+)/manage/custom/?$                      index.php?type=profile&mod=aboutme&what=htmlbox [L,NC,QSA]
RewriteRule ^users/([a-z0-9._-]+)/manage/business?$      index.php?type=profile&mod=business&loginx=$1 [L,NC,QSA]
RewriteRule ^users/([a-z0-9._-]+)/manage/business/([a-z0-9._-]+)?$       index.php?type=profile&mod=business&what=$2&loginx=$1 [L,NC,QSA]
RewriteRule ^users/([a-z0-9._-]+)/manage/business/([a-z0-9._-]+)/([0-9]+)$       index.php?type=profile&mod=business&what=$2&loginx=$1&bid=$3 [L,NC,QSA]
RewriteRule ^users/([a-z0-9._-]+)/manage/collage?$      				index.php?type=profile&mod=collage&loginx=$1 [L,NC,QSA]
RewriteRule ^users/([a-z0-9._-]+)/manage/collage/([a-z0-9._-]+)?$       index.php?type=profile&mod=collage&what=$2&loginx=$1 [L,NC,QSA]
RewriteRule ^users/([a-z0-9._-]+)/manage/([^/]+)$                       index.php?type=profile&mod=aboutme&what=$2 [L,NC,QSA]
RewriteRule ^users/([a-z0-9._-]+)/manage/?$                             index.php?type=profile&mod=aboutme [L,NC,QSA]


RewriteRule ^users/([a-z0-9._-]+)/manage/deleteRecentV/?$               index.php?type=profile&mod=aboutme&what=deleteRecentV [L,NC,QSA]
RewriteRule ^users/([a-z0-9._-]+)/addlovepage/?$                             index.php?type=base&mod=friends&what=addlovepage&loginx=$1 [L,NC,QSA]
 
Top