Ticket #1131 (new defect)

Opened 5 years ago

Last modified 4 years ago

The python plugin crashes in get_changeinfo()

Reported by: abompard Owned by: ehabkost
Priority: normal Milestone:
Component: OpenSync: Python Wrapper Version: 0.22
Severity: major Keywords:
Cc: aurelien@…, andri@…, graham@…, sloevenh1@…, sascha-web-www.opensync.org@…, mark@…

Description

I'm having a problem with the opensync plugin : the first synchonization worked perfectly, but all others fail with the following error :

INFO:SynCE:device synchronization complete
DEBUG:SynCE:requesting remote changes
DEBUG:SynCE:got 4 changesets
DEBUG:SynCE:processing changes for 4 items of item type 0
Traceback (most recent call last):
File
"/usr/lib/python2.6/site-packages/plugins/synce-opensync-plugin-2x.py",
line 174, in get_changeinfo
File "/usr/lib/python2.6/site-packages/opensync.py", line 186, in
set_uid
def set_uid(self, *args): return _opensync.OSyncChange_set_uid(self,
*args)
TypeError: in method 'OSyncChange_set_uid', argument 1 of type 'OSyncChange
*'
Member 2 of type synce-opensync-plugin had an error while getting changes:
Error during get_changeinfo() method
DEBUG:SynCE:disconnect() called
Member 1 of type file-sync just disconnected
Member 2 of type synce-opensync-plugin just disconnected
All clients have disconnected
The sync failed: Unable to read from one of the members
DEBUG:SynCE:finalize() called
All conflicts have been reported
Error while synchronizing: Unable to read from one of the members

I don't know where this python TypeError? comes from. I asked first on the SynCE bugtracker, but they think it's a bug in the OpenSync? Python wrapper. Here's a link to the synce plugin : http://synce.svn.sf.net/svnroot/synce/trunk/sync-engine/plugins/synce-opensync-plugin-2x.py

I can code in python (but not in C), so if you want me to investigate or make tests, I'd be happy to help.

Attachments

python-swig-change.diff (516 bytes) - added by markellis 4 years ago.
Python wrapper fix for building with swig 1.3.37 or later

Change History

comment:1 Changed 5 years ago by abompard

  • Summary changed from synce plugin triggers an error in OpenSync to The python plugin crashes in get_changeinfo()

To prove that the bug does not come from the synce plugin, I tried the sample.py plugin shipped with the python plugin. It causes the same error :

Connect called!!                         
Member 2 of type sample just connected
Member 1 of type file-sync just connected       
All clients connected or error                  
get_changeinfo called!!                         
Slow-sync requested                             
Traceback (most recent call last):              
  File "/usr/lib/opensync/python-plugins/sample.py", line 16, in get_changeinfo
    change.uid = "testuid"                                                    
  File "/usr/lib/python2.6/site-packages/opensync.py", line 192, in set_uid   
    def set_uid(self, *args): return _opensync.OSyncChange_set_uid(self, *args)
TypeError: in method 'OSyncChange_set_uid', argument 1 of type 'OSyncChange *' 
Member 2 of type testmodule had an error while getting changes: Error during get_changeinfo() method
disconnect called!                                                                                        
Member 2 of type testmodule just disconnected

There is probably a bug in the swig wrapper somewhere. I'd love to be able to debug it, but I don't know C.

comment:2 follow-up: ↓ 7 Changed 5 years ago by abompard

After much trial-and-error, I found a way to make it work, but it seems very strange to me. Here's the patch I had to apply on opensync.py

--- opensync.py.orig    2009-06-17 07:48:39.000000000 +0200
+++ opensync.py 2009-06-17 07:49:13.000000000 +0200
@@ -163,7 +163,10 @@
     thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag')
     __repr__ = _swig_repr
     def __init__(self, obj = None):
-        this = _opensync.new_OSyncChange(obj)
+        if obj:
+            this = _opensync.new_OSyncChange(obj)
+        else:
+            this = _opensync.new_OSyncChange()
         try: self.this.append(this)
         except: self.this = this
     __swig_destroy__ = _opensync.delete_OSyncChange

When OSyncChange() is called, the obj variable is None, and I thought that passing a None argument was equivalent to not passing the argument. It looks like this is wrong, at least with the python 2.6 I'm using.

Since the opensync.py file is generated by SWIG, maybe something should be done around line 83 of opensync.i. I can't help there, since it's C code.

comment:3 Changed 5 years ago by andri

  • Cc andri@… added

I encountered the same problem with the Fedora 11 package libopensync-0.22-4.fc11.x86_64. Applying the patch mentioned by abompard and recompiling the python module seems to have solved it.

comment:4 Changed 5 years ago by AdamW

  • Severity changed from normal to major

Confirming the problem and the workaround, here, using Fedora Rawhide.

comment:5 Changed 5 years ago by 3lpogo

Also confirming the problem and the workaround. Using Fedora 12.

comment:6 Changed 5 years ago by gtermars

  • Cc graham@… added

comment:7 in reply to: ↑ 2 Changed 5 years ago by ftoledo

confirm, this workaround work for my on debian testing! thanks.

comment:8 Changed 5 years ago by squall38

  • Cc sloevenh1@… added

comment:9 Changed 4 years ago by sascha_silbe

  • Cc sascha-web-www.opensync.org@… added

comment:10 Changed 4 years ago by sim

decoration Changed 1 year ago by admin

bathtub Changed 1 year ago by admin

solar system Changed 1 year ago by admin

stair parts Changed 1 year ago by admin

solar supply Changed 1 year ago by admin

Changed 4 years ago by markellis

Python wrapper fix for building with swig 1.3.37 or later

comment:11 Changed 4 years ago by markellis

SWIG 1.3.37 introduced, rightly or wrongly, some changes in the way python is handled, causing this TypeError?.

I've attached a much tested patch to fix this problem, it will work ok with any version but is only required in builds using later SWIG.

comment:12 Changed 4 years ago by markellis

  • Cc mark@… added
Note: See TracTickets for help on using tickets.