vBulletin Search Engine Optimization
| |||||||
| Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| ||||
| On Mon, Mar 19, 2007 at 07:53:26PM +0000, Carlos Valiente wrote: > On my -CURRENT amd64 system, Python 2.5 (installed from packge file > python-2.5p3.tgz on 14 Mar 2007) is segfaulting within an installed > module (the PostgreSQL Python driver from > http://www.initd.org/tracker/psycopg/wiki/PsycopgTwo). The crash > happens in line 175 of this function of the PostgreSQL Python driver: > > 166: static PyObject * > 167: qstring_str(qstringObject *self) > 168: { > 169: Dprintf("qstring_str: self: %p", self); > 170: if (self->buffer == NULL) { > 171: qstring_quote(self); > 172: Dprintf("qstring_str: self: %p", self); > 173: > 174: Dprintf("qstring_str: About to bomb..."); > 175: Dprintf("qstring_str: self->buffer: %p", self->buffer); > 176: } > 177: Py_XINCREF(self->buffer); > 178: return self->buffer; > 179: } > > Before the call to qstring_quote(), self is not NULL (I get values > like 0x49f487e0). After the call, however, self is NULL. > > The GCC flags used to compile and link that code include -O2. When I > manually compile and link that code with -O0, however, things work as > expected. > > Is GCC the culprit of this problem, or should I keep on looking somewhere > else? Hi Carlos, I would consider GCC suspect. I had a similar issue with sqlite3 in ports. sqlite3 would crash during regression testing when compiled with -O2 but all tests passed with -Os. I didn't make much progress in identifying the issue though. > In case it helps: The GCC flags in detail: > > cc -pthread -fno-strict-aliasing -DNDEBUG -O2 -g -pipe > -DTHREAD_STACK_SIZE=0x20000 -fPIC -fPIC -DPY_MAJOR_VERSION=2 > -DPY_MINOR_VERSION=5 -DHAVE_PYBOOL=1 -DHAVE_DECIMAL=1 > -DHAVE_PYDATETIME=1 -DPSYCOPG_DEFAULT_PYDATETIME=1 > -DPSYCOPG_VERSION="2.0.5.1 (dec dt ext pq3)" -DPG_MAJOR_VERSION=8 > -DPG_MINOR_VERSION=2 -DPG_PATCH_VERSION=3 -DPSYCOPG_EXTENSIONS=1 > -DPSYCOPG_DISPLAY_SIZE=1 -DPSYCOPG_NEW_BOOLEAN=1 -DHAVE_PQFREEMEM=1 > -DHAVE_PQPROTOCOL3=1 -DPSYCOPG_DEBUG=1 -I/usr/local/include/python2.5 > -I. -I/usr/local/include/postgresql > -I/usr/local/include/postgresql/server -c psycopg/adapter_qstring.c -o > build/temp.openbsd-4.1-amd64-2.5/psycopg/adapter_qstring.o > > cc -shared -g -L/scratch/bld/ports/Python-2.5/Python-2.5 > build/temp.openbsd-4.1-amd64-2.5/psycopg/psycopgmodule.o > build/temp.openbsd-4.1-amd64-2.5/psycopg/pqpath.o > build/temp.openbsd-4.1-amd64-2.5/psycopg/typecast.o > build/temp.openbsd-4.1-amd64-2.5/psycopg/microprotocols.o > build/temp.openbsd-4.1-amd64-2.5/psycopg/microprotocols_proto.o > build/temp.openbsd-4.1-amd64-2.5/psycopg/connection_type.o > build/temp.openbsd-4.1-amd64-2.5/psycopg/connection_int.o > build/temp.openbsd-4.1-amd64-2.5/psycopg/cursor_type.o > build/temp.openbsd-4.1-amd64-2.5/psycopg/cursor_int.o > build/temp.openbsd-4.1-amd64-2.5/psycopg/adapter_qstring.o > build/temp.openbsd-4.1-amd64-2.5/psycopg/adapter_pboolean.o > build/temp.openbsd-4.1-amd64-2.5/psycopg/adapter_binary.o > build/temp.openbsd-4.1-amd64-2.5/psycopg/adapter_asis.o > build/temp.openbsd-4.1-amd64-2.5/psycopg/adapter_list.o > build/temp.openbsd-4.1-amd64-2.5/psycopg/adapter_datetime.o > -L/usr/local/lib -lpq -o > build/lib.openbsd-4.1-amd64-2.5/psycopg2/_psycopg.so > > The output of 'objdump -dl' for qstring_str: > > 0000000000011fa0 <qstring_str>: > qstring_str(): > psycopg/adapter_qstring.c:168 > 11fa0: 48 83 ec 18 sub $0x18,%rsp > 11fa4: 48 89 5c 24 08 mov %rbx,0x8(%rsp) > 11fa9: 48 89 6c 24 10 mov %rbp,0x10(%rsp) > 11fae: 48 89 fb mov %rdi,%rbx > psycopg/adapter_qstring.c:169 > 11fb1: e8 22 63 ff ff callq 82d8 <_init+0x1d8> > 11fb6: 48 8d 35 03 7c 10 00 lea 1080323(%rip),%rsi > # 119bc0 <_fini+0x105c90> > 11fbd: 48 89 d9 mov %rbx,%rcx > 11fc0: 48 8b 2d a9 da 30 00 mov 3201705(%rip),%rbp > # 31fa70 <_GLOBAL_OFFSET_TABLE_+0x6d0> > 11fc7: 89 c2 mov %eax,%edx > 11fc9: 31 c0 xor %eax,%eax > 11fcb: 48 81 c5 30 01 00 00 add $0x130,%rbp > 11fd2: 48 89 ef mov %rbp,%rdi > 11fd5: e8 be 65 ff ff callq 8598 <_init+0x498> > psycopg/adapter_qstring.c:170 > 11fda: 48 8b 43 18 mov 0x18(%rbx),%rax > 11fde: 48 85 c0 test %rax,%rax > 11fe1: 74 1d je 12000 <qstring_str+0x60> > 11fe3: 48 ff 00 incq (%rax) > 11fe6: 48 8b 43 18 mov 0x18(%rbx),%rax > psycopg/adapter_qstring.c:179 > 11fea: 48 8b 5c 24 08 mov 0x8(%rsp),%rbx > 11fef: 48 8b 6c 24 10 mov 0x10(%rsp),%rbp > 11ff4: 48 83 c4 18 add $0x18,%rsp > 11ff8: c3 retq > 11ff9: 66 data16 > 11ffa: 66 data16 > 11ffb: 66 data16 > 11ffc: 90 nop > 11ffd: 66 data16 > 11ffe: 66 data16 > 11fff: 90 nop > psycopg/adapter_qstring.c:171 > 12000: 48 89 df mov %rbx,%rdi > 12003: e8 88 fd ff ff callq 11d90 <qstring_quote> > psycopg/adapter_qstring.c:172 > 12008: e8 cb 62 ff ff callq 82d8 <_init+0x1d8> > 1200d: 48 89 ef mov %rbp,%rdi > 12010: 48 89 d9 mov %rbx,%rcx > 12013: 89 c2 mov %eax,%edx > 12015: 48 8d 35 a4 7b 10 00 lea 1080228(%rip),%rsi > # 119bc0 <_fini+0x105c90> > 1201c: 31 c0 xor %eax,%eax > 1201e: e8 75 65 ff ff callq 8598 <_init+0x498> > psycopg/adapter_qstring.c:174 > 12023: e8 b0 62 ff ff callq 82d8 <_init+0x1d8> > 12028: 48 89 ef mov %rbp,%rdi > 1202b: 89 c2 mov %eax,%edx > 1202d: 48 8d 35 6c 78 10 00 lea 1079404(%rip),%rsi > # 1198a0 <_fini+0x105970> > 12034: 31 c0 xor %eax,%eax > 12036: e8 5d 65 ff ff callq 8598 <_init+0x498> > psycopg/adapter_qstring.c:175 > 1203b: e8 98 62 ff ff callq 82d8 <_init+0x1d8> > 12040: 48 89 ef mov %rbp,%rdi > 12043: 48 8b 4b 18 mov 0x18(%rbx),%rcx > 12047: 89 c2 mov %eax,%edx > 12049: 48 8d 35 90 78 10 00 lea 1079440(%rip),%rsi > # 1198e0 <_fini+0x1059b0> > 12050: 31 c0 xor %eax,%eax > 12052: e8 41 65 ff ff callq 8598 <_init+0x498> > 12057: 48 8b 43 18 mov 0x18(%rbx),%rax > psycopg/adapter_qstring.c:177 > 1205b: 48 85 c0 test %rax,%rax > 1205e: 74 8a je 11fea <qstring_str+0x4a> > 12060: eb 81 jmp 11fe3 <qstring_str+0x43> > 12062: 66 data16 > 12063: 66 data16 > 12064: 66 data16 > 12065: 90 nop > 12066: 66 data16 > 12067: 66 data16 > 12068: 66 data16 > 12069: 90 nop > 1206a: 66 data16 > 1206b: 66 data16 > 1206c: 90 nop > 1206d: 66 data16 > 1206e: 66 data16 > 1206f: 90 nop > > The ouput of 'objdump -dl' after recompiling with -O0: > > 0000000000012044 <qstring_str>: > qstring_str(): > psycopg/adapter_qstring.c:168 > 12044: 55 push %rbp > 12045: 48 89 e5 mov %rsp,%rbp > 12048: 48 83 ec 10 sub $0x10,%rsp > 1204c: 48 89 7d f8 mov %rdi,0xfffffffffffffff8(%rbp) > psycopg/adapter_qstring.c:169 > 12050: e8 83 62 ff ff callq 82d8 <_init+0x1d8> > 12055: 89 c2 mov %eax,%edx > 12057: 48 8b 4d f8 mov 0xfffffffffffffff8(%rbp),%rcx > 1205b: 48 8b 05 e6 dc 30 00 mov 3202278(%rip),%rax > # 31fd48 <_GLOBAL_OFFSET_TABLE_+0x6d0> > 12062: 48 8d b8 30 01 00 00 lea 0x130(%rax),%rdi > 12069: 48 8d 35 24 7a 10 00 lea 1079844(%rip),%rsi > # 119a94 <_fini+0x105964> > 12070: b8 00 00 00 00 mov $0x0,%eax > 12075: e8 1e 65 ff ff callq 8598 <_init+0x498> > psycopg/adapter_qstring.c:170 > 1207a: 48 8b 45 f8 mov 0xfffffffffffffff8(%rbp),%rax > 1207e: 48 83 78 18 00 cmpq $0x0,0x18(%rax) > 12083: 0f 85 87 00 00 00 jne 12110 <qstring_str+0xcc> > psycopg/adapter_qstring.c:171 > 12089: 48 8b 7d f8 mov 0xfffffffffffffff8(%rbp),%rdi > 1208d: e8 e8 fc ff ff callq 11d7a <qstring_quote> > psycopg/adapter_qstring.c:172 > 12092: e8 41 62 ff ff callq 82d8 <_init+0x1d8> > 12097: 89 c2 mov %eax,%edx > 12099: 48 8b 4d f8 mov 0xfffffffffffffff8(%rbp),%rcx > 1209d: 48 8b 05 a4 dc 30 00 mov 3202212(%rip),%rax > # 31fd48 <_GLOBAL_OFFSET_TABLE_+0x6d0> > 120a4: 48 8d b8 30 01 00 00 lea 0x130(%rax),%rdi > 120ab: 48 8d 35 e2 79 10 00 lea 1079778(%rip),%rsi > # 119a94 <_fini+0x105964> > 120b2: b8 00 00 00 00 mov $0x0,%eax > 120b7: e8 dc 64 ff ff callq 8598 <_init+0x498> > psycopg/adapter_qstring.c:174 > 120bc: e8 17 62 ff ff callq 82d8 <_init+0x1d8> > 120c1: 89 c2 mov %eax,%edx > 120c3: 48 8b 05 7e dc 30 00 mov 3202174(%rip),%rax > # 31fd48 <_GLOBAL_OFFSET_TABLE_+0x6d0> > 120ca: 48 8d b8 30 01 00 00 lea 0x130(%rax),%rdi > 120d1: 48 8d 35 e8 79 10 00 lea 1079784(%rip),%rsi > # 119ac0 <_fini+0x105990> > 120d8: b8 00 00 00 00 mov $0x0,%eax > 120dd: e8 b6 64 ff ff callq 8598 <_init+0x498> > psycopg/adapter_qstring.c:175 > 120e2: e8 f1 61 ff ff callq 82d8 <_init+0x1d8> > 120e7: 89 c2 mov %eax,%edx > 120e9: 48 8b 45 f8 mov 0xfffffffffffffff8(%rbp),%rax > 120ed: 48 8b 48 18 mov 0x18(%rax),%rcx > 120f1: 48 8b 05 50 dc 30 00 mov 3202128(%rip),%rax > # 31fd48 <_GLOBAL_OFFSET_TABLE_+0x6d0> > 120f8: 48 8d b8 30 01 00 00 lea 0x130(%rax),%rdi > 120ff: 48 8d 35 fa 79 10 00 lea 1079802(%rip),%rsi > # 119b00 <_fini+0x1059d0> > 12106: b8 00 00 00 00 mov $0x0,%eax > 1210b: e8 88 64 ff ff callq 8598 <_init+0x498> > psycopg/adapter_qstring.c:177 > 12110: 48 8b 45 f8 mov 0xfffffffffffffff8(%rbp),%rax > 12114: 48 83 78 18 00 cmpq $0x0,0x18(%rax) > 12119: 75 02 jne 1211d <qstring_str+0xd9> > 1211b: eb 0b jmp 12128 <qstring_str+0xe4> > 1211d: 48 8b 45 f8 mov 0xfffffffffffffff8(%rbp),%rax > 12121: 48 8b 40 18 mov 0x18(%rax),%rax > 12125: 48 ff 00 incq (%rax) > psycopg/adapter_qstring.c:178 > 12128: 48 8b 45 f8 mov 0xfffffffffffffff8(%rbp),%rax > 1212c: 48 8b 40 18 mov 0x18(%rax),%rax > psycopg/adapter_qstring.c:179 > 12130: c9 leaveq > 12131: c3 retq > > And my dmesg: > > OpenBSD 4.1-current (sys) #0: Thu Mar 15 12:56:31 GMT 2007 > root@marcelino.ecmwf.int:/scratch/bld/sys > real mem = 2147020800 (2096700K) > avail mem = 1834733568 (1791732K) > using 22937 buffers containing 214908928 bytes (209872K) of memory > mainbus0 (root) > bios0 at mainbus0: SMBIOS rev. 2.3 @ 0xf0100 (41 entries) > bios0: Gigabyte Technology Co., Ltd. M57SLI-S4 > acpi at mainbus0 not configured > mainbus0: Intel MP Specification (Version 1.4) > cpu0 at mainbus0: apid 0 (boot processor) > cpu0: AMD Athlon(tm) 64 X2 Dual Core Processor 5200+, 2613.76 MHz > cpu0: > FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,P GE,MCA,CMOV,PAT,PSE36,CFLUSH,MMX,FXSR,SSE,SSE2,HTT ,SSE3,CX16,NXE,MMXX,FFXSR,LON > G,3DNOW2,3DNOW > cpu0: 64KB 64b/line 2-way I-cache, 64KB 64b/line 2-way D-cache, 1MB > 64b/line 16-way L2 cache > cpu0: ITLB 32 4KB entries fully associative, 8 4MB entries fully associative > cpu0: DTLB 32 4KB entries fully associative, 8 4MB entries fully associative > cpu0: apic clock running at 201MHz > cpu1 at mainbus0: apid 1 (application processor) > cpu1: AMD Athlon(tm) 64 X2 Dual Core Processor 5200+, 2613.40 MHz > cpu1: > FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,P GE,MCA,CMOV,PAT,PSE36,CFLUSH,MMX,FXSR,SSE,SSE2,HTT ,SSE3,CX16,NXE,MMXX,FFXSR,LON > G,3DNOW2,3DNOW > cpu1: 64KB 64b/line 2-way I-cache, 64KB 64b/line 2-way D-cache, 1MB > 64b/line 16-way L2 cache > cpu1: ITLB 32 4KB entries fully associative, 8 4MB entries fully associative > cpu1: DTLB 32 4KB entries fully associative, 8 4MB entries fully associative > mpbios: bus 0 is type PCI > mpbios: bus 1 is type PCI > mpbios: bus 2 is type PCI > mpbios: bus 3 is type ISA > ioapic0 at mainbus0 apid 2 pa 0xfec00000, version 11, 24 pins > ioapic0: misconfigured as apic 0, remapped to apid 2 > pci0 at mainbus0 bus 0: configuration mode 1 > "NVIDIA MCP55 Memory" rev 0xa1 at pci0 dev 0 function 0 not configured > pcib0 at pci0 dev 1 function 0 "NVIDIA MCP55 ISA" rev 0xa2 > nviic0 at pci0 dev 1 function 1 "NVIDIA MCP55 SMBus" rev 0xa2 > iic0 at nviic0 > iic1 at nviic0 > "NVIDIA MCP55 Memory" rev 0xa2 at pci0 dev 1 function 2 not configured > ohci0 at pci0 dev 2 function 0 "NVIDIA MCP55 USB" rev 0xa1: apic 2 int > 10 (irq 10), version 1.0, legacy support > usb0 at ohci0: USB revision 1.0 > uhub0 at usb0 > uhub0: NVIDIA OHCI root hub, rev 1.00/1.00, addr 1 > uhub0: 10 ports with 10 removable, self powered > ehci0 at pci0 dev 2 function 1 "NVIDIA MCP55 USB" rev 0xa2: apic 2 int > 11 (irq 11) > usb1 at ehci0: USB revision 2.0 > uhub1 at usb1 > uhub1: NVIDIA EHCI root hub, rev 2.00/1.00, addr 1 > uhub1: 10 ports with 10 removable, self powered > pciide0 at pci0 dev 4 function 0 "NVIDIA MCP55 IDE" rev 0xa1: DMA, > channel 0 configured to compatibility, channel 1 configured to compa > tibility > atapiscsi0 at pciide0 channel 0 drive 0 > scsibus0 at atapiscsi0: 2 targets > cd0 at scsibus0 targ 0 lun 0: <Optiarc, DVD RW AD-5170A, 1.11> SCSI0 > 5/cdrom removable > cd0(pciide0:0:0): using PIO mode 4, Ultra-DMA mode 4 > pciide0: channel 1 ignored (disabled) > pciide1 at pci0 dev 5 function 0 "NVIDIA MCP55 SATA" rev 0xa2: DMA > pciide1: using apic 2 int 15 (irq 15) for native-PCI interrupt > wd0 at pciide1 channel 0 drive 0: <WDC WD1600JS-61MHB1> > wd0: 16-sector PIO, LBA48, 152626MB, 312579695 sectors > wd0(pciide1:0:0): using PIO mode 4, Ultra-DMA mode 5 > pciide2 at pci0 dev 5 function 1 "NVIDIA MCP55 SATA" rev 0xa2: DMA > pciide2: using apic 2 int 10 (irq 10) for native-PCI interrupt > pciide3 at pci0 dev 5 function 2 "NVIDIA MCP55 SATA" rev 0xa2: DMA > pciide3: using apic 2 int 11 (irq 11) for native-PCI interrupt > ppb0 at pci0 dev 6 function 0 "NVIDIA MCP55 PCI-PCI" rev 0xa2 > pci1 at ppb0 bus 1 > emu0 at pci1 dev 8 function 0 "Creative Labs SoundBlaster Live" rev > 0x0a: apic 2 int 10 (irq 10) > ac97: codec id 0x83847658 (SigmaTel STAC9758/59) > ac97: codec features headphone, 20 bit DAC, 20 bit ADC, SigmaTel 3D > audio0 at emu0 > "Creative Labs PCI Gameport Joystick" rev 0x0a at pci1 dev 8 function > 1 not configured > "TI TSB43AB23 FireWire" rev 0x00 at pci1 dev 10 function 0 not configured > nfe0 at pci0 dev 8 function 0 "NVIDIA MCP55 LAN" rev 0xa2: apic 2 int > 15 (irq 15), address 00:16:e6:82:64:59 > eephy0 at nfe0 phy 1: Marvell 88E1116 Gigabit PHY, rev. 1 > ppb1 at pci0 dev 15 function 0 "NVIDIA MCP55 PCIE" rev 0xa2 > pci2 at ppb1 bus 2 > vga1 at pci2 dev 0 function 0 "ATI Radeon X300" rev 0x00 > wsdisplay0 at vga1 mux 1: console (80x25, vt100 emulation) > wsdisplay0: screen 1-5 added (80x25, vt100 emulation) > "ATI Radeon X300 Sec" rev 0x00 at pci2 dev 0 function 1 not configured > pchb0 at pci0 dev 24 function 0 "AMD AMD64 HyperTransport" rev 0x00 > pchb1 at pci0 dev 24 function 1 "AMD AMD64 Address Map" rev 0x00 > pchb2 at pci0 dev 24 function 2 "AMD AMD64 DRAM Cfg" rev 0x00 > pchb3 at pci0 dev 24 function 3 "AMD AMD64 Misc Cfg" rev 0x00 > isa0 at pcib0 > isadma0 at isa0 > com0 at isa0 port 0x3f8/8 irq 4: ns16550a, 16 byte fifo > pckbc0 at isa0 port 0x60/5 > pckbd0 at pckbc0 (kbd slot) > pckbc0: using irq 1 for kbd slot > wskbd0 at pckbd0: console keyboard, using wsdisplay0 > pms0 at pckbc0 (aux slot) > pckbc0: using irq 12 for aux slot > wsmouse0 at pms0 mux 0 > pcppi0 at isa0 port 0x61 > midi0 at pcppi0: <PC speaker> > spkr0 at pcppi0 > lpt0 at isa0 port 0x378/4 irq 7 > it0 at isa0 port 0x290/8: IT87 > uaudio0 at uhub1 port 7 configuration 1 interface 2: Logitech product > 0x08ce, rev 2.00/0.05, addr 2 > uaudio0: audio rev 1.00, 2 mixer controls > audio1 at uaudio0 > uhub2 at uhub0 port 8 > uhub2: Chicony Generic USB Hub, rev 1.10/1.00, addr 2 > uhub2: 3 ports with 2 removable, bus powered > uhidev0 at uhub2 port 1 configuration 1 interface 0 > uhidev0: Chicony PFU-65 USB Keyboard, rev 1.10/1.00, addr 3, iclass 3/1 > ukbd0 at uhidev0: 8 modifier keys, 6 key codes > wskbd1 at ukbd0 mux 1 > wskbd1: connecting to wsdisplay0 > dkcsum: wd0 matches BIOS drive 0x80 > root on wd0a > rootdev=0x0 rrootdev=0x300 rawdev=0x302 |