Skip to content

Commit

Permalink
Fix for race condition
Browse files Browse the repository at this point in the history
  • Loading branch information
andresriancho committed May 6, 2019
1 parent 717d42e commit 0266c12
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions w3af/core/controllers/core_helpers/not_found/decorators.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,21 @@ def __call__(self, *args, **kwargs):
result = self._function(*args, **kwargs)

# Save the result to both caches
self._is_404_by_url_lru[url_cache_key] = result
self._is_404_by_body_lru[body_cache_key] = result
try:
self._is_404_by_body_lru[body_cache_key] = result
except (AttributeError, AssertionError, KeyError) as _:
# This is a rare race conditions which happens when another
# thread modifies the cache and changes the __first item in
# the cache.
pass

try:
self._is_404_by_url_lru[url_cache_key] = result
except (AttributeError, AssertionError, KeyError) as _:
# This is a rare race conditions which happens when another
# thread modifies the cache and changes the __first item in
# the cache.
pass

return result

Expand Down

0 comments on commit 0266c12

Please sign in to comment.