[Spread-users] spread 4 bug on all platforms?

John Schultz jschultz at spreadconcepts.com
Fri May 5 12:34:35 EDT 2006


Here is the fix to this bug in the release candidate of Spread 4 in 
G_compare_daemon_vs_set in groups.c:

Index: daemon/groups.c
===================================================================
--- daemon/groups.c     (revision 350)
+++ daemon/groups.c     (working copy)
@@ -201,7 +201,14 @@
        const daemon_members *db  = *(const daemon_members**) b;
         int                   cmp = G_compare_memb_ids(&da->memb_id, 
&db->memb_id);

-       return (cmp != 0 ? cmp : 
G_compare_proc_ids_by_conf(&da->proc_id, &db->proc_id));
+       if ( cmp == 0 ) {
+               int32 * da_proc_id_ptr = &da->proc_id;
+               int32 * db_proc_id_ptr = &db->proc_id;
+
+               cmp = G_compare_proc_ids_by_conf( &da_proc_id_ptr, 
&db_proc_id_ptr );
+       }
+
+       return cmp;
 }

Cheers!
John

John Schultz wrote:

> Ed,
>
> Thank you very much for the detailed core dump.  I traced down the 
> code and there does seem to be a bug in G_compare_proc_ids_by_conf or 
> G_compare_daemon_vs_set.  G_compare_daemon_vs_set calls 
> G_compare_proc_ids_by_conf like this:
>
> G_compare_proc_ids_by_conf(&da->proc_id, &db->proc_id);
>
> da->proc_id and db->proc_id are int32, so the call is passing two 
> int32* to G_compare_proc_ids_by_conf.  But then in that function the 
> pointers are cast to int32** and then dereferenced twice.  This is of 
> course incorrect and could cause all of the daemons to crash or at 
> least misbehave.
>
> I need to figure out which function is doing the wrong thing and then 
> I will commit the fix to SVN/CVS.  I will also post my fix to the 
> mailing list so you can just manually update your code if you like.
>
> Thanks!
> John
>
>
> Ed Holyat wrote:
>
>>
>> Has anyone run across a bug in this area of the membership code?  It 
>> brings down all daemons when encountered and it is not readily 
>> reproducible at this point.
>>
>>         spread.exe!G_compare_proc_ids_by_conf(const void * 
>> a=0x00f5d0d8, const void * b=0x007b8b38)  Line 198 + 0x9     C
>>
>>         spread.exe!G_compare_daemon_vs_set(const void * a=0x01266c8c, 
>> const void * b=0x00f9ecfc)  Line 213 + 0x1b       C
>>
>>         spread.exe!stdskl_low_key_cmp(const stdskl * l=0x00127810, 
>> const void * k1=0x01266c8c, const void * k2=0x00f9ecfc)  Line 59 + 
>> 0x35      C
>>
>>         spread.exe!stdskl_low_insert(stdskl * l=0x00127810, stdit * 
>> it=0x00000000, const stdit * b=0x001277e4, const stdit * 
>> e=0x00000000, unsigned int num_ins=2, int hint=1, int overwrite=1, 
>> int advance=1)  Line 346 + 0x4c C
>>
>>         spread.exe!stdskl_put_seq_n(stdskl * l=0x00127810, stdit * 
>> it=0x00000000, const stdit * b=0x001277e4, unsigned int num_put=4, 
>> int hint=0)  Line 946 + 0x1f      C
>>
>>         spread.exe!G_build_memb_vs_buf(dummy_group * grp=0x003e1448, 
>> dummy_big_scatter * msg=0x0129e2a8, char * buf=0x00491238, int 
>> caused=2048, dummy_member * joiner=0x00000000)  Line 1743 + 0x3d    C
>>
>>>       spread.exe!G_send_heavyweight_join(dummy_group * 
>>
>> grp=0x003e1448, dummy_member * joiner=0x00000000, int new_mbox=-1)  
>> Line 1242 + 0x1b   C
>>
>>         spread.exe!G_send_heavyweight_memb(dummy_group * 
>> grp=0x003e1448)  Line 1223 + 0xd       C
>>
>>         spread.exe!G_handle_reg_memb(dummy_configuration 
>> reg_memb={...}, dummy_membership_id reg_memb_id={...})  Line 378 + 0x9 C
>>
>>         spread.exe!Sess_deliver_reg_memb(dummy_configuration 
>> reg_memb={...}, dummy_membership_id reg_memb_id={...})  Line 1914 + 
>> 0x29   C
>>
>>         spread.exe!Discard_packets()  Line 1184 + 0x25  C
>>
>>         spread.exe!Prot_handle_token()  Line 647        C
>>
>>         spread.exe!E_handle_events()  Line 683 + 0x5d   C
>>
>>         spread.exe!_run_main(int argc=1, char * * argv=0x003e1620)  
>> Line 211    C
>>
>>         spread.exe!main(int argc=1, char * * argv=0x003e1620)  Line 
>> 139 + 0xd   C
>>
>>         spread.exe!mainCRTStartup()  Line 259 + 0x12    C
>>
>>         kernel32.dll!7c816d4f()       
>>         kernel32.dll!7c8399f3()       
>>
>>
>> Ed Holyat
>>
>> Open Link Financial, Inc.
>>
>> (516) 394-1231
>>
>> (516) 227-6600 x 231
>>
>> _www.olf.com_
>>
---
John Schultz
Spread Concepts LLC
Phn:  301 498 3233
Cell: 443 838 2200





More information about the Spread-users mailing list