IndexError crash during pagination on 0.6.3

Mads Kiilerich mads at kiilerich.com
Mon Feb 1 20:19:18 UTC 2021


Hi

Thanks for the report and the test case.

Yes, that comment is wrong. It didn't consider that if the page number 
is too high, the resulting page will be empty even though the first page 
isn't.

I propose fixing it with 
https://kallithea-scm.org/repos/kallithea-incoming/changeset/0ff78683c8730a454b9df805afe3766eebfa5a62

/Mads


On 2/1/21 4:45 PM, Brett Smith wrote:
>
> Hi all,
>
> I got this crash report from the server at k.sfconservancy.org over 
> the weekend, and the comment in the last line jumped out at me. It 
> sounds like there's a situation where the code assumes a list can't be 
> empty, but in fact it can be. The full details are below, except I've 
> removed bits that just reveal too much about our server setup or the 
> visitor.
>
> You're welcome to browse around or clone the repository if it helps 
> you debug the problem; it's all public.
>
>
> TRACEBACK:
> Traceback (most recent call last):
>    File "/usr/local/src/kallithea/lib/python3.7/site-packages/tg/appwrappers/session.py", line 71, in __call__
>      response = self.next_handler(controller, environ, context)
>    File "/usr/local/src/kallithea/lib/python3.7/site-packages/tg/appwrappers/i18n.py", line 71, in __call__
>      return self.next_handler(controller, environ, context)
>    File "/usr/local/src/kallithea/lib/python3.7/site-packages/tg/wsgiapp.py", line 243, in _dispatch
>      return controller(environ, context)
>    File "/usr/local/src/kallithea/lib/python3.7/site-packages/kallithea/lib/base.py", line 536, in __call__
>      return super(BaseController, self).__call__(environ, context)
>    File "/usr/local/src/kallithea/lib/python3.7/site-packages/tg/controllers/dispatcher.py", line 118, in __call__
>      response = self._perform_call(context)
>    File "/usr/local/src/kallithea/lib/python3.7/site-packages/tg/controllers/dispatcher.py", line 107, in _perform_call
>      r = self._call(action, params, remainder=remainder, context=context)
>    File "/usr/local/src/kallithea/lib/python3.7/site-packages/tg/controllers/decoratedcontroller.py", line 129, in _call
>      output = controller_caller(context_config, bound_controller_callable, remainder, params)
>    File "/usr/local/src/kallithea/lib/python3.7/site-packages/tg/controllers/decoration.py", line 21, in _decorated_controller_caller
>      return application_controller_caller(tg_config, controller, remainder, params)
>    File "/usr/local/src/kallithea/lib/python3.7/site-packages/tg/configurator/components/dispatch.py", line 114, in _call_controller
>      return controller(*remainder, **params)
>    File "<decorator-gen-4>", line 2, in index
>        File "/usr/local/src/kallithea/lib/python3.7/site-packages/kallithea/lib/auth.py", line 608, in __wrapper
>      return func(*fargs, **fkwargs)
>    File "<decorator-gen-3>", line 2, in index
>        File "/usr/local/src/kallithea/lib/python3.7/site-packages/kallithea/lib/auth.py", line 657, in __wrapper
>      return func(*fargs, **fkwargs)
>    File "/usr/local/src/kallithea/lib/python3.7/site-packages/kallithea/controllers/changelog.py", line 148, in index
>      c.first_revision = c.cs_pagination[0] # pagination is never empty here!
> IndexError: list index out of range
> ENVIRON:
> 	HTTP_ACCEPT: '*/*'
> 	HTTP_ACCEPT_CHARSET: 'utf-8;q=0.7,iso-8859-1;q=0.2,*;q=0.1'
> 	HTTP_CONNECTION: 'Keep-Alive'
> 	HTTP_HOST: 'k.sfconservancy.org'
> 	HTTP_USER_AGENT: 'Mozilla/5.0 (compatible; DotBot/1.1;http://www.opensiteexplorer.org/dotbot,help@moz.com)
> 	PATH_INFO: '/website/changelog/49c5bca7430b19dd09e0e12d2b908b86d278d325/www/conservancy/static/supporter/index.html'
> 	QUERY_STRING: 'page=2'
> 	REQUEST_METHOD: 'GET'
> 	SCRIPT_NAME: ''
> 	SERVER_PROTOCOL: 'HTTP/1.1'
> 	SERVER_SOFTWARE: 'waitress'
> WSGI:
> 	beaker.session: {'_domain': None, '_path': '/', '_accessed_time': 1612166635.5476, '_creation_time': 1612166635.5476}
> 	pylons.routes_dict: {'repo_name': 'website', 'revision': '49c5bca7430b19dd09e0e12d2b908b86d278d325', 'f_path': 'www/conservancy/static/supporter/index.html', 'action': 'index', 'controller': 'changelog'}
> 	tg.routes_dict: {'repo_name': 'website', 'revision': '49c5bca7430b19dd09e0e12d2b908b86d278d325', 'f_path': 'www/conservancy/static/supporter/index.html', 'action': 'index', 'controller': 'changelog'}
> 	webob._parsed_query_vars: (GET([('page', '2')]), 'page=2')
> 	webob.adhoc_attrs: {'authuser': <AuthUser 1: 'default'>, 'ip_addr': '[redacted]', 'needs_csrf_check': False, 'routes_local': {'mapper': <kallithea.config.routing.Mapper object at 0x7f5d38459390>, 'host': 'k.sfconservancy.org', 'protocol': 'https', 'redirect': <function redirect at 0x7f5d3aff8b70>}}
> 	wsgi.input_terminated: True
> 	wsgi.multiprocess: False
> 	wsgi.multithread: True
> 	wsgi.run_once: False
> 	wsgi.url_scheme: 'https'
> 	wsgi.version: (1, 0)
> 	wsgiorg.routing_args: (<routes.util.URLGenerator object at 0x7f5d306a8668>, {'repo_name': 'website', 'revision': '49c5bca7430b19dd09e0e12d2b908b86d278d325', 'f_path': 'www/conservancy/static/supporter/index.html', 'action': 'index', 'controller': 'changelog'})
> REQUEST:
> 	<Request at 0x7f5d30575cf8 GEThttps://k.sfconservancy.org/error/document?page=2>
>
> _______________________________________________
> kallithea-general mailing list
> kallithea-general at sfconservancy.org
> https://lists.sfconservancy.org/mailman/listinfo/kallithea-general


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.sfconservancy.org/pipermail/kallithea-general/attachments/20210201/dadf7b6c/attachment-0001.html>


More information about the kallithea-general mailing list