Re: PostgreSQL 14: pg_dump / pg_restore error: could not write to the communication channel: Broken pipe

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>
Cc: Nick Renders <postgres(at)arcict(dot)com>, pgsql-general(at)lists(dot)postgresql(dot)org
Subject: Re: PostgreSQL 14: pg_dump / pg_restore error: could not write to the communication channel: Broken pipe
Date: 2021-10-15 16:33:00
Message-ID: 961250.1634315580@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org> writes:
> On 2021-Oct-15, Nick Renders wrote:
>> I have been trying to import a Postgres 11 database into Postgres 14, but
>> the pg_restore command exits with the following message:
>> pg_restore: error: could not write to the communication channel: Broken
>> pipe
>>
>> It seems that the multiple jobs parameter is the cause. If I specify "-j 1",
>> the command works without problems. If I specify "-j 2" or higher, I get the
>> above error after a few seconds.

> Yeah, pg_dump in parallel mode uses a pipe to communicate between leader
> and workers; the error you see is what happens when a write to the pipe
> fails. It sounds to me like something in the operating system is
> preventing the pipes from working properly. I don't know anything about
> macOS so I can't help you with that. I can tell you however that this
> error has not been reported previously.

I tried to reproduce this on my own 2019 MacBook Pro running Big Sur
(11.6), without success. I made a test database with

do $$
begin
for i in 1..5000 loop
execute 'create table t'||i||' as select generate_series(1,100000) x';
end loop;
end $$;

and then ran dumps and restores with the same parameters you used.
No sign of trouble.

I concur with the request to look in the postmaster log to see if
anything interesting shows up on that side. Also, does the
behavior change if you don't use "-h localhost" but instead let it
default to a Unix socket? (I don't have any real reason to think
that it would change, but we're grasping at straws here.)

regards, tom lane

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2021-10-15 17:08:14 Re: PostgreSQL 14: pg_dump / pg_restore error: could not write to the communication channel: Broken pipe
Previous Message Tom Lane 2021-10-15 15:49:28 Re: postgres ssl client certificate authentification