Segfault-Inc / Multicorn

Data Access Library
https://multicorn.org/
PostgreSQL License
700 stars 145 forks source link

Segfault on OS X with PosgreSQL 9.4 #90

Closed rtkrruvinskiy closed 9 years ago

rtkrruvinskiy commented 9 years ago

After getting past #88, I get a segfault with the following stack trace when trying to run create multicorn extension:

Exception Type:        EXC_BAD_ACCESS (SIGSEGV)
Exception Codes:       KERN_INVALID_ADDRESS at 0x00000038150dfed2
....
Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0   postgres                        0x000000010bb9aac9 hash_seq_search + 153
1   multicorn.so                    0x00000001150dd5ee multicorn_xact_callback + 46
2   postgres                        0x000000010b6f8ed9 CallXactCallbacks + 57
3   postgres                        0x000000010b6f4924 CommitTransaction + 164
4   postgres                        0x000000010b6f45a5 CommitTransactionCommand + 133
5   postgres                        0x000000010ba00630 finish_xact_command + 112
6   postgres                        0x000000010b9fe4cf exec_simple_query + 1407
7   postgres                        0x000000010b9fd6de PostgresMain + 2414
8   postgres                        0x000000010b97a809 BackendRun + 633
9   postgres                        0x000000010b979dbc BackendStartup + 428
10  postgres                        0x000000010b9767a7 ServerLoop + 663
11  postgres                        0x000000010b97422c PostmasterMain + 5628
12  postgres                        0x000000010b8c4bb5 main + 773
13  postgres                        0x000000010b662384 start + 52

I wanted to post to see if this was, perhaps, a known issue before starting to debug or maybe someone could suggest what to start looking at.

Multicorn was compiled from GitHub master. Other version information:

$ uname -a
Darwin MacBook-Pro.local 14.0.0 Darwin Kernel Version 14.0.0: Fri Sep 19 00:26:44 PDT 2014; root:xnu-2782.1.97~2/RELEASE_X86_64 x86_64
$ postgres --version
postgres (PostgreSQL) 9.4.0

PostgreSQL was installed from http://postgresapp.com.

rtkrruvinskiy commented 9 years ago

I finally got the chance to debug this. The issue turned out to be that a function called hash_create (unrelated to Postgres') was defined in libsystem_c.dylib, and that's the function the linker chose at runtime over the hash_create in the postgres executable. Another change to the link line was required.