Re: [Twisted-Python] Thread Cancelled

2021-01-26 Thread Robert DiFalco
This is great Jean-Paul, see so much for me to learn. I didn't realize that you could break the propagation of Cancel errors like that. thanks! On Mon, Jan 25, 2021 at 3:51 PM Jean-Paul Calderone < exar...@twistedmatrix.com> wrote: > On Mon, Jan 25, 2021 at 5:14 PM Robert DiFalco > wrote: > >> S

Re: [Twisted-Python] Thread Cancelled

2021-01-25 Thread Jean-Paul Calderone
On Mon, Jan 25, 2021 at 5:14 PM Robert DiFalco wrote: > So I have a simple question from all this. Is there a twisted idiom I can > use so that deferred returned from a Klein route are not canceled if the > client resets the connection? It's fine if it's before I've gotten the > request body, but

Re: [Twisted-Python] Thread Cancelled

2021-01-25 Thread Robert DiFalco
So I have a simple question from all this. Is there a twisted idiom I can use so that deferred returned from a Klein route are not canceled if the client resets the connection? It's fine if it's before I've gotten the request body, but once I've gotten the request body I want all deferreds to succe

Re: [Twisted-Python] Thread Cancelled

2021-01-24 Thread Robert DiFalco
Well, I've dealt with this issue with other languages. Not sure how to deal with it in Klein/Twisted. This operation is idempotent so I suppose what I'd like to happen is have the whole chain of deferred's succeed but then just not be able to write the response to the socket -- but not interrupt th

Re: [Twisted-Python] Thread Cancelled

2021-01-24 Thread Glyph
If you're dealing with lots of clients on the public internet, sometimes this is just gonna happen, for a variety of reasons; it's normal. We would welcome better error reporting for this scenario so it doesn't require the kind of debugging you just did :-). -g > On Jan 24, 2021, at 2:58 PM,

Re: [Twisted-Python] Thread Cancelled

2021-01-24 Thread Robert DiFalco
That makes sense, thank you. A timeout seems unlikely but maybe the client is closing the connection due to a network issue. This is an extremely rare occurrence. On Sun, Jan 24, 2021 at 2:41 PM Glyph wrote: > While a socket is open and receiving data, recv() will either give you a > non-zero nu

Re: [Twisted-Python] Thread Cancelled

2021-01-24 Thread Glyph
While a socket is open and receiving data, recv() will either give you a non-zero number of bytes if bytes are ready, or an EWOULDBLOCK (AKA EAGAIN) if no bytes are ready. A result of zero bytes (the empty string) means "end of file" - the other end has closed the socket. So what's happening h

Re: [Twisted-Python] Thread Cancelled

2021-01-24 Thread Robert DiFalco
You're absolutely right, I meant "cancel the deferred". I don't grok server sockets very well so maybe someone can help. But apparently, klein does a .doRead from our server socket (getting the request from the client?). This returns a "why" of "connection done" so that closes the connection before

Re: [Twisted-Python] Thread Cancelled

2021-01-24 Thread Colin Dunklau
On Sun, Jan 24, 2021 at 11:45 AM Robert DiFalco wrote: > 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 thr

[Twisted-Python] Thread Cancelled

2021-01-24 Thread Robert DiFalco
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. VER