Segmentation fault with pg_restore

Started by Keiko Odaover 9 years ago5 messagesbugs
Jump to latest
#1Keiko Oda
keiko@heroku.com

Hello,

I'm seeing "Segmentation fault" with a following pg_restore command, with
the certain dump file (attached to this email, I had to remove some data
from the file as the dump file contains the data that cannot be shared
publicly, but I can reproduce this with full dump file also):

$ pg_restore -l nocnoc_segfault.dump
Segmentation fault: 11

Here is my environment, but I was able to reproduce this in the other place
as well (e.g. Ubuntu 14.04):

Process: pg_restore [64478]
Path: /usr/local/Cellar/postgresql/9.5.2/bin/pg_restore
Identifier: pg_restore
Version: 0
Code Type: X86-64 (Native)
Parent Process: bash [55643]
Responsible: Terminal [1371]
OS Version: Mac OS X 10.11.6 (15G1004)

Here is the environment that the dump file was created:

Docker image "latest" from https://hub.docker.com/_/postgres/ (version
9.5)
The creator has the dump file in a container with no volumes, so he
extracted the dump using a following command:
docker exec -t nocnoc_db_1 cat /backup/nocnoc_api_development.dump >
nocnoc_api_development.dump
The backup was taking with a following command:
pg_dump -Fc --no-acl --no-owner nocnoc_api_development

The dump file's format is dos when you open with vim, and if you change
this to unix (:set ff=unix) and save it, the segmentation fault will go
away and it gives you an expected error (it raises an error since I removed
some data from the dump file, the file is not in the perfect shape. If I
tried to restore the full dump file with the unix file format, it works
fine):

$ pg_restore -l nocnoc_unix.dump
pg_restore: [custom archiver] could not read from input file: end of file

Please let me know if there is any other information that I could provide.

Thanks!
Keiko Oda

Attachments:

nocnoc_segfault.dumpapplication/octet-stream; name=nocnoc_segfault.dumpDownload
#2John R Pierce
pierce@hogranch.com
In reply to: Keiko Oda (#1)
Re: Segmentation fault with pg_restore

On 9/20/2016 3:30 PM, Keiko Oda wrote:

pg_dump -Fc --no-acl --no-owner nocnoc_api_development

The dump file's format is dos....

a -Fc dumpfile's format should be compressed binary, not text.

--
john r pierce, recycling bits in santa cruz

--
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs

In reply to: John R Pierce (#2)
Re: Segmentation fault with pg_restore

On Tue, Sep 20, 2016 at 11:41 PM, John R Pierce <pierce@hogranch.com> wrote:

a -Fc dumpfile's format should be compressed binary, not text.

So? It still shouldn't segfault.

--
Peter Geoghegan

--
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs

#4John R Pierce
pierce@hogranch.com
In reply to: Peter Geoghegan (#3)
Re: Segmentation fault with pg_restore

On 9/20/2016 3:48 PM, Peter Geoghegan wrote:

On Tue, Sep 20, 2016 at 11:41 PM, John R Pierce<pierce@hogranch.com> wrote:

a -Fc dumpfile's format should be compressed binary, not text.

So? It still shouldn't segfault.

my point is, compressed binary files aren't 'DOS' *or* Unix, they are
BINARY, so if vim sees ascii data, you're not looking at the right file.

--
john r pierce, recycling bits in santa cruz

#5Tom Lane
tgl@sss.pgh.pa.us
In reply to: Keiko Oda (#1)
Re: Segmentation fault with pg_restore

Keiko Oda <keiko@heroku.com> writes:

I'm seeing "Segmentation fault" with a following pg_restore command, with
the certain dump file (attached to this email, I had to remove some data
from the file as the dump file contains the data that cannot be shared
publicly, but I can reproduce this with full dump file also):

This file is corrupt. I think what's happened to it is it went through
a Unix->Windows text conversion, replacing bytes that happened to look
like newlines with \r\n.

The fact that pg_restore segfaulted isn't terribly nice, but the best
we could do is give you some nondescript message saying there's something
wrong with the file ...

regards, tom lane

--
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs