ZhengYang/odbc_fdw — Issue #1: server crash on query
Author: desoi
Created: 2011-12-04 15:30:20+00:00
State: open

Hi,

Setup: OS X 10.6.8; ODBC database is 4th Dimension (4D) 12.3.

I setup a simple example with 1 field based on the example found in the readme file. I have verified the connection works using a different application. When I try to run a simple select query, postgres crashes (log below). I have also included a crash backtrace. 4D is not a 64 bit application. Could this be the problem?

LOG: server process (PID 19335) was terminated by signal 11: Segmentation fault
LOG: terminating any other active server processes
WARNING: terminating connection because of crash of another server process
DETAIL: The postmaster has commanded this server process to roll back the current transaction and exit, because another server process exited abnormally and possibly corrupted shared memory.
HINT: In a moment you should be able to reconnect to the database and repeat your command.
LOG: all server processes terminated; reinitializing

Process: postgres [19335]
Path: /sw/postgresql-9.1.1/bin/postgres
Identifier: postgres
Version: ??? (???)
Code Type: X86-64 (Native)
Parent Process: postgres [16402]

Date/Time: 2011-12-04 10:16:23.747 -0500
OS Version: Mac OS X 10.6.8 (10K549)
Report Version: 6

Exception Type: EXC_BAD_ACCESS (SIGSEGV)
Exception Codes: KERN_INVALID_ADDRESS at 0x0000000000000538
Crashed Thread: 0 Dispatch queue: com.apple.main-thread

Thread 0 Crashed: Dispatch queue: com.apple.main-thread
0 odbc_fdw.so	0x00000001007701a8 SQLAllocStmt_Internal + 49
1 odbc_fdw.so	0x000000010077e108 SQLAllocHandle_Internal + 234
2 odbc_fdw.so	0x000000010077e47b SQLAllocHandle + 208
3 odbc_fdw.so	0x00000001007619f5 odbcGetTableSize + 277
4 odbc_fdw.so	0x0000000100761dcb odbcPlanForeignScan + 251
5 postgres	0x000000010019ea08 create_foreignscan_path + 120
6 postgres	0x0000000100176e84 set_rel_pathlist + 3844
7 postgres	0x000000010017716b make_one_rel + 107
8 postgres	0x000000010018cae4 query_planner + 548
9 postgres	0x000000010018e41d grouping_planner + 3117
10 postgres	0x00000001001901fd subquery_planner + 2125
11 postgres	0x0000000100190559 standard_planner + 233
12 postgres	0x00000001001f0809 pg_plan_query + 73
13 postgres	0x00000001001f08dc pg_plan_queries + 92
14 postgres	0x00000001001f1e11 exec_simple_query + 369
15 postgres	0x00000001001f2b11 PostgresMain + 2049
16 postgres	0x00000001001b1eb8 ServerLoop + 2792
17 postgres	0x00000001001b2d62 PostmasterMain + 2658
18 postgres	0x000000010014f275 main + 933
19 postgres	0x0000000100001384 start + 52

Thread 0 crashed with X86 Thread State (64-bit):
rax: 0x0000000000000000 rbx: 0x0000000100602640 rcx: 0x00007fff70c57650 rdx: 0x00000000000fc080
rdi: 0x0000000100602640 rsi: 0x00007fff5fbfd4c8 rbp: 0x00007fff5fbfd370 rsp: 0x00007fff5fbfd310
r8: 0x0000000000000000 r9: 0x00000001006024e0 r10: 0x0000000000000000 r11: 0x0000000000000004
r12: 0x0000000100602640 r13: 0x00007fff5fbfd4c8 r14: 0x0000000100602640 r15: 0x00000001007a0820
rip: 0x00000001007701a8 rfl: 0x0000000000010202 cr2: 0x0000000000000538

Binary Images:
0x100000000 - 0x100484fff +postgres ??? (???) <6C557CC4-B14F-B825-2E80-BE9BF5FB1EA3> /sw/postgresql-9.1.1/bin/postgres
0x100760000 - 0x10079dfff +odbc_fdw.so ??? (???) <80E894DF-A8ED-B9F7-E981-D09BD0E0F5EC> /sw/postgresql-test/lib/odbc_fdw.so
0x7fff5fc00000 - 0x7fff5fc3bdef dyld 132.1 (???) <486E6C61-1197-CC7C-2197-82CE505102D7> /usr/lib/dyld
0x7fff85b01000 - 0x7fff85b05ff7 libmathCommon.A.dylib 315.0.0 (compatibility 1.0.0) <95718673-FEEE-B6ED-B127-BCDBDB60D4E5> /usr/lib/system/libmathCommon.A.dylib
0x7fff868b8000 - 0x7fff86a79fef libSystem.B.dylib 125.2.11 (compatibility 1.0.0) <9AB4F1D1-89DC-0E8A-DC8E-A4FE4D69DB69> /usr/lib/libSystem.B.dylib
0x7fffffe00000 - 0x7fffffe01fff libSystem.B.dylib ??? (???) <9AB4F1D1-89DC-0E8A-DC8E-A4FE4D69DB69> /usr/lib/libSystem.B.dylib