Re: dup(0) fails on Ubuntu 20.04 and macOS 10.15 with 13.0 - Mailing list pgsql-general

From Mario Emmenlauer
Subject Re: dup(0) fails on Ubuntu 20.04 and macOS 10.15 with 13.0
Date
Msg-id 1c4c2254-1812-2913-8630-18d4b9262a89@emmenlauer.de
Whole thread Raw
In response to dup(0) fails on Ubuntu 20.04 and macOS 10.15 with 13.0  (Mario Emmenlauer <mario@emmenlauer.de>)
List pgsql-general
On 05.10.20 14:35, Tom Lane wrote:
> Mario Emmenlauer <mario@emmenlauer.de> writes:
>> I get reproducibly the error:
>> 2020-10-05 11:48:19.720 CEST [84731] WARNING:  dup(0) failed after 0 successes: Bad file descriptor
> 
> Hmph.  That code loop assumes that stdin exists to be duplicated,
> but maybe if it had been closed, you'd get this error.
> 
> However, that logic hasn't changed in decades, and we've not heard
> complaints about it before.  Are you starting the server in some
> unusual way?

Replying to a very old thread here: I could indeed trace the problem of
the failing `dup(0)` back to how we start the server! We start the
server from an executable that closes stdin very early on, and this
seems to lead to the problem.

We solved it by not closing stdin. But for future reference, if other
people may be affected by this, the code could probably be modified to
revert to stdout or stderr or a temporary file in case stdin is not
available (guessing here...).

All the best,

    Mario Emmenlauer



pgsql-general by date:

Previous
From: A Z
Date:
Subject: Question about creation of a new PostgreSQL Extension.
Next
From:
Date:
Subject: oldest WAL files not removed