Skip to content Skip to sidebar Skip to footer

Strange Behavior With Multiple Ajax Requests To The Same Url

I constructed a strange situation in a CherryPy server, and I'd like some help understanding exactly what's happening, and why. Here is server.py: import cherrypy import os import

Solution 1:

I think that this is a race condition in combination with the cache: false option on the client side, remember that your object Root is shared inside a thread pool.

On time A you modify self.count and on time A another X requests (threads) are returning you newly modified parameter they were on time A - 1 on the with block and didn't return that new count on this particular request.

When the request that is modifying and getting out of the with statement another is already on the return so what determines the repetition or absence of the numbers returned is the processing throughput of cherrypy's thread pool.

Post a Comment for "Strange Behavior With Multiple Ajax Requests To The Same Url"