Squid 3.0 Compilation issues on IA64

From: GV <gv@dont-contact.us>
Date: Sun, 25 May 2003 13:34:41 -0700

Hello Developers,

Some one might have tried to compile Squid-3.0 on 64 bit platforms. I just
wanted to post the following information, which I encountered, when I tried
to compile on IA64(Linux) machine.

As by default "-Werror" flag is added, compilation stops, as a quite a few
warning messages are seen. Had to disable this flag in all the Makefiles to
make my compilation successfull. Ignored all the warning messages in the
first phase., but seen a run time issue with the following failure....

2003/05/24 17:14:14| Starting Squid Cache version 3.0.DEVEL-20030524 for
ia64-unknown-linux-gnu...
2003/05/24 17:14:14| assertion failed: mem.cc:230: "size ==
StrPoolsAttrs[i].obj_size"
Aborted

Tried to get more insight to this issue and here is the log information...

(gdb) run -NdY1
Starting program: /home/gv/squid3/sbin/squid -NdY1
GV: Mem::Init Called here
Memory pools are 'off'; limit: 0.00 MB
GV : Initial Mem INIT StrPoolsAttrs[i].name = (null),
StrPoolsAttrs[i].obj_size = 0
GV : Mem INIT StrPoolsAttrs[i].name = Short Strings,
StrPoolsAttrs[i].obj_size = 36
GV : Mem INIT StrPoolsAttrs[i].name = Medium Strings,
StrPoolsAttrs[i].obj_size = 128
GV : Mem INIT StrPoolsAttrs[i].name = Long Strings,
StrPoolsAttrs[i].obj_size = 512
2003/05/24 17:11:48| Starting Squid Cache version 3.0.DEVEL-20030524 for
ia64-unknown-linux-gnu...

Breakpoint 1, httpReplySetHeaders (reply=0x6000000000b17020, ver={major = 1,
minor = 0}, status=200, reason=0x0,
    ctype=0x6000000000af7520 "image/gif", clen=227, lmt=1053820531,
expires=-1) at HttpReply.cc:278
278 assert(reply);
(gdb) break httpHeaderPutStr
Breakpoint 2 at 0x40000000000b26a2: file HttpHeader.cc, line 840.
(gdb) c
Continuing.

Breakpoint 2, httpHeaderPutStr (hdr=0x6000000000b17088, id=HDR_SERVER,
    str=0x4000000000170550 "squid/3.0.DEVEL-20030524") at HttpHeader.cc:840
840 assert_eid(id);
(gdb) c
Continuing.

Breakpoint 2, httpHeaderPutStr (hdr=0x6000000000b17088, id=HDR_MIME_VERSION,
str=0x4000000000163c98 "1.0")
    at HttpHeader.cc:840
840 assert_eid(id);
(gdb) c
Continuing.

Breakpoint 2, httpHeaderPutStr (hdr=0x6000000000b17088, id=HDR_CONTENT_TYPE,
str=0x6000000000af7520 "image/gif")
    at HttpHeader.cc:840
840 assert_eid(id);
(gdb) break memAllocString
Breakpoint 3 at 0x40000000000cf592: file mem.cc, line 191.
(gdb) c
Continuing.

Breakpoint 3, memAllocString (net_size=13, gross_size=0x60000fffffff7900) at
mem.cc:191
191 MemPool *pool = NULL;
(gdb) s
192 assert(gross_size);
(gdb) s
195 if (net_size <= StrPoolsAttrs[i].obj_size) {
(gdb) s
194 for (i = 0; i < mem_str_pool_count; i++) {
(gdb) print StrPoolsAttrs[i].obj_size
$1 = 0
(gdb) s
195 if (net_size <= StrPoolsAttrs[i].obj_size) {
(gdb) print StrPoolsAttrs[i].obj_size
$2 = 36
(gdb) s
197 break;
(gdb) s
201 *gross_size = pool ? pool->obj_size : net_size;
(gdb) print StrPoolsAttrs[i].obj_size
$3 = 36
(gdb) print pool
$4 = (_MemPool *) 0x60000000008ee440
(gdb) print *pool
$5 = {label = 0x4000000000166468 "Short Strings", obj_size = 40, chunk_size
= 16384, chunk_capacity = 409,
  memPID = 36, chunkCount = 1, alloc_calls = 87, free_calls = 0, inuse = 87,
idle = 322, freeCache = 0x0,
  nextFreeChunk = 0x600000000093a7e0, Chunks = 0x600000000093a7e0, meter =
{alloc = {level = 409,
      hwater_level = 409, hwater_stamp = 1053821508}, inuse = {level = 0,
hwater_level = 0, hwater_stamp = 0},
    idle = {level = 409, hwater_level = 409, hwater_stamp = 1053821508},
gb_saved = {count = 0, bytes = 0},
    gb_osaved = {count = 0, bytes = 0}, gb_freed = {count = 0, bytes = 0}},
allChunks = 0x600000000093a820,
  next = 0x60000000008ee530}
(gdb) q
The program is running. Exit anyway? (y or n) y

***** You can see that "Short Strings" object size becomes 40, as opposed to
36. After quick invetigation, I did the following hack to proceed further in
mem.cc.

    201 - *gross_size = pool ? pool->obj_size : net_size;
    202 + *gross_size = pool ? StrPoolsAttrs[i].obj_size : net_size;
    203 assert(*gross_size >= net_size);
    204 memMeterInc(StrCountMeter);
    205 memMeterAdd(StrVolumeMeter, *gross_size);
    206 - return pool ? memPoolAlloc(pool) : xcalloc(1, net_size);
    207 + pool->obj_size = StrPoolsAttrs[i].obj_size;
    208 + return pool ? memPoolAlloc(pool) : xcalloc(1, net_size);

And I do see the following messages in cache.log,

2003/05/24 17:22:55| Starting Squid Cache version 3.0.DEVEL-20030524 for
ia64-unknown-linux-gnu...
squid(1812): unaligned access to 0x6000000000957174, ip=0x40000000001318b1
squid(1812): unaligned access to 0x60000000009571bc, ip=0x40000000001318b1
squid(1812): unaligned access to 0x6000000000957204, ip=0x40000000001318b1
squid(1812): unaligned access to 0x600000000095724c, ip=0x40000000001318b1

Finally, I am NOT quite happy about the hack I did, but works fine. I did
some quick testing with my netscape. Looks better except the above log
messages. May be I should fix all the warnings, instead of removing
"-Werror" flag from the compilation. If I come up with some changes to make
the above issue vanished, will the changes be acceptable to go into CVS?

Any advice/thoughts on this issue are much appreciated.

Another weired thing I have seen is, regardless of the value I have set for
"mem_pools" "on" or "off", I always have seen "mem_pools are off" in the log
file as follows. I am NOT quite sure about this, just wanted to know, if
there is a known issue...
Log info : Memory pools are 'off'; limit: 0.00 MB

Squid version I have used is squid-3.0.DEVEL-20030524.tar.gz

Thanks & Regards,
GV

>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
www.ViSolve.net - The Open Source Solutions Provider
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
Received on Sun May 25 2003 - 14:34:39 MDT

This archive was generated by hypermail pre-2.1.9 : Tue Dec 09 2003 - 16:19:57 MST