473,799 Members | 2,907 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

PHP zombie sessions

Hi All

Seem to be getting zombie sessions. /tmp/sess_[put your favorite 32
hex characters here] exist and are owned by daemon. I am guessing and
these could come from brower crashes, networks gone down ... etc ...
even from stuff that I haven't done properly. So for the big question.

Can I run a cron job and delete these? Or does PHP also store stuff in
another location and could cause me grief down the road?

Thanks in advance!

todh

Sep 24 '06 #1
4 3682
ctclibby schrieb in etwa dies, Am 24.09.2006 18:58:
Hi All
Hi!
>
Can I run a cron job and delete these? Or does PHP also store stuff in
another location and could cause me grief down the road?

Thanks in advance!

todh
On my Debian-Server there is per default a cronjob that looks every 30
minutes for old sessions.

Cronjob:

09,39 * * * * root [ -d /var/lib/php4 ] && find /var/lib/php4/
-type f -cmin +$(/usr/lib/php4/maxlifetime) -print0 | xargs -r -0 rm

/usr/lib/php4/maxlifetime:

#!/bin/sh -e

max=1440

for ini in /etc/php4/*/php.ini; do
cur=$(sed -n -e
's/^[[:space:]]*session.gc_max lifetime[[:space:]]*=[[:space:]]*\([0-9]\+\).*$/\1/p'
$ini 2>/dev/null
[ -z "$cur" ] && cur=0
[ "$cur" -gt "$max" ] && max=$cur
done

echo $(($max/60))

exit 0

HTH

--
Some humans would do anything to see if it is possible to do it.
If you would place a lager switch in some cave somewhere,
saying "END-OF-THE-WORLD-SWITCH!! DO NOT TOUCH!!!",
the paint wouldnt have time to dry.

-Terry Pratchett
Sep 24 '06 #2
C.

Bernhard Jaud wrote:
ctclibby schrieb in etwa dies, Am 24.09.2006 18:58:
Hi All
Hi!

Can I run a cron job and delete these? Or does PHP also store stuff in
another location and could cause me grief down the road?
On my Debian-Server there is per default a cronjob that looks every 30
minutes for old sessions.
....but you KNOW you should be finding out why they don't get deleted.

Why not bump up the gc_probability and see what impact it has.

C.

Sep 25 '06 #3
MeAgain!

ctclibby wrote:
Hi All

Seem to be getting zombie sessions. /tmp/sess_[put your favorite 32
Thought that you might want to know what I found out. Of course,
things went sideways after I started figuring out what to do about the
..subject.

User sessions are kept in a MySql database which lets them return to
where they are/were when something happens. Well, found that if a user
just quit the logged in session, the database was not cleaned and would
stay there; as how would it know that the user has gone? I probably
knew this in the back of my mind, but didn't do anything about it until
now. I created a cleaner to run at midnight(ish) looking for database
sessions that were older than 2 days. This cleaner also removed the
zombie sessions from the filesystem also checking for the 2 day
thingie. Now imagine my supprise while testing the cleaner that NONE
of the the file system session zombies were in the session database.
So I started looking elsewhere.

I found that a session was started in an unrelated piece of code that
didn't have anything to do with user login. This put a 0 filesize
session in /tmp. Think that I got that fixed, time will tell. I
started reading on the 'garbage cleanup' and will play around with
that.

I guess that the end result is probably more of a 'why does it do that'
issue than anything and doesn't hamper the way php creates new
sessions. How many combinations of 32 characters to generate the
session id? Pretty slim chance of that happening twice.

have fun!

Sep 25 '06 #4
C. schrieb in etwa dies, Am 25.09.2006 15:13:
...but you KNOW you should be finding out why they don't get deleted.
But you KNOW to read posts before answering? ;-)

As i said this files are installed per default on my debian server. I
didnt't say that my sessions are terminated every 30 minutes, did i?

regards

Bernhard
--
Some humans would do anything to see if it is possible to do it.
If you would place a lager switch in some cave somewhere,
saying "END-OF-THE-WORLD-SWITCH!! DO NOT TOUCH!!!",
the paint wouldnt have time to dry.

-Terry Pratchett
Sep 25 '06 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
1995
by: Brian | last post by:
From one script, I'm spawnv'ing another that will launch mpg123 to play a specified mp3. Problem is that After the second script has launched mpg123, it'll turn into a zombie process. It doesn't happen when I launch it from the command line, so there's something wrong with the way I'm calling it (I believe). mp3pid = os.spawnv(os.P_NOWAIT, "/oter/playfile.py", ) Shouldn't this launch the script without waiting for it to finish?
0
519
by: Plymouth Acclaim | last post by:
Hi guys, We have a problem with Dual AMD64 Opteron/MySQL 4.0.18/Mandrake 10 for a very high volume site. We are evaluating the performance on our new server AMD64 and it seems it's slow compared to Dual Xeon/MySQL 4.0.15/RedHat8 and Dual Xeon/MySQL 4.0.18/Mandrake 10. And it seems there are zombie threads. 570 threads in 1 hour and we didn't even use JDBC connection pooling at all. These threads are supposed to be gone within 60...
4
7737
by: A. Tillman | last post by:
We are having a really big problem with a zombie process/transaction that is blocking other processes. When looking at Lock/ProcessID under Current Activity I see a bunch of processes that are blocked by process 94 and process 94 is blocked by process -2. I assume -2 is a zombie that has an open transaction. I cannot find this process to kill and it seems that this transaction is surviving database restarts. I know which table is...
0
1048
by: Turtle | last post by:
I'm running devenv.exe from a batch file, with a /runexit command line switch. The devenv opens fine, runs and exits. All looks great, except that the next line in the batch file doesn't execute until I go into the Task Manager and kill the "zombie" devenv process. What am I missing here? - Turtle
0
1342
by: nisimura | last post by:
Hi, I noticed that when I used SocketServer.ForkingMixIn (ForkingTCPServer), there were always zombie processes around. I searched for where waitpid() is called in ForkingMixIn and found it in SocketServer.py: def process_request(self, request, client_address): """Fork a new subprocess to process the request.""" self.collect_children()
0
2613
by: buttslapper | last post by:
Hi, Recently we discovered in our production server this kind of exception : We are wondering what causes the transaction to be zombied, and why do we get a nullreferenceexception in this method ? As you will see in the call stack, at every 5 minutes (timer), we are inserting data in a transaction. In a day, we can have 2-3 occurence of this problème.
3
6608
by: Rocketfuel | last post by:
Hi I have a program that extract data from multiple tables into one table on DB2. Recently I have changed the program to output the extract table to SQL Server 2005. I then got the error ITransaction::Commit or ITransaction::Abort was called, and object is in a zombie state. Any help on this error would be greatly appreciated. Thanks very much.
2
2417
by: anilchowdhury | last post by:
main() { pid_t child; child=fork(); if(child > 0) {sleep(60); }
6
11339
by: alikhan707 | last post by:
Hey guys i need help on this problem .... Please tell me how to create zombie in linux using fork() ?
0
9685
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10249
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10219
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10025
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9068
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6804
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5461
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5584
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
2937
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.