[Twisted-Python] file descriptor cannot be a negative integer (-1)
ruslan usifov
ruslan.usifov at gmail.com
Fri Sep 17 20:21:59 EDT 2010
Sorry fo my question. I'm new in twisted ad may misunderstand some
things:-), and my questions may look like trivial
I have follow stack trace:
cant connect to fcgi socket: [Failure instance: Traceback: <type
'exceptions.ValueError'>: file descriptor can not be a negative integer (-1)
/usr/local/lib/python2.6/site-packages/twisted/internet/base.py:796:runUntilCurrent
/usr/local/lib/python2.6/site-packages/twisted/internet/protocol.py:184:fire
/usr/local/lib/python2.6/site-packages/twisted/internet/defer.py:318:callback
/usr/local/lib/python2.6/site-packages/twisted/internet/defer.py:424:_startRunCallbacks
--- <exception caught here> ---
/usr/local/lib/python2.6/site-packages/twisted/internet/defer.py:441:_runCallbacks
/usr/local/fastcgi-0.1/fcgi/proxy.py:124:connectionMade
/usr/local/lib/python2.6/site-packages/twisted/internet/abstract.py:340:resumeProducing
/usr/local/lib/python2.6/site-packages/twisted/internet/abstract.py:278:startReading
/usr/local/lib/python2.6/site-packages/twisted/internet/kqreactor.py:82:addReader
/usr/local/lib/python2.6/site-packages/twisted/internet/kqreactor.py:71:_updateRegistration
]
My connectionMade function looks like this:
def connectionMade(protocol):
protocol._setPeer(self);
self._setPeer(protocol);
for chunk in self._chunks:
protocol.transport.write(chunk);
self._chunks = [];
self.transport.resumeProducing();
All code that i use look like this:
def proxy(self):
def connectionMade(protocol):
protocol._setPeer(self);
self._setPeer(protocol);
for chunk in self._chunks:
protocol.transport.write(chunk);
self._chunks = [];
self.transport.resumeProducing();
def cantConnect(fail):
log.err("cant connect to fcgi socket: %s" % (fail.getErrorMessage()));
self.transport.loseConnection();
#устанавливаем соединение с реальным обработчиком (в нашем случае это
php)
self.transport.pauseProducing();
l_client = protocol.ClientCreator(reactor, Proxy);
l_client.connectUNIX(self.factory.proxysock).addCallback(connectionMade).addErrback(cantConnect);
Its a simply fastcgi proxy, which reads all request(analize it, do some
pending things and then proxy request to real worker)
Thank for your help.
PS: i use kqreactor.py from this branch
http://twistedmatrix.com/trac/browser/branches/kqreactor-1918-3/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://twistedmatrix.com/pipermail/twisted-python/attachments/20100918/f236a8b5/attachment.htm
More information about the Twisted-Python
mailing list