Add a delay to key lookup lock release to fix stack overflow
A tactical call_later here should fix #5723
This commit is contained in:
parent
c7095be913
commit
dcca56baba
|
@ -259,6 +259,10 @@ class Keyring(object):
|
||||||
|
|
||||||
# When we've finished fetching all the keys for a given server_name,
|
# When we've finished fetching all the keys for a given server_name,
|
||||||
# drop the lock by resolving the deferred in key_downloads.
|
# drop the lock by resolving the deferred in key_downloads.
|
||||||
|
def drop_server_lock(server_name):
|
||||||
|
d = self.key_downloads.pop(server_name)
|
||||||
|
d.callback(None)
|
||||||
|
|
||||||
def lookup_done(res, verify_request):
|
def lookup_done(res, verify_request):
|
||||||
server_name = verify_request.server_name
|
server_name = verify_request.server_name
|
||||||
server_requests = server_to_request_ids[server_name]
|
server_requests = server_to_request_ids[server_name]
|
||||||
|
@ -269,8 +273,10 @@ class Keyring(object):
|
||||||
with PreserveLoggingContext(ctx):
|
with PreserveLoggingContext(ctx):
|
||||||
logger.debug("Releasing key lookup lock on %s", server_name)
|
logger.debug("Releasing key lookup lock on %s", server_name)
|
||||||
|
|
||||||
d = self.key_downloads.pop(server_name)
|
# ... but not immediately, as that can cause stack explosions if
|
||||||
d.callback(None)
|
# we get a long queue of lookups.
|
||||||
|
self.clock.call_later(0, drop_server_lock, server_name)
|
||||||
|
|
||||||
return res
|
return res
|
||||||
|
|
||||||
for verify_request in verify_requests:
|
for verify_request in verify_requests:
|
||||||
|
|
Loading…
Reference in New Issue