Re: [Twisted-Python] Klein?

2021-03-04 Thread Robert DiFalco
uest_code), "status_code_class:{}xx".format(status_code_class), ] metrics.timing("my.rest.endpoint", elapsed, tags=tags) I don't have it quite right yet. It's hard to get the status code, deal with unhandled exceptions, etc. But I'll post questions here when I

[Twisted-Python] Klein?

2021-03-01 Thread Robert DiFalco
Is this the right place to ask klein questions? I'm writing a metrics plugin for Klein and I can't figure out how to inject a metrics handler so that I can get route, path, duration, and status code. What I'm doing now sucks because Klein and twisted interact in complex ways on Failure and status c

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 Di

Re: [Twisted-Python] Thread Cancelled

2021-01-25 Thread Robert DiFalco
ant all deferreds to succeed. I only wan't the streaming of the final result to fail. On Sun, Jan 24, 2021 at 7:40 PM Robert DiFalco wrote: > 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 suppo

Re: [Twisted-Python] Thread Cancelled

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

Re: [Twisted-Python] Thread Cancelled

2021-01-24 Thread Robert DiFalco
gt; canceling its request by closing the socket, and this is the correct, > intentional response to that scenario. > > -g > > On Jan 24, 2021, at 11:57 AM, Robert DiFalco > wrote: > > You're absolutely right, I meant "cancel the deferred". I don't grok &g

Re: [Twisted-Python] Thread Cancelled

2021-01-24 Thread Robert DiFalco
s the read getting an empty string and closing the connection? I can't really account for it? Some kind of back pressure due to load? Thanks for any thoughts. On Sun, Jan 24, 2021 at 11:32 AM Colin Dunklau wrote: > > > On Sun, Jan 24, 2021 at 11:45 AM Robert DiFalco > wrote: &g

[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

Re: [Twisted-Python] Logging and SpawnProcess

2020-12-30 Thread Robert DiFalco
that you might find the implementation > of twisted.internet.endpoints.ProcessEndpoint a useful example. It relays > stderr to the logging stream: > https://github.com/twisted/twisted/blob/c8064075a207af1fc9ce19d8f885a986bc5ab00c/src/twisted/internet/endpoints.py#L336-L479 > > ---Tom

[Twisted-Python] Logging and SpawnProcess

2020-12-30 Thread Robert DiFalco
Can anyone point me to some sample code for handling logging with SpawnProcess? Right now I'm using an EchoProtocol that takes stdout and resends it to the log. But it's kludgy because some sub-processes use stdin/stderr for marshaling data. What I'd most like to do is separate data transfer from l

Re: [Twisted-Python] More Conch Questions

2020-11-30 Thread Robert DiFalco
Alright, it's a but in twisted. How do I report twisted bugs? Under python3 service.name is bytes and not a string. https://github.com/twisted/twisted/blob/trunk/src/twisted/conch/client/direct.py#L86 On Mon, Nov 30, 2020 at 4:00 PM Robert DiFalco wrote: > Ok, my solution is to re-w

Re: [Twisted-Python] More Conch Questions

2020-11-30 Thread Robert DiFalco
t;], factory) return d_authorized.addCallback(lambda ignore: factory) On Sun, Nov 29, 2020 at 9:41 AM Robert DiFalco wrote: > I'm continuing to wrestle with conch, this time around authentication and > notifying deferred of auth failure. > > It seems like the SSH fac

[Twisted-Python] More Conch Questions

2020-11-29 Thread Robert DiFalco
I'm continuing to wrestle with conch, this time around authentication and notifying deferred of auth failure. It seems like the SSH factory has a deferred to be notified of auth failures here: https://github.com/twisted/twisted/blob/trunk/src/twisted/conch/client/direct.py#L61-L66 Unfortunately,

Re: [Twisted-Python] Retry: Conch Issues

2020-09-25 Thread Robert DiFalco
bug for the next release. https://github.com/radifalco/conch_issues/commit/c25aa6bca20201f51d59c3a6dca4c1fb2aed2242?branch=c25aa6bca20201f51d59c3a6dca4c1fb2aed2242&diff=split On Fri, Sep 25, 2020 at 7:42 AM Robert DiFalco wrote: > I agree it's a bug in conch and I believe my

