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

FIX: potential duplicate log entry due to race condition #323

Merged
merged 1 commit into from
Aug 25, 2020

Conversation

kkonrad
Copy link

@kkonrad kkonrad commented Aug 24, 2020

There was potentially race condition that could lead to situation in which we could get multiple log entries regarding the same keyword being unknown. Such case was when more than one thread was doing check on containsKey before they went into put.

Simple fix for this is to always add element to the UNKNOWN_KEYWORDS map and than check if it was present. See documentation for put method and what value it returns. Doing this that way shouldn't impact performance.

@codecov-commenter
Copy link

Codecov Report

Merging #323 into master will decrease coverage by 0.01%.
The diff coverage is 100.00%.

Impacted file tree graph

@@             Coverage Diff              @@
##             master     #323      +/-   ##
============================================
- Coverage     70.80%   70.79%   -0.02%     
  Complexity      652      652              
============================================
  Files            75       75              
  Lines          2497     2496       -1     
  Branches        529      529              
============================================
- Hits           1768     1767       -1     
  Misses          525      525              
  Partials        204      204              
Impacted Files Coverage Δ Complexity Δ
...main/java/com/networknt/schema/JsonMetaSchema.java 83.33% <100.00%> (-0.12%) 16.00 <0.00> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update f841582...24511a6. Read the comment docs.

@stevehu stevehu merged commit e0e1b02 into networknt:master Aug 25, 2020
@stevehu
Copy link
Contributor

stevehu commented Aug 25, 2020

@kkonrad Thanks a lot for your help.

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

Successfully merging this pull request may close these issues.

3 participants