Kolibri Crashing or Running slow

We are running our kolibri server on AWS behind a load balancer and when I look at the instance resources, everything looks normal
Memory usage <30%
CPU utilization - <60%
But when we try to run a report or try loading the learning videos, kolibri either crashes and returns 500 or runs really slow

This log is from the kolibri.txt

ERROR 2024-10-15 00:33:56,546 django.request Internal Server Error: /api/content/contentnodeprogress/
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/kolibri/dist/morango/models/fields/uuids.py", line 40, in get_db_prep_value
    value = uuid.UUID(value)
  File "/usr/lib/python3.8/uuid.py", line 168, in __init__
    hex = hex.replace('urn:', '').replace('uuid:', '')
AttributeError: 'KolibriAnonymousUser' object has no attribute 'replace'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/kolibri/dist/django/core/handlers/exception.py", line 47, in inner
    response = get_response(request)
  File "/usr/lib/python3/dist-packages/kolibri/dist/django/core/handlers/base.py", line 181, in _get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
  File "/usr/lib/python3/dist-packages/kolibri/dist/django/views/decorators/csrf.py", line 54, in wrapped_view
    return view_func(*args, **kwargs)
  File "/usr/lib/python3/dist-packages/kolibri/dist/rest_framework/viewsets.py", line 125, in view
    return self.dispatch(request, *args, **kwargs)
  File "/usr/lib/python3/dist-packages/kolibri/dist/rest_framework/views.py", line 509, in dispatch
    response = self.handle_exception(exc)
  File "/usr/lib/python3/dist-packages/kolibri/dist/rest_framework/views.py", line 469, in handle_exception
    self.raise_uncaught_exception(exc)
  File "/usr/lib/python3/dist-packages/kolibri/dist/rest_framework/views.py", line 480, in raise_uncaught_exception
    raise exc
  File "/usr/lib/python3/dist-packages/kolibri/dist/rest_framework/views.py", line 506, in dispatch
    response = handler(request, *args, **kwargs)
  File "/usr/lib/python3/dist-packages/kolibri/core/content/api.py", line 1715, in list
    queryset = self.filter_queryset(self.get_queryset())
  File "/usr/lib/python3/dist-packages/kolibri/dist/rest_framework/generics.py", line 150, in filter_queryset
    queryset = backend().filter_queryset(self.request, queryset, self)
  File "/usr/lib/python3/dist-packages/kolibri/dist/django_filters/rest_framework/backends.py", line 96, in filter_queryset
    return filterset.qs
  File "/usr/lib/python3/dist-packages/kolibri/dist/django_filters/filterset.py", line 243, in qs
    qs = self.filter_queryset(qs)
  File "/usr/lib/python3/dist-packages/kolibri/dist/django_filters/filterset.py", line 230, in filter_queryset
    queryset = self.filters[name].filter(queryset, value)
  File "/usr/lib/python3/dist-packages/kolibri/dist/django_filters/filters.py", line 779, in __call__
    return self.method(qs, self.f.field_name, value)
  File "/usr/lib/python3/dist-packages/kolibri/core/content/api.py", line 1508, in filter_by_lesson
    lesson = Lesson.objects.filter(
  File "/usr/lib/python3/dist-packages/kolibri/dist/django/db/models/query.py", line 674, in first
    for obj in (self if self.ordered else self.order_by('pk'))[:1]:
  File "/usr/lib/python3/dist-packages/kolibri/dist/django/db/models/query.py", line 280, in __iter__
    self._fetch_all()
  File "/usr/lib/python3/dist-packages/kolibri/dist/django/db/models/query.py", line 1324, in _fetch_all
    self._result_cache = list(self._iterable_class(self))
  File "/usr/lib/python3/dist-packages/kolibri/dist/django/db/models/query.py", line 51, in __iter__
    results = compiler.execute_sql(chunked_fetch=self.chunked_fetch, chunk_size=self.chunk_size)
  File "/usr/lib/python3/dist-packages/kolibri/dist/django/db/models/sql/compiler.py", line 1162, in execute_sql
    sql, params = self.as_sql()
  File "/usr/lib/python3/dist-packages/kolibri/dist/django/db/models/sql/compiler.py", line 528, in as_sql
    where, w_params = self.compile(self.where) if self.where is not None else ("", [])
  File "/usr/lib/python3/dist-packages/kolibri/dist/django/db/models/sql/compiler.py", line 445, in compile
    sql, params = node.as_sql(self, self.connection)
  File "/usr/lib/python3/dist-packages/kolibri/dist/django/db/models/sql/where.py", line 81, in as_sql
    sql, params = compiler.compile(child)
  File "/usr/lib/python3/dist-packages/kolibri/dist/django/db/models/sql/compiler.py", line 445, in compile
    sql, params = node.as_sql(self, self.connection)
  File "/usr/lib/python3/dist-packages/kolibri/dist/django/db/models/fields/related_lookups.py", line 132, in as_sql
    return super().as_sql(compiler, connection)
  File "/usr/lib/python3/dist-packages/kolibri/dist/django/db/models/lookups.py", line 315, in as_sql
    return super().as_sql(compiler, connection)
  File "/usr/lib/python3/dist-packages/kolibri/dist/django/db/models/lookups.py", line 194, in as_sql
    rhs_sql, rhs_params = self.process_rhs(compiler, connection)
  File "/usr/lib/python3/dist-packages/kolibri/dist/django/db/models/lookups.py", line 301, in process_rhs
    return super().process_rhs(compiler, connection)
  File "/usr/lib/python3/dist-packages/kolibri/dist/django/db/models/lookups.py", line 101, in process_rhs
    return self.get_db_prep_lookup(value, connection)
  File "/usr/lib/python3/dist-packages/kolibri/dist/django/db/models/lookups.py", line 219, in get_db_prep_lookup
    [get_db_prep_value(value, connection, prepared=True)]
  File "/usr/lib/python3/dist-packages/kolibri/dist/morango/models/fields/uuids.py", line 42, in get_db_prep_value
    raise TypeError(self.error_messages["invalid"] % {"value": value})
KeyError: 'invalid'

Please help

Hi @safi_khan,

Could you please provide these details:

  • Kolibri version
  • Operating system name and version
  • Installation method (.pex, via pip, or the Debian installer, etc)

Regards,
Blaine

Hi @blaine

kolibri, version 0.17.0
OS - Ubuntu
Installation method - apt-get installation

Thank you @safi_khan for providing that information.

Were the videos that you’re having issues with imported from a private or public channel? Could you share the channel ID, preferably in a direct message (DM), since the channel ID could be used to import the channel.

I’m going to try to replicate your issue

Furthermore, reflecting on your initial description of your Kolibri implementation, are you using a load balancer because you have multiple VMs / instances running Kolibri behind the load balancer? Or is there only one Kolibri instance?