Re: [Twisted-Python] Retry: Conch Issues

2020-09-25 Thread Robert DiFalco
020 at 8:54 PM Robert DiFalco > wrote: > >> Why exactly is makeDirectory not firing any callbacks or errbacks and >> what can I add at the Factory level to make it do so? >> > > class MySSHClientFactory(SSHClientFactory): >> def clientConnectionLost(self, connec

Re: [Twisted-Python] Retry: Conch Issues

2020-09-24 Thread Robert DiFalco
5:36 PM Adi Roiban wrote: > Hi > > On Fri, 25 Sep 2020 at 00:15, Robert DiFalco > wrote: > >> I am having troubles with Conch. I've been able to reproduce them in a >> unit test and all the code is here along with requirements.txt: >>https://github.com/radifal

[Twisted-Python] Retry: Conch Issues

2020-09-24 Thread Robert DiFalco
I am having troubles with Conch. I've been able to reproduce them in a unit test and all the code is here along with requirements.txt: https://github.com/radifalco/conch_issues I'm trying to reuse my connection, but if it is idle too long the server shuts it down. What I don't understand is why

Re: [Twisted-Python] Conch SFTP Questions

2020-09-24 Thread Robert DiFalco
On Wed, Sep 23, 2020 at 9:43 AM Glyph wrote: > > On Sep 22, 2020, at 3:47 PM, Robert DiFalco > wrote: > > Thanks! That is the full code. `connect` is from the conch library. > > > To clarify Adi's comment somewhat, the "full" code would mean following

Re: [Twisted-Python] Conch SFTP Questions

2020-09-22 Thread Robert DiFalco
Thanks! That is the full code. `connect` is from the conch library. On Tue, Sep 22, 2020 at 12:57 PM Adi Roiban wrote: > Hi Robers > > On Tue, 22 Sep 2020 at 16:43, Robert DiFalco > wrote: > >> Hey folks, I've cobbled together an SFTP client based on bits and piece

[Twisted-Python] Conch SFTP Questions

2020-09-22 Thread Robert DiFalco
Hey folks, I've cobbled together an SFTP client based on bits and pieces I've found around the web. The issue is that it appears to be almost one shot. I will need to send many files (the number not known ahead of time). It's not clear to me when the connection is closed or how many factories I'm c

Re: [Twisted-Python] Weird epoller bug

2019-12-17 Thread Robert DiFalco
self.transport.abortConnection() self._disconnectParser(Failure(CancelledError())) self._finishedRequest = Deferred(cancelRequest) On Tue, Dec 17, 2019 at 11:19 AM Robert DiFalco wrote: > I have a theory that since this runs every 20 seconds that it is falling &

Re: [Twisted-Python] Weird epoller bug

2019-12-17 Thread Robert DiFalco
I have a theory that since this runs every 20 seconds that it is falling behind somehow. Ulimits is too low, twisted is maybe eating the too many file handles exception and then trying to close a handle that doesn't actually exist. Dunno. On Tue, Dec 17, 2019 at 10:18 AM Robert DiFalco

[Twisted-Python] Weird epoller bug

2019-12-17 Thread Robert DiFalco
We recently switched from these versions and recently our TLS health check using treq seems to be using more and more file handles and getting this exception. Additionally our health check gets response time outs at a much higher frequency. Any tips on how I would go about debugging this? Or is thi

Re: [Twisted-Python] Issue with TLS failure modes

2018-09-05 Thread Robert DiFalco
Is the timeout the only way to handle this kind of TLS handshake error? Sent from my iPhone > On Aug 30, 2018, at 10:14 AM, Robert DiFalco wrote: > > I'm having an issue properly handling TLS failure modes. For example consider > the EchoServer and EchoClient code. If I use

[Twisted-Python] Issue with TLS failure modes

2018-08-30 Thread Robert DiFalco
I'm having an issue properly handling TLS failure modes. For example consider the EchoServer and EchoClient code. If I use a TLS client with a TCP4 server, I do not get a handshake exception until I abort the connection. But I don't want to abort the connection unless I get a handshake error. What