Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Documentation: is CompileRenderStringAsync thread safe? #313

Closed
epsitec opened this issue Jan 21, 2020 · 8 comments
Closed

Documentation: is CompileRenderStringAsync thread safe? #313

epsitec opened this issue Jan 21, 2020 · 8 comments

Comments

@epsitec
Copy link

epsitec commented Jan 21, 2020

More generally, I did not find any information about thread safety. Can I call CompileRenderStringAsync() on the same instance from different threads? Is this expected to work?

@jzabroski
Copy link
Collaborator

Have you found any behavior suggesting its not? Someone recently asked me about thread safety and I posted a retrospective analysis of thread safeness. Not sure which Issue I posted it in.

@epsitec
Copy link
Author

epsitec commented Jan 22, 2020

No, I was wondering if I could allocate a single RazorLightEngineBuilder and reuse it throughout my code by calling CompileRenderStringAsync() from various threads, or if this was not considered safe.

@jzabroski
Copy link
Collaborator

I believe that should be safe. Will try to add some tests this week to verify. There is already one concurrency test case but its not super robust.

@jzabroski
Copy link
Collaborator

Actually, you may run into issues with #287 with fix proposed in #310

@epsitec
Copy link
Author

epsitec commented Jan 26, 2020

Pull request #310 makes perfect sense. Such a breaking change might be a pain for current users, but I feel it should be implemented in the official release.

@wgv-dzhang
Copy link

Running into a similar issue here. Are there any plans to pull in pull request #310 ?

@jzabroski
Copy link
Collaborator

I ran into some technical problems merging it - I was using GitHub Desktop which has some nasty bugs that I reported and then proceeded to get banned from github.com/Desktop/Desktop for being a pain to them about it being totally broken.

Plus, just got back from vacation.

Anyway, tl;dr: I will try to get this merged sooner than later. My current client is actually upgrading to ASP.NET Core 3.1 now so there is real economics for me to fix this stuff.

@jzabroski
Copy link
Collaborator

Fixed by #310

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants