Re: [Twisted-Python] TaskStopped error, unsure of the cause and solution

2012-12-27 Thread Paul Wiseman
On 21 December 2012 18:08,   wrote:
> On 04:12 pm, poal...@gmail.com wrote:
>>Hey,
>>
>>I'm getting the following error in my logs (lots and lots), but only
>>after the server has been running for some time, I'm not sure what the
>>cause is or what I can do to remedy it.
>
> This seems like a bug in `Agent`, perhaps related to `stopProducing`
> being called more than once.  It would be great if you could produce a
> minimal example to include with a bug report in the issue tracker.  An
> example that reproduces the problem will also make it easier to see
> where the bug is in your code, if it happens to be there rather than in
> Twisted.

I'll try my best! The problem is I don't seem to see this at all for
10k+ requests ish then I guess something must trigger it as it will
start happening a lot, so it may be difficult to reproduce.

>
> Jean-Paul
>>This is what I see in the logs:
>>
>>2012-12-20 17:07:17+ [HTTP11ClientProtocol,client] Unhandled Error
>>Traceback (most recent call last):
>>Failure: twisted.web._newclient.RequestTransmissionFailed:
>>[>'twisted.internet.error.ConnectionDone'>>]
>>
>>2012-12-20 17:07:17+ [HTTP11ClientProtocol,client] Unexpected
>>exception from twisted.web.client.FileBodyProducer.stopProducing
>>Traceback (most recent call last):
>>  File "/usr/local/lib/python2.7/site-
>>packages/Twisted-12.2.0-py2.7-linux-
>>x86_64.egg/twisted/internet/endpoints.py",
>>line 99, in connectionLost
>>return self._wrappedProtocol.connectionLost(reason)
>>  File "/usr/local/lib/python2.7/site-
>>packages/Twisted-12.2.0-py2.7-linux-
>>x86_64.egg/twisted/web/_newclient.py",
>>line 859, in dispatcher
>>return func(*args, **kwargs)
>>  File "/usr/local/lib/python2.7/site-
>>packages/Twisted-12.2.0-py2.7-linux-
>>x86_64.egg/twisted/web/_newclient.py",
>>line 1458, in _connectionLost_TRANSMITTING
>>self._currentRequest.stopWriting()
>>  File "/usr/local/lib/python2.7/site-
>>packages/Twisted-12.2.0-py2.7-linux-
>>x86_64.egg/twisted/web/_newclient.py",
>>line 760, in stopWriting
>>_callAppFunction(self.bodyProducer.stopProducing)
>>---  ---
>>  File "/usr/local/lib/python2.7/site-
>>packages/Twisted-12.2.0-py2.7-linux-
>>x86_64.egg/twisted/web/_newclient.py",
>>line 191, in _callAppFunction
>>function()
>>  File "/usr/local/lib/python2.7/site-
>>packages/Twisted-12.2.0-py2.7-linux-x86_64.egg/twisted/web/client.py",
>>line 760, in stopProducing
>>self._task.stop()
>>  File "/usr/local/lib/python2.7/site-
>>packages/Twisted-12.2.0-py2.7-linux-
>>x86_64.egg/twisted/internet/task.py",
>>line 459, in stop
>>self._checkFinish()
>>  File "/usr/local/lib/python2.7/site-
>>packages/Twisted-12.2.0-py2.7-linux-
>>x86_64.egg/twisted/internet/task.py",
>>line 469, in _checkFinish
>>raise self._completionState
>>twisted.internet.task.TaskStopped:
>>
>>Just loads of those, they always seem to come through in pairs (the
>>first twisted.internet.error.ConnectionDone, and then the
>>twisted.internet.task.TaskStopped as above)
>>
>>I'm just doing PUT requests with twisted.web.client.Agent and using a
>>twisted.web.client.FileBodyProducer to provide the content.
>>
>>I'm doing the PUT while I still have the request from a render_GET, so
>>I thought maybe it's caused if the user disconnects while I'm doing
>>the PUT? The idea is I redirect them to the file I PUT with
>>request.redirect, which seems to work fine (until I get this error and
>>it doesn't)
>>
>>The reason I do a PUT and redirect, instead of just writing back to
>>the request is that I check if the file is in a cache first, I then
>>only PUT if it's not there- then redirect afterwards.
>>
>>Any clues or ideas of what is happening would be hugely helpful
>>
>>thanks!!
>>
>>Paul
>>
>>___
>>Twisted-Python mailing list
>>Twisted-Python@twistedmatrix.com
>>http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python
>
> ___
> Twisted-Python mailing list
> Twisted-Python@twistedmatrix.com
> http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python

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


[Twisted-Python] Need help using FTPClient

2012-12-27 Thread Master Corp
Hi. I am new to Twisted. I am using this code:

 
http://twistedmatrix.com/documents/current/core/examples/ftpclient.py

Can this example be used to connect to an FTP through a SOCKS4/5 proxy? Can
somebody provide an example of how it should be done?

Thanks
___
Twisted-Python mailing list
Twisted-Python@twistedmatrix.com
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python


[Twisted-Python] Weird SSL/TLS issue

2012-12-27 Thread Jason J. W. Williams
We have an application that uses Twisted Web to listen for an API call and
when it receives it, the app then connects over SMTP to the specified mail
server IP and validates whether the indicated user exists. The app has been
running without issue or modification for close to 2 years (uses Twisted
10.2.0). Then suddenly last night it started being unable to find the
starttls() method on the Connection object when negotiating with any mail
server:

https://gist.github.com/4391179

We were able to replicate the problem consistently, and determine it was
not a network issue. The weird part is that simply restarting the
application cleared the issue and TLS SMTP connections were able to be made
again. Since the Twisted modules were loaded at startup, I'm a little
confused on how it suddenly decided  the TLS methods were missing until we
restarted.

Any ideas are greatly appreciated.

-J
___
Twisted-Python mailing list
Twisted-Python@twistedmatrix.com
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python


Re: [Twisted-Python] Need help using FTPClient

2012-12-27 Thread Glyph

On Dec 27, 2012, at 9:33 AM, Master Corp  wrote:

> Hi. I am new to Twisted. I am using this code:
> 
>  http://twistedmatrix.com/documents/current/core/examples/ftpclient.py
> 
> Can this example be used to connect to an FTP through a SOCKS4/5 proxy? Can 
> somebody provide an example of how it should be done?
> 

Is there any reason you want to use Twisted to do your SOCKS proxying?  
Programs like 'socksify' typically do what you need in a general way that does 
not require any awareness from your application.  (Twisted does have a SOCKS 
implementation, but it's rarely worth the trouble to plug it in.)

-glyph


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


Re: [Twisted-Python] Weird SSL/TLS issue

2012-12-27 Thread Itamar Turner-Trauring
On Thu, Dec 27, 2012 at 2:23 PM, Jason J. W. Williams <
jasonjwwilli...@gmail.com> wrote:

> We have an application that uses Twisted Web to listen for an API call and
> when it receives it, the app then connects over SMTP to the specified mail
> server IP and validates whether the indicated user exists. The app has been
> running without issue or modification for close to 2 years (uses Twisted
> 10.2.0). Then suddenly last night it started being unable to find the
> starttls() method on the Connection object when negotiating with any mail
> server:
>
> https://gist.github.com/4391179
>
> We were able to replicate the problem consistently, and determine it was
> not a network issue. The weird part is that simply restarting the
> application cleared the issue and TLS SMTP connections were able to be made
> again. Since the Twisted modules were loaded at startup, I'm a little
> confused on how it suddenly decided  the TLS methods were missing until we
> restarted.
>


Do you have any code that runs reload(), or twisted.python.rebuild, or
maybe did that manually in a Manhole session? Given how tcp.py is written
that's the only thing I can think of, at least.

Or maybe it's cosmic rays (got ECC RAM?)/hardware problems/memory
corruption. I've seen some utterly impossible Python tracebacks that had to
have been something like these catchalls, which isn't very satisfying an
answer.


-- 
Itamar Turner-Trauring, Future Foundries LLC
http://futurefoundries.com/ — Twisted consulting, training and support.
___
Twisted-Python mailing list
Twisted-Python@twistedmatrix.com
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python