I discovered a couple of bugs with a seriously broken sync conduit. First, a broken sync conduit that does an dlp_OpenDB without closing will lock out all other SPC-capable sync conduits. Second, too many SPC-capable sync conduits will exhaust file descriptors because the SPC pipes (from socketpair) are never closed. Attached is a patch for both problems and a sample conduit, syncjerk, that shows the bug. If you configure syncjerk to sync a specific database (i.e. type: mail/DATA) it'll exhaust dlp handles. If you configure it with type:*/* (or any other SPC conduit, actually), it'll (eventually) exhaust both file descriptors and dlp handles. c.
Index: coldsync/src/conduit.c =================================================================== RCS file: /var/lib/cvs/coldsync/src/conduit.c,v retrieving revision 2.64 diff -u -r2.64 conduit.c --- coldsync/src/conduit.c 10 Dec 2002 12:04:04 -0000 2.64 +++ coldsync/src/conduit.c 11 Jun 2003 22:53:13 -0000 @@ -1109,6 +1109,20 @@ fclose(fromchild); } + if( with_spc ) { + /* A Palm doesn't allow all that many open databases + at once. If a conduit terminates with a database open + (prematurely or otherwise) it can lock out any other conduits + that do DlpOpenDB calls. Since this includes essentially _all_ + sync conduits, we want to prevent it by just closing all the + databases. */ + + DlpCloseDB( palm_pconn(palm), DLPCMD_CLOSEALLDBS, 0 ); + + close( spcpipe[0] ); + close( spcpipe[1] ); + } + /* Let's not hog memory */ if (pref_list != NULL) free(pref_list);
Attachment:
syncjerk
Description: Perl program