Skip to content

Duplicate Key in Enum Cache #1857

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

Closed
zeus82 opened this issue Feb 22, 2016 · 3 comments
Closed

Duplicate Key in Enum Cache #1857

zeus82 opened this issue Feb 22, 2016 · 3 comments

Comments

@zeus82
Copy link

zeus82 commented Feb 22, 2016

Looks like the enum cache is not thread safe. When our application starts up, it makes a bunch of requests and more often that not we get a duplicate key exception which traces back to the enum cache.

Here is the stack trace:

   at System.ThrowHelper.ThrowArgumentException(ExceptionResource resource)
   at System.Collections.Generic.Dictionary`2.Insert(TKey key, TValue value, Boolean add)
   at Nest.Extensions.ToEnum[T](String str) in c:\code\elasticsearch-net\src\Nest\CommonAbstractions\Extensions\Extensions.cs:line 93
   at Nest.Time..ctor(String timeUnit) in c:\code\elasticsearch-net\src\Nest\CommonOptions\TimeUnit\Time.cs:line 66
   at Nest.Time.op_Implicit(String expression) in c:\code\elasticsearch-net\src\Nest\CommonOptions\TimeUnit\Time.cs:line 26

@baddonkey
Copy link

Have exactly the same issue.

@zeus82
Copy link
Author

zeus82 commented Feb 23, 2016

I have submitted a pull request with a fix.

#1858

@Mpdreamz
Copy link
Member

doh! I thought I did a proper pass over the code to make sure this wouldn't slip in 😢

Thanks for reporting this one guys, we'll do a patch release later today.

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

4 participants