Session object destruction failed error

Hi.

From time to time I’ve been encountering an error, when the user can not log out from the application by calling the Yii::app()->user->logout() method.

Now it’s time to fix it. I was digging into the code, and found in the CHttpSession class method destroy() that makes the following:




if(session_id()!=='')

{

	@session_unset();

	@session_destroy();

}  	



After removing ‘@’ I was able to see the error:




Error 500

session_destroy() [<a href='function.session-destroy'>function.session-destroy</a>]: Session object destruction failed



The strange thing is that this happens randomly (or at least I didn’t figure out the pattern when it happens), so it’s not that simple to debug.

Did anyone see this error, or know were might be the source of this bug?

Btw, environment is: Win 7, PHP 5.3.3, Apache 2.2.

The same error appears on the test server, where environment is: Ubuntu 10.10, nginx, php-fpm.