Alvaro Herrera <alvherre@alvh.no-ip.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