Thread: Segmentation Fault during database restoration

Segmentation Fault during database restoration

From
Sulman Sarwar
Date:
Hi,

I am new to PostgreSQL. I have been trying to restore a compressed(.gz) database using

gunzip -c filename.gz | psql dbname
After some 8 or 9 tables are restored the program exists giving error: Segmentation Fault.

I have attached the crash report below.

----------------------------------------------------------------
Process:         psql [362]
Path:            /Library/PostgreSQL/8.4/bin/psql
Identifier:      psql
Version:         ??? (???)
Code Type:       X86 (Native)
Parent Process:  bash [279]

Date/Time:       2009-09-16 23:06:29.065 +0100
OS Version:      Mac OS X 10.5.8 (9L30)
Report Version:  6
Anonymous UUID:  E980E439-11E5-4B08-BBAA-ECABD8719349

Exception Type:  EXC_BAD_ACCESS (SIGSEGV)
Exception Codes: KERN_INVALID_ADDRESS at 0x00000000014fffff
Crashed Thread:  0

Thread 0 Crashed:
0   psql                                0x0000d3b5 gets_fromFile + 296
1   psql                                0x0000df73 MainLoop + 613
2   psql                                0x00010d7a main + 2394
3   psql                                0x00003fc2 _start + 216
4   psql                                0x00003ee9 start + 41

Thread 0 crashed with X86 Thread State (32-bit):
  eax: 0x014fffff  ebx: 0x0000d29c  ecx: 0x00000000  edx: 0x01500000
  edi: 0x00302866  esi: 0xbffff674  ebp: 0xbffff3b8  esp: 0xbfffef80
   ss: 0x0000001f  efl: 0x00010216  eip: 0x0000d3b5   cs: 0x00000017
   ds: 0x0000001f   es: 0x0000001f   fs: 0x00000000   gs: 0x00000037
  cr2: 0x014fffff

Binary Images:
    0x1000 -    0x5243f +psql ??? (???) /Library/PostgreSQL/8.4/bin/psql
   0x5c000 -    0x7aa0f +libpq.5.2.dylib ??? (???) /Library/PostgreSQL/8.4/lib/libpq.5.2.dylib
   0x84000 -    0x8dfe3  libpam.1.dylib ??? (???) <18edc8caade04f4f81e1dd9712b51abc> /usr/lib/libpam.1.dylib
   0x93000 -    0xa9fea  libedit.2.dylib ??? (???) <eb7bc965302ee8d47e585dbbfd82c938> /usr/lib/libedit.2.dylib
  0x17b000 -   0x2c2fef +libxml2.2.dylib ??? (???) /Library/PostgreSQL/8.4/lib/libxml2.2.dylib
0x8fe00000 - 0x8fe2db43  dyld 97.1 (???) <458eed38a009e5658a79579e7bc26603> /usr/lib/dyld
0x90cde000 - 0x90e45ff3  libSystem.B.dylib ??? (???) <ae47ca9b1686b065f8ac4d2de09cc432> /usr/lib/libSystem.B.dylib
0x90e4b000 - 0x90e6ffeb  libssl.0.9.7.dylib ??? (???) <3aead3bb2aee39ceff1531c655cdc801> /usr/lib/libssl.0.9.7.dylib
0x91bab000 - 0x91c9fff4  libiconv.2.dylib ??? (???) <96ff4c6f84c4a1623cb78287371cdd3f> /usr/lib/libiconv.2.dylib
0x91ca0000 - 0x91cfdffb  libstdc++.6.dylib ??? (???) <7d389389a99ce696726cf4c8980cc505> /usr/lib/libstdc++.6.dylib
0x926b1000 - 0x926b5fff  libmathCommon.A.dylib ??? (???) /usr/lib/system/libmathCommon.A.dylib
0x92819000 - 0x92844fe7  libauto.dylib ??? (???) <2e44c523b851e8e25f05d13a48070a58> /usr/lib/libauto.dylib
0x9284c000 - 0x9297ffe7  com.apple.CoreFoundation 6.5.7 (476.19) <a332c8f45529ee26d2e9c36d0c723bad> /System/Library/Frameworks/CoreFoun
dation.framework/Versions/A/CoreFoundation
0x92ca2000 - 0x92d54ffb  libcrypto.0.9.7.dylib ??? (???) <adb50814ede29b88f370b1c8712bc93e> /usr/lib/libcrypto.0.9.7.dylib
0x93184000 - 0x93355ffb  com.apple.security 5.0.5 (36371) <1f7f48b36bc90d114220cc81e4e4694f> /System/Library/Frameworks/Security.framew
ork/Versions/A/Security
0x949c8000 - 0x949d6ffd  libz.1.dylib ??? (???) <a98b3b221a72b54faf73ded3dd7000e5> /usr/lib/libz.1.dylib
0x94c90000 - 0x94cbfff7  libncurses.5.4.dylib ??? (???) <d14a12e66edb347d4ce52089b17e3d24> /usr/lib/libncurses.5.4.dylib
0x952ae000 - 0x953e7ff7  libicucore.A.dylib ??? (???) <dd8aa51c356e79ef8cdfa341a0d69f5b> /usr/lib/libicucore.A.dylib
0x956c7000 - 0x956cefe9  libgcc_s.1.dylib ??? (???) <e280ddf3f5fb3049e674edcb109f389a> /usr/lib/libgcc_s.1.dylib
0x965ae000 - 0x965ccfff  libresolv.9.dylib ??? (???) <39f6d8651f3dca7a1534fa04322e6763> /usr/lib/libresolv.9.dylib
0x9663b000 - 0x9671bfff  libobjc.A.dylib ??? (???) <d1469bf9fe852864d4fff185c72768e8> /usr/lib/libobjc.A.dylib
0x96d3d000 - 0x96dedfff  edu.mit.Kerberos 6.0.13 (6.0.13) <6f91042bf8a860731add9dcb09b5cb73> /System/Library/Frameworks/Kerberos.framew
ork/Versions/A/Kerberos
0xfffe8000 - 0xfffebfff  libobjc.A.dylib ??? (???) /usr/lib/libobjc.A.dylib
0xffff0000 - 0xffff1780  libSystem.B.dylib ??? (???) /usr/lib/libSystem.B.dylib

