Question

This question is a followup to my previous one: Previous Questions.

So I setup my page to initiate an ajax call to initiate processing some records. And after each record it updates a row in another table to keep track of the status of this process. After that first ajax call is made, I have another start up. It's a Ajax.PeriodicalUpdater and it's set to hit a file which simply queries that row in the db and returns the status of the original process.

So this works perfectly fine... as long as the file that provides the status updates is outside my current app. If I put the file inside of my app, then it doesn't work right. If I watch firebug, the PeriodicalUpdater call doesn't get anything back until the original ajax call finishes, it just hangs out so it's as if the file is hung and not returning anything.

This whole app is running inside just a basic framework we are using. Nothing crazy, just handles routing, and basic template aspects etc... So all of these functions/files are inside this app and all these ajax calls are being routed through this.

What could be causing something like this?

Was it helpful?

Solution

Can this be due to the limit of concurrent connections supported by a browser to a particular domain?

OTHER TIPS

This is caused by PHP session serialization. The session data is locked until the PHP process for each request has finished writing to it, so further requests in the same session will queue until the lock is released.

If your AJAX requests need access to session state, read out the information you need and then use session_write_close() as early in your code as possible to release those locks.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top