rendrjs / rendr

Render your Backbone.js apps on the client and the server, using Node.js.
MIT License
4.09k stars 312 forks source link

App not unique per request. #458

Open efuquen opened 9 years ago

efuquen commented 9 years ago

I have developed an application using rendr and just noticed some strange behaviour under load. After some testing I've discovered that it seems the App object is not unique per request and my bugs was caused by attaching state to the App, which seems to be globally unique. My understanding was that it is suppose to be unique per request on the server side. Unfortunately I can't remember where I saw that, but if my understanding is incorrect or if maybe this behaviour was changed from a previous version it would be great if someone could clarify.

Thanks.

saponifi3d commented 9 years ago

It should indeed be unique, to access it on the server you should be looking at the req.rendrApp which is unique per request. However, it can be fairly simple to get the scope incorrect somewhere and have a reference to it somewhere that will make a singleton instance of the object. I would suggest doing a quick dive through your code to make sure that isn't the case as that's the only time I've seen that issue.

Sorry for the slow response, I've been a bit sick as of late. Hopefully, I'll be able to response a lot faster and help with any other problems you're having!

saponifi3d commented 9 years ago

@efuquen were you able to resolve this issue? Let me know if you still are having problems or need any additional help