Phalanger
Phalanger copied to clipboard
Latest version of fixing [ThreadStatic] issues. It should merge clean.
You can probably safely ignore a bunch of the project file changes?
Thanks. There are a lot of changes. I'll merge them subsequently after some review. E.g. RequestStatic makes code much much slower, so I'll think about it a little.
Ok thanks. The request static stuff is required for phalanger to work correctly across multiple threads in IIS so without that change I doubt the original bugs we found can actually be fixed. Maybe just try to make it use it as sparingly as possible. Been a while since I made those changes but it took a long time to track down the nasty issues that were caused by it.
Regards,
Sent from my iPad Air!
Oh I did not realize my pull request was still current. I merged against trunk but cannot use that build at the moment as other stuff has broken. Something changed in the dynamic wrapper stuff such that it always fails to load PhpNet.ClassLibrary's dynamic wrapper and I was not able to figure out why yet.
As for performance, it is all a moot point if it does not work! The code still uses [ThreadStatic] for non-web applications, but for web applications is stores the context in the HttpCurrent.Current.Items dictionary. That is literally the only safe way to store data that must be stored for the duration of a request. You cannot use [ThreadStatic] in an ASP.NET environment due to thread agility, as you will end up with the context being lost when you come back from blocking I/O operations on a heavily loaded server.
So even if performance might be slower, it is the only correct solution.
That being said I cannot use the latest Phalanger code until I can work out why the dynamic wrapper is failing.