apple / ccs-calendarserver

The Calendar and Contacts Server.
https://www.calendarserver.org
Apache License 2.0
486 stars 136 forks source link

Internal Server Error on sync-report with invalid sync-token #365

Closed macosforgebot closed 11 years ago

macosforgebot commented 12 years ago

mail@… originally submitted this as ticket:473


Andrew just debugged aCal against my Calendar Server and we found that it crashes when sending an invalid sync-token in the sync-report.

    2012-01-19 11:09:11+0100 [-] [caldav-0]  [PooledMemCacheProtocol,client] [twistedcaldav.memcachepool.MemCachePool#debug] Clients #free: 5, #busy: 0, #pending: 0, #queued: 0
    2012-01-19 11:09:11+0100 [-] [caldav-0]  [-] [twext.web2.server#info] Exception rendering:
    2012-01-19 11:09:11+0100 [-] [caldav-0]  [-] [twext.web2.server#error] [Failure instance: Traceback: <type 'exceptions.ValueError'>: invalid literal for int() with base 10: 'None'
    2012-01-19 11:09:11+0100 [-] [caldav-0]         /usr/lib64/python2.7/site-packages/twisted/internet/defer.py:388:errback
    2012-01-19 11:09:11+0100 [-] [caldav-0]         /usr/lib64/python2.7/site-packages/twisted/internet/defer.py:455:_startRunCallbacks
    2012-01-19 11:09:11+0100 [-] [caldav-0]         /usr/lib64/python2.7/site-packages/twisted/internet/defer.py:542:_runCallbacks
    2012-01-19 11:09:11+0100 [-] [caldav-0]         /usr/lib64/python2.7/site-packages/twisted/internet/defer.py:1076:gotResult
    2012-01-19 11:09:11+0100 [-] [caldav-0]         --- <exception caught here> ---
    2012-01-19 11:09:11+0100 [-] [caldav-0]         /usr/lib64/python2.7/site-packages/twisted/internet/defer.py:1018:_inlineCallbacks
    2012-01-19 11:09:11+0100 [-] [caldav-0]         /usr/lib64/python2.7/site-packages/twisted/python/failure.py:350:throwExceptionIntoGenerator
    2012-01-19 11:09:11+0100 [-] [caldav-0]         /usr/lib64/python2.7/site-packages/twistedcaldav/resource.py:309:renderHTTP
    2012-01-19 11:09:11+0100 [-] [caldav-0]         /usr/lib64/python2.7/site-packages/twisted/internet/defer.py:1018:_inlineCallbacks
    2012-01-19 11:09:11+0100 [-] [caldav-0]         /usr/lib64/python2.7/site-packages/twisted/python/failure.py:350:throwExceptionIntoGenerator
    2012-01-19 11:09:11+0100 [-] [caldav-0]         /usr/lib64/python2.7/site-packages/twext/web2/static.py:128:renderHTTP
    2012-01-19 11:09:11+0100 [-] [caldav-0]         /usr/lib64/python2.7/site-packages/twisted/internet/defer.py:1018:_inlineCallbacks
    2012-01-19 11:09:11+0100 [-] [caldav-0]         /usr/lib64/python2.7/site-packages/twisted/python/failure.py:350:throwExceptionIntoGenerator
    2012-01-19 11:09:11+0100 [-] [caldav-0]         /usr/lib64/python2.7/site-packages/twext/web2/resource.py:109:renderHTTP
    2012-01-19 11:09:11+0100 [-] [caldav-0]         /usr/lib64/python2.7/site-packages/twisted/internet/defer.py:1018:_inlineCallbacks
    2012-01-19 11:09:11+0100 [-] [caldav-0]         /usr/lib64/python2.7/site-packages/twisted/python/failure.py:350:throwExceptionIntoGenerator
    2012-01-19 11:09:11+0100 [-] [caldav-0]         /usr/lib64/python2.7/site-packages/twistedcaldav/method/report.py:134:http_REPORT
    2012-01-19 11:09:11+0100 [-] [caldav-0]         /usr/lib64/python2.7/site-packages/twisted/internet/defer.py:1018:_inlineCallbacks
    2012-01-19 11:09:11+0100 [-] [caldav-0]         /usr/lib64/python2.7/site-packages/twisted/python/failure.py:350:throwExceptionIntoGenerator
    2012-01-19 11:09:11+0100 [-] [caldav-0]         /usr/lib64/python2.7/site-packages/twistedcaldav/method/report_sync_collection.py:113:report_DAV__sync_collection
    2012-01-19 11:09:11+0100 [-] [caldav-0]         /usr/lib64/python2.7/site-packages/twisted/internet/defer.py:1020:_inlineCallbacks
    2012-01-19 11:09:11+0100 [-] [caldav-0]         /usr/lib64/python2.7/site-packages/twistedcaldav/resource.py:1401:whatchanged
    2012-01-19 11:09:11+0100 [-] [caldav-0]         ]

According to Andrew this should yield a "400 Bad Request" instead of the "500 Server Error".

I am using recent trunk:

root@vserver:~ # rpm -qa | grep Calend
CalendarServer-3.0.svn8541-1.fc16.x86_64
macosforgebot commented 12 years ago

mail@… originally submitted this as comment:1:⁠ticket:473


The whole request was:

<?xml version="1.0" encoding="utf-8" ?>
<sync-collection xmlns="DAV:">
  <prop>
    <getetag/>
  </prop>
  <sync-token>null</sync-token>
</sync-collection>
macosforgebot commented 12 years ago

@wsanchez originally submitted this as comment:2:⁠ticket:473


I'm not sure CalendarServer-3.0.svn8541-1.fc16.x86_64 is recent trunk, but this does sound like a bug.

macosforgebot commented 12 years ago

@wsanchez originally submitted this as comment:3:⁠ticket:473

macosforgebot commented 11 years ago

@wsanchez originally submitted this as comment:7:⁠ticket:473

macosforgebot commented 11 years ago

@cyrusdaboo originally submitted this as comment:8:⁠ticket:473


This works correctly on trunk now. As a precaution I did add a new CDT test in r10319 to cover this situation.