This is a snapshot of Indico's old Trac site. Any information contained herein is most probably outdated. Access our new GitHub site here.

Opened 3 years ago

Closed 3 years ago

#1033 closed defect (fixed)

GoogleBot visiting calendar causes exceptions

Reported by: makub Owned by:
Priority: high Milestone: v0.99.0
Component: General Version: 0.98-dev
Keywords: Cc:

Description

Indico 0.98.1 calendar generates links that cause server exceptions. For example, the last date displayable is 19 January 2038:

https://indico.egi.eu/indico/categOverview.py?selCateg=0&detail=conference&month=1&period=day&year=2038&day=19

and the link to the next day causes an exception.

Googlebot eventually finds this pages and causes emails with exceptions to be sent to the administrator.

Here is a sample exception:

2012-05-18 13:53:31,572 indico.requestHandler - ERROR base.py:363 -- Request 139649900358480 failed: "integer out of range"
Traceback (most recent call last):
  File "/usr/local/lib/python2.6/dist-packages/indico-0.98.1-py2.6.egg/MaKaC/webinterface/rh/base.py", line 565, in process
    res = self._process()
  File "/usr/local/lib/python2.6/dist-packages/indico-0.98.1-py2.6.egg/MaKaC/webinterface/rh/categoryDisplay.py", line 128, in _process
    return p.display()
  File "/usr/local/lib/python2.6/dist-packages/indico-0.98.1-py2.6.egg/MaKaC/webinterface/pages/base.py", line 189, in display
    self._display( params ), \
  File "/usr/local/lib/python2.6/dist-packages/indico-0.98.1-py2.6.egg/MaKaC/webinterface/pages/main.py", line 159, in _display
    body = WMainBase(self._getBody( params ), self._timezone, self._getNavigationDrawer(),
  File "/usr/local/lib/python2.6/dist-packages/indico-0.98.1-py2.6.egg/MaKaC/webinterface/pages/category.py", line 1050, in _getBody
    return wc.getHTML( pars )
  File "/usr/local/lib/python2.6/dist-packages/indico-0.98.1-py2.6.egg/MaKaC/webinterface/wcomponents.py", line 212, in getHTML
    vars = self.getVars()
  File "/usr/local/lib/python2.6/dist-packages/indico-0.98.1-py2.6.egg/MaKaC/webinterface/pages/category.py", line 890, in getVars
    vars["overview"] = displayOW.getHTML( p )
  File "/usr/local/lib/python2.6/dist-packages/indico-0.98.1-py2.6.egg/MaKaC/webinterface/wcomponents.py", line 212, in getHTML
    vars = self.getVars()
  File "/usr/local/lib/python2.6/dist-packages/indico-0.98.1-py2.6.egg/MaKaC/webinterface/pages/category.py", line 626, in getVars
    confs = self._ow.getConferencesWithStartTime()
  File "/usr/local/lib/python2.6/dist-packages/indico-0.98.1-py2.6.egg/MaKaC/webinterface/wcalendar.py", line 396, in getConferencesWithStartTime
    return self._cal.getDay( date ).getConferencesWithStartTime()
  File "/usr/local/lib/python2.6/dist-packages/indico-0.98.1-py2.6.egg/MaKaC/webinterface/wcalendar.py", line 235, in getDay
    self._initialiseDays()
  File "/usr/local/lib/python2.6/dist-packages/indico-0.98.1-py2.6.egg/MaKaC/webinterface/wcalendar.py", line 203, in _initialiseDays
    confs = catDayIdx.getObjectsInDays(categ.getId(), self.getStartDate(), self.getEndDate())
  File "/usr/local/lib/python2.6/dist-packages/indico-0.98.1-py2.6.egg/MaKaC/common/indexes.py", line 1037, in getObjectsInDays
    return self._idxCategItem[categid].getObjectsInDays(sDate, eDate)
  File "/usr/local/lib/python2.6/dist-packages/indico-0.98.1-py2.6.egg/MaKaC/common/indexes.py", line 780, in getObjectsInDays
    for event in self._idxDay.values(sDay, eDay):
TypeError: integer out of range

Additional information:
URL: https://indico.egi.eu/indico/categOverview.py?selCateg=0&detail=conference&month=1&period=day&year=2038&day=20
Params: {'selCateg': '0', 'categId': '0', 'detail': 'conference', 'period': 'day', 'year': '2038', 'month': '1', 'day': '20'}
IP: 147.251.17.153
User Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/536.5 (KHTML, like Gecko) Chrome/19.0.1084.46 Safari/536.5
Referer: https://indico.egi.eu/indico/categOverview.py?selCateg=0&detail=conference&month=1&period=day&year=2038&day=19

Change History (3)

comment:1 Changed 3 years ago by makub

The problem is probably the same as in ticket #1013.

comment:2 Changed 3 years ago by makub

The file MaKaC/common/indexes.py already has constant BTREE_MAX_INT defined and used in checks for too large intsegers, so a simple fix is to add another check:

--- MaKaC/common/indexes_orig0981.py    2012-05-18 14:59:53.000000000 +0200
+++ MaKaC/common/indexes.py     2012-05-18 15:02:13.000000000 +0200
@@ -777,6 +777,9 @@
         sDay = int(datetimeToUnixTime(datetime(sDate.year, sDate.month, sDate.day))) if sDate else None
         eDay = int(datetimeToUnixTime(datetime(eDate.year, eDate.month, eDate.day))) if eDate else None
         res = set()
+        #checking if 2038 problem occurs
+        if sDay > BTREE_MAX_INT or eDay > BTREE_MAX_INT:
+            return res
         for event in self._idxDay.values(sDay, eDay):
             res.update(event)
         return res

comment:3 Changed 3 years ago by arescope

  • Milestone set to v0.99.0
  • Resolution set to fixed
  • Status changed from new to closed

Already merged for the next release.

Note: See TracTickets for help on using tickets.