I encountered a difficult problem during development today.
When an asynchronous request is made to process a large amount of data in the background, no information is returned from the request to other controllers. . At first I thought it was caused by the ajax synchronization set up by the Ext framework.
It was later discovered that the session was deadlocked, causing other controllers to wait for the session to complete before they could operate. (Mainly due to the need to update the session when the user logs in)
When PHP processes a large amount of data, the operation cannot be completed in time. At this time, other controllers are accessed or
Asynchronous requests will cause session deadlock
and Colleagues discussed that session_write_close() can be used to solve this problem
Copy code The code is as follows:
Description
void session_write_close ( void )
End the current session and store session data.
Session data is usually stored after your script terminated without the need to call session_write_close(), but as session data is locked to prevent concurrent writes only one script may operate on a session at any time. When using framesets together with sessions you will experience the frames loading one by one due to this locking. You can reduce the time needed to load all the frames by ending the session as soon as all changes to session variables are done.
Function: End the current session operation and save the session data
It is very clear that when the script request does not call session_write_close();, although the session data is stored . However, the session Date (that is, the session file) is in a locked state
to avoid unnecessary consequences caused by other applications operating the session at this time. When using the framework, different files may continuously operate the session in order not to cause other operations to affect the current session. Deadlock wait
can use this function...
http://www.bkjia.com/PHPjc/327721.htmlwww.bkjia.comtruehttp: //www.bkjia.com/PHPjc/327721.htmlTechArticleI encountered a difficult problem during development today. When an asynchronous request is processed in the background to process a large amount of data, no information is returned from the request to other controllers. . At first I thought it was the Ext framework setting...
Statement:The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn