Opened 10 years ago

Closed 7 years ago

#2585 closed defect (obsolete)

save fails with None buddy reference

Reported by: walter Owned by: erikos
Priority: Unspecified by Maintainer Milestone: Unspecified
Component: Sugar Version: 0.98.x
Severity: Unspecified Keywords:
Cc: Distribution/OS: Unspecified
Bug Status: Unconfirmed

Description

I joined a seeming phantom shared activity and got this error when quitting:

1297121383.895540 ERROR root: Error saving activity object to datastore
Traceback (most recent call last):

File "/usr/lib/python2.7/site-packages/sugar/activity/activity.py", line 823, in _prepare_close

self.save()

File "/usr/lib/python2.7/site-packages/sugar/activity/activity.py", line 642, in save

buddies_dict = self._get_buddies()

File "/usr/lib/python2.7/site-packages/sugar/activity/activity.py", line 617, in _get_buddies

buddy_id = sha1(buddy.props.key).hexdigest()

TypeError: must be string or buffer, not None

We should catch the None buddy instance.

Change History (15)

comment:1 Changed 10 years ago by walter

  • Component changed from sugar to sugar-toolkit
  • Owner set to erikos

comment:2 Changed 10 years ago by walter

I confirmed that there was a buddy.props.key with value None.

Adding a simple test for None seems to remedy the problem but doesn't necessarily address the root cause:

if buddy.props.key is not None:

buddy_id = sha1(buddy.props.key).hexdigest()
buddies[buddy_id] = [buddy.props.nick, buddy.props.color]

comment:3 Changed 8 years ago by dnarvaez

  • Component changed from sugar-toolkit to Sugar

comment:4 Changed 8 years ago by dnarvaez

  • Resolution set to obsolete
  • Status changed from new to closed

Very old, unreproducable.

comment:5 Changed 8 years ago by walter

Actually, I am getting this error again in an activity I am developing. It is most likely a bug in my activity, but it seems Sugar could be more forgiving.

comment:6 Changed 8 years ago by walter

  • Resolution obsolete deleted
  • Status changed from closed to reopened

Seeing this problem on 13.2 (OLPC build 13) for many apps when shared. Something is definitely broken.

comment:7 Changed 8 years ago by walter

self.shared_activity._joined_buddies looks legit:
{dbus.String(u'4b9552fc@xo'): <Buddy object at ... (PresenceBuddy at ...)>}

digging deeper

comment:8 Changed 8 years ago by walter

Another observation:

This bug does not appear in OS9 but does appear in OS13.

comment:9 Changed 8 years ago by godiard

  • Version changed from 0.90.x to 0.98.x

I can reproduce it on 13.2.0 / os11.

Step to reproduce.

  • Open one activity and share it on XO A.
  • Join in XO B.
  • Close activity on XO B.
  • Try to close activity on XO A.

The error happen only on XO A. Strange XO B can save ok, and show the icon of the other xo in the journal.

Log error:

1375709688.074790 ERROR root: Error saving activity object to datastore
Traceback (most recent call last):
  File "/usr/lib/python2.7/site-packages/sugar/activity/activity.py", line 867, in _prepare_close
    self.save()
  File "/usr/lib/python2.7/site-packages/sugar/activity/activity.py", line 686, in save
    buddies_dict = self._get_buddies()
  File "/usr/lib/python2.7/site-packages/sugar/activity/activity.py", line 661, in _get_buddies
    buddy_id = sha1(buddy.props.key).hexdigest()
TypeError: sha1() argument 1 must be string or buffer, not None

comment:10 Changed 8 years ago by godiard

Previous log was with Chat activity (gtk2)

The same happen with Read (gtk3)

1375708850.765533 ERROR root: Error saving activity object to datastore
Traceback (most recent call last):
  File "/usr/lib/python2.7/site-packages/sugar3/activity/activity.py", line 905, in _prepare_close
    self.save()
  File "/usr/lib/python2.7/site-packages/sugar3/activity/activity.py", line 724, in save
    buddies_dict = self._get_buddies()
  File "/usr/lib/python2.7/site-packages/sugar3/activity/activity.py", line 699, in _get_buddies
    buddy_id = sha1(buddy.props.key).hexdigest()
TypeError: sha1() argument 1 must be string or buffer, not None

comment:11 Changed 8 years ago by godiard

Confirmed the issue does not happen in 13.2.0 os9,
but is really strange, these are the only packages changed:

--- /home/gonzalo/Desktop/xo/xo-4/32009o4.packages.txt
+++ /home/gonzalo/Desktop/xo/xo-4/32013o4.packages.txt
-kernel-3.5.7_xo4-20130607.1702.olpc.e7f43ff.armv7hl
+kernel-3.5.7_xo4-20130705.0203.olpc.e77de3d.armv7hl
-olpc-firmware-q7-b32-1.unsigned.noarch
+olpc-firmware-q7-b37-1.unsigned.noarch
-xorg-x11-drv-dove-0.3.10-1.fc18.xo4.armv7hl
+xorg-x11-drv-dove-0.3.11-1.fc18.xo4.armv7hl
-xorg-x11-server-common-1.13.3-1.fc18.olpc8.armv7hl
+xorg-x11-server-common-1.13.3-1.fc18.olpc9.armv7hl
-xorg-x11-server-Xorg-1.13.3-1.fc18.olpc8.armv7hl
+xorg-x11-server-Xorg-1.13.3-1.fc18.olpc9.armv7hl

comment:12 Changed 8 years ago by godiard

Today, I am testing with two xo with 13.2.0 os13, and can't reproduce the issue anymore. Walter, can you confirm?

comment:13 Changed 7 years ago by dnarvaez

Walter, could you test this again please and see if you can confirm?

comment:14 Changed 7 years ago by walter

Cannot reproduce with the Sugar 100 test builds.

comment:15 Changed 7 years ago by godiard

  • Resolution set to obsolete
  • Status changed from reopened to closed

Cannot reproduce in 0.102 image, closing.

Note: See TracTickets for help on using tickets.