Hi, I apologize this question is a little vague. I'm looking for pointers.
I have a klein route that makes an underlying deferToThread call with a
simple single thread (an IO based sync call I can't change, a boto3 sqs
write). The thread pool is simple, just a couple of threads, nothing fancy.
VERY rarely it appears that Klein cancels the thread. What techniques can I
use to figure out why my thread is being Canceled? There's nothing in the
failure to tell me "who, why, or where" it was canceled. Also, I cannot get
this down to a reproducible case, but here's the boto3 sqs wrapper, this
fall back works fine, but it's a band-aide for an error I can't track down.:
def write(self, payload):
Write message to SQS async from thread pool. If twisted cancels the
thread, instead write synchronously.
if error.type != CancelledError:
log.warn("Async SQS write cancelled. Calling synchronously.")
deferredCall = self._deferToThread(self.sqs.write, payload)
def _writeSyncFallback(self, payload):
The _deferToThread call just uses my own thread pool with 2 threads, but is
Is there a level of logging I'm missing or some other thing that would tell
me why the thread is being canceled? The retry works great and Klein does
not return an error from the route.
Thanks in advance.