php-mongo-session
php-mongo-session copied to clipboard
feature: abandoned lock garbage collection
I'm creating this issue as a spin-off from #9 which was concerning abandoned session locks ending up in sessions_lock.
It was confirmed this is occurring when a PHP ends fatally due to a timeout for example.
As @nicktacular mentioned, we should investigate to see whether a registered PHP shudown function would even trigger in this scenario, and if it does actually trigger we should try to catch this and remove the lock.
Otherwise, we're going to need some sort of garbage collection process/monitor. I would prefer a solution that doesn't require a separate process.
After I work on #16 I'll have a better way to replicate this behavior and implement. I'd like to be able to unit test this.
@nicktacular I just noticed #14 -- if you end up merging in changes to no longer avoid session locks, wouldn't this become a non-issue?
I believe that part of why this is happening is related to a fix I made that's in the develop branch right now. However, I will still add this as a feature in the gc
method to also remove stale locks.
Yeah I'd really prefer to stick with a simple drop in replacement (I can reply to the other issue).
Can you send a diff of the changes you're talking about that resolve the suspected stuck lock issue? On Feb 14, 2015 12:24 PM, "Nick Ilyin" [email protected] wrote:
I believe that part of why this is happening is related to a fix I made that's in the develop branch right now. However, I will still add this as a feature in the gc method to also remove stale locks.
— Reply to this email directly or view it on GitHub https://github.com/nicktacular/php-mongo-session/issues/13#issuecomment-74383746 .
What do you mean by simple drop in replacement?
I meant how it is now :) I will reply to the other issue where you brought this up. All I meant was -- I prefer to keep the basic usage of the class to be a basic session handler -- IE, simple $_SESSION usage
With that said, I love the idea of having OPTIONAL enhanced session support. That way with NEW applications I can incorporate the newer/better method.
On Sat, Feb 14, 2015 at 12:56 PM, Nick Ilyin [email protected] wrote:
What do you mean by simple drop in replacement?
— Reply to this email directly or view it on GitHub https://github.com/nicktacular/php-mongo-session/issues/13#issuecomment-74384989 .
Oh right. Yes, based on the feedback in that thread, I'm not going to implement this type of session handling from now. I'm sticking with $_SESSION
usage. I have a couple of ideas to improve lock mechanisms without having to introduce the "advanced" usage.