Patrick Ohly changed bug 57214
What Removed Added
Status NEW ASSIGNED

Comment # 1 on bug 57214 from
(In reply to comment #0)
> I just realised, while debugging my auth problems from bug 56240 that
> SyncEvolution can't be interrupted if the server misbehaves.
> 
> I my case, I tried to set up a simple digest auth server like so:
> 
>  1) pip install  -E /tmp/cyclone -e
> git+https://github.com/fiorix/cyclone.git/#egg=cyclone
>  2) apply the following diff, i.e.
>     cd /tmp/cyclone/src/cyclone/; patch -p1 <<EOF
> 
> diff --git a/demos/digest_auth/authdemo.py b/demos/digest_auth/authdemo.py
> index 020e6ef..e89561a 100755
> --- a/demos/digest_auth/authdemo.py
> +++ b/demos/digest_auth/authdemo.py
> @@ -31,7 +31,7 @@ from twisted.internet import reactor
>  class Application(cyclone.web.Application):
>      def __init__(self):
>          handlers = [
> -            (r"/", MainHandler),
> +            (r".*$", MainHandler),
>          ]
>          settings = dict(
>              cookie_secret="32oETzKXQAGaYdkL5gEmGeJJFuYh7EQnp2XdTP1o/Vo=",
> @@ -40,8 +40,9 @@ class Application(cyclone.web.Application):
>          )
>          cyclone.web.Application.__init__(self, handlers, **settings)
>  
> -
>  class MainHandler(digest.DigestAuthMixin, cyclone.web.RequestHandler):
> +    SUPPORTED_METHODS = cyclone.web.RequestHandler.SUPPORTED_METHODS +
> ('PROPFIND',)
> +    
>      def passwordz(username):
>          creds = {
>                  'auth_username': 'test',
> 
> EOF
> 
> 
>  3) run the authdemo.py: /tmp/cyclone/bin/python
> /tmp/cyclone/src/cyclone/demos/digest_auth/authdemo.py
> 
>  4) Have the setup routine from bug 56263 comment #0 run with
> URL="http://localhost:8888/foo/bar"
> 
>  5) then run syncevolution --daemon=no  target-config@radicale cards1
>  
> 
> The server should crash like this: 
>  
> 
> $ ./authdemo.py 2012-11-17 02:20:22+0100 [-] Log opened.
> 2012-11-17 02:20:22+0100 [-] Application starting on 8889
> 2012-11-17 02:20:22+0100 [-] Starting factory <__main__.Application instance
> at 0x1464b90>
> 2012-11-17 02:20:23+0100 [HTTPConnection,0,127.0.0.1] 401 GET
> /foo/bar/cardss (127.0.0.1) 0.78ms
> 2012-11-17 02:20:25+0100 [HTTPConnection,1,127.0.0.1] 401 GET /foo/bar/c
> (127.0.0.1) 0.38ms
> 2012-11-17 02:20:28+0100 [HTTPConnection,2,127.0.0.1] Unhandled error in
> Deferred:
> 2012-11-17 02:20:28+0100 [HTTPConnection,2,127.0.0.1] Unhandled Error
> 	Traceback (most recent call last):
> 	  File "/tmp/cyclone2/src/cyclone/cyclone/httpserver.py", line 185, in
> _on_request_body
> 	    self.request_callback(self._request)
> 	  File "/tmp/cyclone2/src/cyclone/cyclone/web.py", line 1358, in __call__
> 	    handler._execute(transforms, *args, **kwargs)
> 	  File "/tmp/cyclone2/src/cyclone/cyclone/web.py", line 958, in _execute
> 	    callbackArgs=(args, kwargs))
> 	  File
> "/tmp/cyclone2/lib/python2.7/site-packages/twisted/internet/defer.py", line
> 290, in addCallbacks
> 	    self._runCallbacks()
> 	--- <exception caught here> ---
> 	  File
> "/tmp/cyclone2/lib/python2.7/site-packages/twisted/internet/defer.py", line
> 551, in _runCallbacks
> 	    current.result = callback(current.result, *args, **kw)
> 	  File "/tmp/cyclone2/src/cyclone/cyclone/web.py", line 967, in
> _execute_handler
> 	    function = getattr(self, self.request.method.lower())
> 	exceptions.AttributeError: 'MainHandler' object has no attribute 'propfind'

If that happens, does it keep the TCP connection to the SyncEvolution client
open? I wonder why libneon doesn't notice the problem.

> And syncevolution blocks, i.e. SIGINT (Ctrl+C) doesn't help it to exit. I
> would have expected to be able to press Ctrl+C to make it return at some
> stage.

Agree, that would be nice. The problem is that libneon doesn't (easily) support
integration with an event loop, so once a request is sent, SyncEvolution can
only wait for it to complete. I've not found a way to tell libneon that it
should abort the currently running request.

There is a mechanisms in SyncEvolution for letting a backend check for abort
requests (see the SuspendFlags class) either in polling mode or via an event,
but that doesn't help here because SyncEvolution doesn't get the chance to
check either of these.


You are receiving this mail because: