Ticket #1936 (new defect)

Opened 3 years ago

sugar.datastore.datastore.find() breaks for large data stores

Reported by: sascha_silbe Owned by: erikos
Priority: High Milestone: 0.88.x
Component: sugar-toolkit Version: Git as of bugdate
Severity: Blocker Keywords:
Cc: Distribution/OS:
Bug Status: New

Description

sugar.datastore.datastore.find() doesn't explicitly set a DBus timeout, so the (in)sanely short default timeout is used. This causes it to break with a DBus timeout error rather easily. E.g. even with all entries in cache(!), find({}) always raises an error for a large data store:

Traceback (most recent call last):
  File "/home/sascha.silbe/sugar-jhbuild/install/bin/sugar-activity", line 21, in <module>
    main.main()
  File "/home/sascha.silbe/sugar-jhbuild/install/lib/python2.5/site-packages/sugar/activity/main.py", line 159, in main
    create_activity_instance(activity_constructor, activity_handle)
  File "/home/sascha.silbe/sugar-jhbuild/install/lib/python2.5/site-packages/sugar/activity/main.py", line 37, in create_activity_instance
    activity = constructor(handle)
  File "/home/sascha.silbe/sugar-jhbuild/install/share/sugar/activities/Janitor.activity/janitor.py", line 112, in __init__
    self._setup_widgets()
  File "/home/sascha.silbe/sugar-jhbuild/install/share/sugar/activities/Janitor.activity/janitor.py", line 116, in _setup_widgets
    self._setup_canvas()
  File "/home/sascha.silbe/sugar-jhbuild/install/share/sugar/activities/Janitor.activity/janitor.py", line 123, in _setup_canvas
    self._create_list_model()
  File "/home/sascha.silbe/sugar-jhbuild/install/share/sugar/activities/Janitor.activity/janitor.py", line 198, in _create_list_model
    self._refresh_list()
  File "/home/sascha.silbe/sugar-jhbuild/install/share/sugar/activities/Janitor.activity/janitor.py", line 204, in _refresh_list
    jobjects = datastore.find({}, properties=self._properties)[0]
  File "/home/sascha.silbe/sugar-jhbuild/install/lib/python2.5/site-packages/sugar/datastore/datastore.py", line 492, in find
    byte_arrays=True)
  File "/usr/lib/pymodules/python2.5/dbus/proxies.py", line 140, in __call__
    **keywords)
  File "/usr/lib/pymodules/python2.5/dbus/connection.py", line 630, in call_blocking
    message, timeout)
dbus.exceptions.DBusException: org.freedesktop.DBus.Error.NoReply: Did not receive a reply. Possible causes include: the remote application did not send a reply, the message bus security policy blocked the reply, the reply timeout expired, or the network connection was broken.

We should allow callers to specify a timeout and default to using a large value or even an infinite timeout (-1). If altering the function signature is too invasive for 0.88, we should backport at least the increased timeout.

Other functions in sugar.datastore.datastore are likely to be affected as well.

Note: See TracTickets for help on using tickets.