Skip to content

Commit

Permalink
Fixes race condition
Browse files Browse the repository at this point in the history
  • Loading branch information
andresriancho committed May 22, 2019
1 parent 58eb364 commit 9ba00d0
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion w3af/core/controllers/core_helpers/not_found/decorators.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,13 @@ def __call__(self, *args, **kwargs):
body_cache_key = self._response_cache_key_cache.get_response_cache_key(http_response,
clean_response=query)

result = self._is_404_by_body_lru.get(body_cache_key, None)
try:
result = self._is_404_by_body_lru.get(body_cache_key, None)
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.
result = None

if result is not None:
self._log_success(http_response, result, 'body')
Expand Down

0 comments on commit 9ba00d0

Please sign in to comment.