Re: [Twisted-Python] Retry: Conch Issues

2020-09-25 Thread Jean-Paul Calderone
On Thu, Sep 24, 2020 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, connector, reason):
> self.op.addErrback(reason)
>
> def makeDirectory(self, path, attrs):
> self.op = Deferred()
> def _cbSuccess(result):
> self.op.callback(result)
>
> return self.sftpClient.makeDirectory(path, 
> attrs).addCallback(_cbSuccess)d
>
>
This code is wrong.  It takes what *may* be a perfectly good Deferred from
makeDirectory and breaks the error chain off of it.  The correct way to do
this would be more like `makeDirectory(...).chainDeferred(self.op)`.
However, `self.op` and `_cbSuccess` are doing nothing useful here so you
may as well just delete all that and return the `makeDirectory(...)`
Deferred.

If *that* Deferred doesn't fire its errback chain when the connection is
closed, that's a bug in Conch.  If you can put together a minimal example
and file a ticket, that would be wonderful and perhaps someone can get it
fixed for you.

Jean-Paul
___
Twisted-Python mailing list
Twisted-Python@twistedmatrix.com
https://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python


Re: [Twisted-Python] Retry: Conch Issues

2020-09-25 Thread Robert DiFalco
I agree it's a bug in conch and I believe my repo shows a reproducible
example. Run the test, it never completes because the deferred from
`makeDirectory` never fires. .

On Fri, Sep 25, 2020 at 3:41 AM Jean-Paul Calderone <
exar...@twistedmatrix.com> wrote:

> On Thu, Sep 24, 2020 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, connector, reason):
>> self.op.addErrback(reason)
>>
>> def makeDirectory(self, path, attrs):
>> self.op = Deferred()
>> def _cbSuccess(result):
>> self.op.callback(result)
>>
>> return self.sftpClient.makeDirectory(path, 
>> attrs).addCallback(_cbSuccess)d
>>
>>
> This code is wrong.  It takes what *may* be a perfectly good Deferred
> from makeDirectory and breaks the error chain off of it.  The correct way
> to do this would be more like `makeDirectory(...).chainDeferred(self.op)`.
> However, `self.op` and `_cbSuccess` are doing nothing useful here so you
> may as well just delete all that and return the `makeDirectory(...)`
> Deferred.
>
> If *that* Deferred doesn't fire its errback chain when the connection is
> closed, that's a bug in Conch.  If you can put together a minimal example
> and file a ticket, that would be wonderful and perhaps someone can get it
> fixed for you.
>
> Jean-Paul
> ___
> Twisted-Python mailing list
> Twisted-Python@twistedmatrix.com
> https://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python
>
___
Twisted-Python mailing list
Twisted-Python@twistedmatrix.com
https://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python


Re: [Twisted-Python] Retry: Conch Issues

2020-09-25 Thread Robert DiFalco
My work around for the twisted/conch bug if anyone is interested.
FileTransferHandler was not handling closed connections properly. Btw, this
is with release version 20.3.0, which seems to be the latest version.
However, if I look in the Twisted repo it looks like someone is trying to
address this 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 repo shows a reproducible
> example. Run the test, it never completes because the deferred from
> `makeDirectory` never fires. .
>
> On Fri, Sep 25, 2020 at 3:41 AM Jean-Paul Calderone <
> exar...@twistedmatrix.com> wrote:
>
>> On Thu, Sep 24, 2020 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, connector, reason):
>>> self.op.addErrback(reason)
>>>
>>> def makeDirectory(self, path, attrs):
>>> self.op = Deferred()
>>> def _cbSuccess(result):
>>> self.op.callback(result)
>>>
>>> return self.sftpClient.makeDirectory(path, 
>>> attrs).addCallback(_cbSuccess)d
>>>
>>>
>> This code is wrong.  It takes what *may* be a perfectly good Deferred
>> from makeDirectory and breaks the error chain off of it.  The correct way
>> to do this would be more like `makeDirectory(...).chainDeferred(self.op)`.
>> However, `self.op` and `_cbSuccess` are doing nothing useful here so you
>> may as well just delete all that and return the `makeDirectory(...)`
>> Deferred.
>>
>> If *that* Deferred doesn't fire its errback chain when the connection is
>> closed, that's a bug in Conch.  If you can put together a minimal example
>> and file a ticket, that would be wonderful and perhaps someone can get it
>> fixed for you.
>>
>> Jean-Paul
>> ___
>> Twisted-Python mailing list
>> Twisted-Python@twistedmatrix.com
>> https://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python
>>
>
___
Twisted-Python mailing list
Twisted-Python@twistedmatrix.com
https://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python