-
-
Notifications
You must be signed in to change notification settings - Fork 562
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
SimpleCache should use ConcurrentDictionary #583
Comments
Hello. My rationale is based upon the below...
would need to be something like... We see that ConcurrentDictionary implements IDictionary so it should be okay to change this? public class ConcurrentDictionary<TKey, TValue> : ICollection<KeyValuePair<TKey, TValue>>, IEnumerable<KeyValuePair<TKey, TValue>>, IEnumerable, IDictionary<TKey, TValue>, IReadOnlyCollection<KeyValuePair<TKey, TValue>>, IReadOnlyDictionary<TKey, TValue>, ICollection, IDictionary |
I think you are using the wrong cache implementation. |
Hello Stefan. So, I read the documentation. In my startup.cs I do indeed use Memcache Will give it a whirl. I guess when you get the opportunity, shove the ConcurrentDictionary in there. Many thanks, Zak |
Hi there! The |
Hello. I am out right now. Not 100% sure. When I said memcache I may have mispelt it. Will check when I am back tomorrow. I will take a look at the project in more detail.
One challenge I was going to say is we may end up with the situation where new versions of various piranha frameworks emerge but databases and data needs to be managed/maintained. Right now, I notice you guys don't use sql server database projects?
…Sent from my Windows 10 device
________________________________
From: Håkan Edling <[email protected]>
Sent: Saturday, April 13, 2019 2:49:34 PM
To: PiranhaCMS/piranha.core
Cc: zakwillis; Author
Subject: Re: [PiranhaCMS/piranha.core] InvalidOperationException: Operations that change non-concurrent collections must have exclusive access. A concurrent update was performed on this collection and corrupted its state. The collection's state is no longer cor...
Hi there! The MemCache is an older class for an older version which has been renamed with SimpleCache. In 6.0 a DeepClone was added when an item was returned from cache, in earlier versions, all threads requesting the same cached object gets a reference to the same instance and make corrupt it. Which version of Piranha are you using?
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub<https://nam03.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2FPiranhaCMS%2Fpiranha.core%2Fissues%2F583%23issuecomment-482810898&data=02%7C01%7C%7C435c7230a26c4957f3f808d6c016dd19%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C636907601761817872&sdata=9G6%2FG1MI0s%2FbLg49m0kx8hkmm%2B7gJ%2BYCx3kSIn7lVTo%3D&reserved=0>, or mute the thread<https://nam03.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FALol8Gfov5jXefdvlCqKBN5ioZ0y-Zkbks5vgeBugaJpZM4coTXE&data=02%7C01%7C%7C435c7230a26c4957f3f808d6c016dd19%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C636907601761827883&sdata=8BuOGquyrBaOalxDlhJDA1FTztpBLZDD5gO82DSaZ0M%3D&reserved=0>.
|
Hello. Had a thought. I used your sample project to get going with. It I likely this is not the same version as your various libraries.
Anyway. Will look at it tomorrow.
…Sent from my Windows 10 device
________________________________
From: Zak Willis <[email protected]>
Sent: Saturday, April 13, 2019 3:04:22 PM
To: PiranhaCMS/piranha.core; PiranhaCMS/piranha.core
Cc: Author
Subject: RE: [PiranhaCMS/piranha.core] InvalidOperationException: Operations that change non-concurrent collections must have exclusive access. A concurrent update was performed on this collection and corrupted its state. The collection's state is no longer cor...
Hello. I am out right now. Not 100% sure. When I said memcache I may have mispelt it. Will check when I am back tomorrow. I will take a look at the project in more detail.
One challenge I was going to say is we may end up with the situation where new versions of various piranha frameworks emerge but databases and data needs to be managed/maintained. Right now, I notice you guys don't use sql server database projects?
Sent from my Windows 10 device
________________________________
From: Håkan Edling <[email protected]>
Sent: Saturday, April 13, 2019 2:49:34 PM
To: PiranhaCMS/piranha.core
Cc: zakwillis; Author
Subject: Re: [PiranhaCMS/piranha.core] InvalidOperationException: Operations that change non-concurrent collections must have exclusive access. A concurrent update was performed on this collection and corrupted its state. The collection's state is no longer cor...
Hi there! The MemCache is an older class for an older version which has been renamed with SimpleCache. In 6.0 a DeepClone was added when an item was returned from cache, in earlier versions, all threads requesting the same cached object gets a reference to the same instance and make corrupt it. Which version of Piranha are you using?
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub<https://nam03.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2FPiranhaCMS%2Fpiranha.core%2Fissues%2F583%23issuecomment-482810898&data=02%7C01%7C%7C435c7230a26c4957f3f808d6c016dd19%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C636907601761817872&sdata=9G6%2FG1MI0s%2FbLg49m0kx8hkmm%2B7gJ%2BYCx3kSIn7lVTo%3D&reserved=0>, or mute the thread<https://nam03.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FALol8Gfov5jXefdvlCqKBN5ioZ0y-Zkbks5vgeBugaJpZM4coTXE&data=02%7C01%7C%7C435c7230a26c4957f3f808d6c016dd19%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C636907601761827883&sdata=8BuOGquyrBaOalxDlhJDA1FTztpBLZDD5gO82DSaZ0M%3D&reserved=0>.
|
Hello there. Forgive me if I have made any oversights or if this is quite involved. The critical question is. Should it be possible to run an upgrade of the project template you provide to your later version of piranha CMS to permit correct use of the caching service? Background I just copied my project to a new folder, ran an update of all Piranha Nuget Packages. Puts most Piranha at versions 6 or above. This now introduces a number of async call issues which I have fixed on my local version. Current status There are two main errors as I see it; CMS Controller Archive method Raw errors from Visual Studio [Route("archive")]
I haven't continued trying to fix these two calls...
|
Hi guys. Did what I add make sense? Quite a bit of information - I gave. So the only outcome is to ensure the sample project is running on your latest version. This is something I could look at once I get past my current phase of my project which is a few month's off. Many thanks, Zak |
To answer your previous question, no you can't update an already created project with a project template. Project templates just create the baseline for a new project. Like you noticed the documentation was wrong on the website in pointing to a specific version of the project templates. We've updated this and we will also update |
Hi, I just ran the templates again, downloaded and run. So, at some point I will port everything over to the newer version. Many thanks, Zak |
Hello. I put the following site online. http://www.inforhino.co.uk/
It returned the above error. Pasting the details in at the end of the email. To resolve this, I recycled the app pool and the site is up again.
The site is live, but I still consider my site to be in beta phase, as I have lots of cosmetic and content fixes to make. My idea is to use Piranha CMS for my next phase of my property platform I am launching. Ultimately, I am working on some quite interesting features I may eventually push back into the piranha project or simply tell you guys about it.
I am trying to avoid digging into the actual Piranha CMS source as I am certain you guys are still working on it. I can add an exception page/forwarder/handler but recreating exception may prove a challenge?
I myself, try to avoid going down this path - but it may be necessary? https://docs.microsoft.com/en-us/dotnet/api/system.collections.concurrent.concurrentdictionary-2?view=netframework-4.7.2
The page cannot be displayed because an internal server error has occurred.nt; font-size: 1.2em; text-align: left; text-decoration: none; display: inline-block; border: 0; padding: 0; } .rawExceptionStackTrace { font-size: 1.2em; } .rawExceptionBlock { border-top: 1px #ddd solid; border-bottom: 1px #ddd solid; } .showRawExceptionContainer { margin-top: 10px; margin-bottom: 10px; } .expandCollapseButton { cursor: pointer; float: left; height: 16px; width: 16px; font-size: 10px; position: absolute; left: 10px; background-color: #eee; padding: 0; border: 0; margin: 0; }
An unhandled exception occurred while processing the request.
InvalidOperationException: Operations that change non-concurrent collections must have exclusive access. A concurrent update was performed on this collection and corrupted its state. The collection's state is no longer correct.
System.Collections.Generic.Dictionary<TKey, TValue>.FindEntry(TKey key)
Stack
Query
Cookies
Headers
InvalidOperationException: Operations that change non-concurrent collections must have exclusive access. A concurrent update was performed on this collection and corrupted its state. The collection's state is no longer correct.
System.Collections.Generic.Dictionary<TKey, TValue>.FindEntry(TKey key)
System.Collections.Generic.Dictionary<TKey, TValue>.TryGetValue(TKey key, out TValue value)
Piranha.Cache.MemCache.Get(string key)
Piranha.Repositories.SiteRepository.GetByHostname(string hostname)
Piranha.AspNetCore.Services.ApplicationService.Init(HttpContext context)
Piranha.AspNetCore.ApplicationMiddleware.Invoke(HttpContext context, IApi api, IApplicationService service)
Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.Invoke(HttpContext context)
Microsoft.AspNetCore.StaticFiles.StaticFileMiddleware.Invoke(HttpContext context)
Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware.Invoke(HttpContext context)
Show raw exception details
System.InvalidOperationException: Operations that change non-concurrent collections must have exclusive access. A concurrent update was performed on this collection and corrupted its state. The collection's state is no longer correct.
at System.Collections.Generic.Dictionary`2.FindEntry(TKey key)
at System.Collections.Generic.Dictionary`2.TryGetValue(TKey key, TValue& value)
at Piranha.Cache.MemCache.Get[T](String key)
at Piranha.Repositories.SiteRepository.GetByHostname(String hostname)
at Piranha.AspNetCore.Services.ApplicationService.Init(HttpContext context)
at Piranha.AspNetCore.ApplicationMiddleware.Invoke(HttpContext context, IApi api, IApplicationService service)
at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.Invoke(HttpContext context)
at Microsoft.AspNetCore.StaticFiles.StaticFileMiddleware.Invoke(HttpContext context)
at Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware.Invoke(HttpContext context)
The text was updated successfully, but these errors were encountered: