Opened 12 years ago

Closed 10 years ago

#1412 defect closed duplicate (duplicate)

ExpatError on xmlrpc client connection close

Reported by: kkinder Owned by:
Priority: high Milestone:
Component: web Keywords:
Cc: jknight, kkinder Branch:
Author:

Description


Change History (3)

comment:1 Changed 12 years ago by kkinder

Upon using the twisted.web.xmlrpc.Proxy class, if you have an active HTTP
session that is closed mid-stream, you get this exception:

Traceback (most recent call last):
  File "test.py", line 20, in ?
    reactor.run()
  File "/usr/lib/python2.4/site-packages/twisted/internet/posixbase.py", line
206, in run
    self.mainLoop()
  File "/usr/lib/python2.4/site-packages/twisted/internet/posixbase.py", line
217, in mainLoop
    self.doIteration(t)
  File "/usr/lib/python2.4/site-packages/twisted/internet/selectreactor.py",
line 133, in doSelect
    _logrun(selectable, _drdw, selectable, method, dict)
--- <exception caught here> ---
  File "/usr/lib/python2.4/site-packages/twisted/python/log.py", line 58, in
callWithLogger
    return callWithContext({"system": lp}, func, *args, **kw)
  File "/usr/lib/python2.4/site-packages/twisted/python/log.py", line 43, in
callWithContext
    return context.call({ILogContext: newCtx}, func, *args, **kw)
  File "/usr/lib/python2.4/site-packages/twisted/python/context.py", line 59, in
callWithContext
    return self.currentContext().callWithContext(ctx, func, *args, **kw)
  File "/usr/lib/python2.4/site-packages/twisted/python/context.py", line 37, in
callWithContext
    return func(*args,**kw)
  File "/usr/lib/python2.4/site-packages/twisted/internet/selectreactor.py",
line 149, in _doReadOrWrite
    self._disconnectSelectable(selectable, why, method=="doRead")
  File "/usr/lib/python2.4/site-packages/twisted/internet/posixbase.py", line
238, in _disconnectSelectable
    selectable.readConnectionLost(f)
  File "/usr/lib/python2.4/site-packages/twisted/internet/tcp.py", line 390, in
readConnectionLost
    self.connectionLost(reason)
  File "/usr/lib/python2.4/site-packages/twisted/internet/tcp.py", line 555, in
connectionLost
    Connection.connectionLost(self, reason)
  File "/usr/lib/python2.4/site-packages/twisted/internet/tcp.py", line 401, in
connectionLost
    protocol.connectionLost(reason)
  File "/usr/lib/python2.4/site-packages/twisted/web/http.py", line 351, in
connectionLost
    self.handleResponseEnd()
  File "/usr/lib/python2.4/site-packages/twisted/web/http.py", line 357, in
handleResponseEnd
    self.handleResponse(b)
  File "/usr/lib/python2.4/site-packages/twisted/web/xmlrpc.py", line 259, in
handleResponse
    self.factory.parseResponse(contents)
  File "/usr/lib/python2.4/site-packages/twisted/web/xmlrpc.py", line 284, in
parseResponse
    response = xmlrpclib.loads(contents)
  File "/usr/lib/python2.4/xmlrpclib.py", line 1080, in loads
    p.close()
  File "/usr/lib/python2.4/xmlrpclib.py", line 530, in close
    self._parser.Parse("", 1) # end of data
xml.parsers.expat.ExpatError: no element found: line 1, column 0

Ostensibly, this is because Twisted decides to parse the returned value even
though the connection was closed. Then, it fails to catch this exception in the
Query class.

comment:2 Changed 10 years ago by Jean-Paul Calderone

Resolution: duplicate
Status: newclosed

This is basically a duplicate of #883, although #872 is a bit related as well. Both are resolved now.

comment:3 Changed 7 years ago by <automation>

Owner: jknight deleted
Note: See TracTickets for help on using tickets.