In <A3D12FAD74FC8B46991703F40C182BABA20D5B4F at permls102.wde.woodside.com.au> "Everett, Vernon" <Vernon.Everett at woodside.com.au> writes:
--_000_A3D12FAD74FC8B46991703F40C182BABA20D5B4Fpermls102wdewoo_ Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable
Below are our 5 most recent cores. And the corresponding entry in the bb-network.log file where available. (No= t all generate the entry in the log file)
It seems the problems occur in the C-ARES library which is used for hostname lookups (via DNS).
Hobbit 4.2.0 uses version 1.2.1 of C-ARES; the current version is 1.5.3. Unfortunately there's been a small change of the C-ARES API, so we cannot just drop version 1.5.3 of the library into Hobbit 4.2.0. But it would be nice to know if the problem is still there in the latest version.
If you want to try that, you can grab version 1.4.0 from http://c-ares.haxx.se/c-ares-1.4.0.tar.gz and then change Hobbit's build/Makefile.rules: The "ARESVER" setting should be "1.4.0". Then "make clean; rm -rf bbnet/c-ares/* bbnet/libcares.*; make" and copy bbnet/bbtest-net to ~hobbit/server/bin/
If you want to try out the 1.5.3 version, drop me a mail and I'll send you the patches needed for this to compile with Hobbit 4.2.0.
Colin, our Linux man, and part-time C hacker, had this to say
---snip--- [root at las006 tmp]# gdb ~hobbit/server/bin/bbtest-net (gdb) l *0x42493a 0x42493a is in ares_free_hostent (ares_free_hostent.c:35). 30 free(host->h_name); 31 for (p =3D host->h_aliases; *p; p++) 32 free(*p); 33 free(host->h_aliases); 34 free(host->h_addr_list[0]); 35 free(host->h_addr_list); 36 free(host); 37 } (gdb)
line 31: Make 'p' equal to the memory address of host->h_aliases, check tha= t pointer p is not null and increment p line 32: free the memory pointed at by 'p'
The problem here is that you check p then free p++. My C is quite rusty bu= t I'd hazard a guess and say line 31 should read like: 31 for (p =3D host->h_aliases; *(p++);)
Nope, sorry - Colin needs to revisit his C programming manual. The "for" loop construct in line 31-32 will do the "p++" AFTER doing the "free(*p)".
Another way of writing the same code would be
for (i=0; *(host->h_aliases[i]); i++) free(host->h_aliases[i]);
where it is perhaps clearer that this goes through an array of host aliases until there's an empty alias (this indicates the end of the array), and frees the memory used to record each alias. But again, the counter (i) is incremented AFTER the "free" is done.
The code is a bit obscure, but I think it's correct (didn't write it myself, though ...) I'm afraid the data structures used for hostname lookups weren't written to be easy to understand.
Regards, Henrik