ID: 20449 Comment by: [EMAIL PROTECTED] Reported By: [EMAIL PROTECTED] Status: Open Bug Type: Session related Operating System: redhat 7.3 PHP Version: 4.4.0-dev New Comment:
This seems to be exactly the same problem we are having with one particular visitor to one of my websites. He always has this problem, every time he logs in his session expires. I have gone through his client PC configuration very carefully, and cannot find anything unusual. What's more odd is that he used to be able to use my site without problems. Would this problem manifest itself at random, or would it affect specific PCs? I had assumed the problem was at his end until I read this message thread, and it looked strangely familiar. Jolyon Previous Comments: ------------------------------------------------------------------------ [2002-11-22 16:20:08] [EMAIL PROTECTED] Just thought I'd add that we are having what - seems to be - the same problem. We are running on Solaris 8 and our sessions are being held in a tmpfs mount that's balanced across 4 sun 220's. PHP Version 4.2.2 and Apache 1.3.26 compiled staticly. We've been moving the session store method around thinking I/O was the issue but it hasn't helped. We've done NFS mounted share, local-only share on 1 220 (limiting the load-balancing for one site to only that box) and now tmpfs. Our sessions are rather large (at least for me) normally around 11,316 bytes with objects and arrays w/ members that are serialized objects. It's probably important to note that we are avoiding automatic serialize/deserialize of objects by doing $_SESSION['someName'] = serialize($Object) type stuff. In almost all cases the sessions are there, but a couple values are simply missing. If you need anyother info please let me know. ------------------------------------------------------------------------ [2002-11-21 21:52:36] [EMAIL PROTECTED] Ok. I think I have a really good idea as to what the bug is. I am pretty sure there is a bug in the session serialization functions. (and perhaps the normal php serialize/unserialize function) It appears that the serialization does not handle arrays 100% correctly. It works some of the times, but sometimes, the arrays get completely lost. (thus the reason why the cart variable suddenly changes to null) Over the last couple of days, I implemented my own session code. I stopped using $_SESSION and used my own method. (exact same concept though) I now use $GLOBALS["MYSESSION"] and I use serialize and unserialize along with a session start and session save function. I store to the exact same mysql session table that I did with code before. We noticed an immediate improvement in sales of about 10-20 per day. We were struggling to get to the 70-80 mark. The day I implemented the new session code, we received 95 orders, the next day we received 91. Today we are over 100! I do however, still notice some null carts though. I think the normal php serialize/unserialize function has a problem as well. However, it is obviously more stable than whatever the $_SESSION code uses. (I would assume the session code uses the regular php serialize functions? if so, then calling serialize directly and not letting php handle the sessions at all is more reliable) So today I have written some further code to preconvert arrays into strings. Thus, I will only be passing a normal string to serialize/unserialize since it seems to handle strings perfectly. My session start and save functions do all the conversion of string->array and vice versa. I'll drop a note in here tomorrow to report how that goes. As a side note: as a programmer, I realize that thinking there is a bug in those functionns is one thing. I know that since I can't provide code that breaks it, it will be damn hard to debug. My only thought is that it works most of the time so why wouldn't it work every time. I too would probably tell myself that I'm smoking crack and the bug must be elsewhere. But, I've been debugging everything else for over a month. My recent changes brought a dramatic increase in orders so I have to conclude that the bug lies somewhere in the php session code. Again, I'll let you know how serializing only a string goes and not letting serialize get a hold of an array. ------------------------------------------------------------------------ [2002-11-21 15:29:24] [EMAIL PROTECTED] NULL ------------------------------------------------------------------------ [2002-11-21 09:54:16] [EMAIL PROTECTED] I just noticed something in my session table. a:2:{s:4:"cart";N;s:10:"gobackpage";N;} What does N mean? ------------------------------------------------------------------------ [2002-11-17 22:56:14] [EMAIL PROTECTED] Changing my delimiter has not helped either. This is really hard to reproduce. But it is happening. I don't know if adding a second server to share the load will help or not. While we will be adding a second server tomorrow, we really shouldn't have to. What should I do next? Josh ------------------------------------------------------------------------ The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at http://bugs.php.net/20449 -- Edit this bug report at http://bugs.php.net/?id=20449&edit=1