-----------------------------------------------------------------

any clues??

Regards,

Sulman.

Re: Segmentation Fault during database restoration

From
Tom Lane
Date:
Sulman Sarwar <sulmansarwar@gmail.com> writes:
> I am new to PostgreSQL. I have been trying to restore a compressed(.gz)
> database using
> gunzip -c *filename*.gz | psql *dbname*
> After some 8 or 9 tables are restored the program exists giving error:
> Segmentation Fault.

That's weird ... gets_fromFile certainly looks pretty bulletproof from
here.  Can you extract a self-contained test case?  Also, did you build
the psql executable yourself, or get it from somewhere else, and if so
where?

            regards, tom lane

Re: Segmentation Fault during database restoration

From
Craig Ringer
Date:
On Wed, 2009-09-16 at 23:32 +0100, Sulman Sarwar wrote:
Hi,

I am new to PostgreSQL. I have been trying to restore a compressed(.gz) database using

Just out of interest, how did you install PostgreSQL?

Did you install a pre-built binary? If so, from where?

Guessing from the paths, it doesn't look like you built it yourself or used something like MacPorts, but it's better to know than guess.

I ask in particular because there have been big problems caused by building PostgreSQL as a universal binary. It seems to be important to configure it and build it only for the architecture you're actually using. That probably goes for ia32 vs x86_64 as well as ppc32/ppc64 .

--
Craig Ringer

Re: Segmentation Fault during database restoration

From
Tom Lane
Date:
Craig Ringer <craig@postnewspapers.com.au> writes:
> I ask in particular because there have been big problems caused by
> building PostgreSQL as a universal binary. It seems to be important to
> configure it and build it only for the architecture you're actually
> using. That probably goes for ia32 vs x86_64 as well as ppc32/ppc64 .

Well, it's possible to do it but it's not easy --- you need to deal
with the fact that the configure-generated headers should be different
for the different arches.  There were some discussions in -hackers
last year about how to do it.

The reported location of the error is not code that I would expect to be
subject to architectural issues, though, so I suspect this isn't
immediately relevant.

            regards, tom lane

Re: Segmentation Fault during database restoration

From
Sulman Sarwar
Date:
I used one click installer for Mac OSX from EnterpriseDB.

http://www.enterprisedb.com/products/pgdownload.do#osx


On Thu, Sep 17, 2009 at 4:10 AM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
Craig Ringer <craig@postnewspapers.com.au> writes:
> I ask in particular because there have been big problems caused by
> building PostgreSQL as a universal binary. It seems to be important to
> configure it and build it only for the architecture you're actually
> using. That probably goes for ia32 vs x86_64 as well as ppc32/ppc64 .

Well, it's possible to do it but it's not easy --- you need to deal
with the fact that the configure-generated headers should be different
for the different arches.  There were some discussions in -hackers
last year about how to do it.

The reported location of the error is not code that I would expect to be
subject to architectural issues, though, so I suspect this isn't
immediately relevant.

                       regards, tom lane



--