# Buggy code
def getChild(self, path, request):
    """
    Create and return a proxy resource with the same proxy configuration
    as this one, except that its path also contains the segment given by
    path at the end.

    Args:
        path (str): Url path.
        request (Request object): Incoming request.

    Return:
        resource (EvenniaReverseProxyResource): A proxy resource.

    """
    return EvenniaReverseProxyResource(
        self.host, self.port, self.path + "/" + urlquote(path, safe=""), self.reactor
    )


# Traceback (exceptions.RuntimeError)
2017-02-05T00:12:46-0500 [ProxyClient,client] Unhandled Error
Traceback (most recent call last):
File "/home/tehom/arx/local/lib/python2.7/site-packages/twisted/application/app.py", line 310, in runReactorWithLogging
reactor.run()
File "/home/tehom/arx/local/lib/python2.7/site-packages/twisted/internet/base.py", line 1195, in run
self.mainLoop()
File "/home/tehom/arx/local/lib/python2.7/site-packages/twisted/internet/base.py", line 1207, in mainLoop
self.doIteration(t)
File "/home/tehom/arx/local/lib/python2.7/site-packages/twisted/internet/epollreactor.py", line 396, in doPoll
log.callWithLogger(selectable, _drdw, selectable, fd, event)
--- <exception caught here> ---
File "/home/tehom/arx/local/lib/python2.7/site-packages/twisted/python/log.py", line 101, in callWithLogger
return callWithContext({"system": lp}, func, *args, **kw)
File "/home/tehom/arx/local/lib/python2.7/site-packages/twisted/python/log.py", line 84, in callWithContext
return context.call({ILogContext: newCtx}, func, *args, **kw)
File "/home/tehom/arx/local/lib/python2.7/site-packages/twisted/python/context.py", line 118, in callWithContext
return self.currentContext().callWithContext(ctx, func, *args, **kw)
File "/home/tehom/arx/local/lib/python2.7/site-packages/twisted/python/context.py", line 81, in callWithContext
return func(*args,**kw)
File "/home/tehom/arx/local/lib/python2.7/site-packages/twisted/internet/posixbase.py", line 610, in _doReadOrWrite
self._disconnectSelectable(selectable, why, inRead)
File "/home/tehom/arx/local/lib/python2.7/site-packages/twisted/internet/posixbase.py", line 252, in _disconnectSelectable
selectable.readConnectionLost(f)
File "/home/tehom/arx/local/lib/python2.7/site-packages/twisted/internet/tcp.py", line 272, in readConnectionLost
self.connectionLost(reason)
File "/home/tehom/arx/local/lib/python2.7/site-packages/twisted/internet/tcp.py", line 478, in connectionLost
self._commonConnection.connectionLost(self, reason)
File "/home/tehom/arx/local/lib/python2.7/site-packages/twisted/internet/tcp.py", line 292, in connectionLost
protocol.connectionLost(reason)
File "/home/tehom/arx/local/lib/python2.7/site-packages/twisted/web/http.py", line 486, in connectionLost
self.handleResponseEnd()
File "/home/tehom/arx/local/lib/python2.7/site-packages/twisted/web/proxy.py", line 87, in handleResponseEnd
self.father.finish()
File "/home/tehom/arx/local/lib/python2.7/site-packages/twisted/web/server.py", line 231, in finish
return http.Request.finish(self)
File "/home/tehom/arx/local/lib/python2.7/site-packages/twisted/web/http.py", line 863, in finish
"Request.finish called on a request after its connection was lost; "
exceptions.RuntimeError: Request.finish called on a request after its connection was lost; use Request.notifyFinish to keep track of this.

# Fixed code
def getChild(self, path, request):
    """
    Create and return a proxy resource with the same proxy configuration
    as this one, except that its path also contains the segment given by
    path at the end.

    Args:
        path (str): Url path.
        request (Request object): Incoming request.

    Return:
        resource (EvenniaReverseProxyResource): A proxy resource.

    """
    request.notifyFinish().addErrback(lambda f: f.cancel())
    return EvenniaReverseProxyResource(
        self.host, self.port, self.path + "/" + urlquote(path, safe=""), self.reactor
    )