public inbox for [email protected]  
help / color / mirror / Atom feed
From: Andres Freund <[email protected]>
To: Juan José Santamaría Flecha <[email protected]>
Cc: PostgreSQL Hackers <[email protected]>
Subject: Re: pg_receivewal.exe unhandled exception in zlib1.dll
Date: Fri, 11 Feb 2022 07:50:44 -0800
Message-ID: <[email protected]> (raw)
In-Reply-To: <CAC+AXB1iY4pM=o55OBuUy30LmUo5hjY83=TcA-NgY3CGZpzJmA@mail.gmail.com>
References: <CAC+AXB1iY4pM=o55OBuUy30LmUo5hjY83=TcA-NgY3CGZpzJmA@mail.gmail.com>

Hi,

On 2022-02-11 16:33:11 +0100, Juan José Santamaría Flecha wrote:
> If you execute pg_receivewal.exe with the option "--compression-method
> gzip" it will fail with no error. You can see an error in the db log:
> 
> 2022-02-10 11:46:32.725 CET [11664][walsender] [pg_receivewal][3/0:0] LOG:
> could not receive data from client: An existing connection was forcibly
> closed by the remote host.
> 
> Tracing the execution you can see:
> 
> Unhandled exception at 0x00007FFEA78C1208 (ucrtbase.dll) in An invalid
> parameter was passed to a function that considers invalid parameters fatal.
>   ucrtbase.dll!00007ff8e8ae36a2() Unknown
> > zlib1.dll!gz_comp(gz_state * state, int flush) Line 111 C
>   zlib1.dll!gz_write(gz_state * state, const void * buf, unsigned __int64
> len) Line 235 C
>   pg_receivewal.exe!dir_write(void * f, const void * buf, unsigned __int64
> count) Line 300 C
>   pg_receivewal.exe!ProcessXLogDataMsg(pg_conn * conn, StreamCtl * stream,
> char * copybuf, int len, unsigned __int64 * blockpos) Line 1150 C
>   pg_receivewal.exe!HandleCopyStream(pg_conn * conn, StreamCtl * stream,
> unsigned __int64 * stoppos) Line 850 C
>   pg_receivewal.exe!ReceiveXlogStream(pg_conn * conn, StreamCtl * stream)
> Line 605 C
>   pg_receivewal.exe!StreamLog() Line 636 C
>   pg_receivewal.exe!main(int argc, char * * argv) Line 1005 C
> 
> The problem comes from the file descriptor passed to gzdopen() in
> 'src/bin/pg_basebackup/walmethods.c'. Using gzopen() instead, solves the
> issue without ifdefing for WIN32. Please find attached a patch for so.

I hit this as well. The problem is really caused by using a debug build of
postgres vs a production build of zlib. The use different C runtimes, with
different file descriptors. A lot of resources in the windows world are
unfortunately tied to the C runtime and that there can multiple C runtimes in
a single process.

Greetings,

Andres Freund






view thread (3+ messages)  latest in thread

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected], [email protected], [email protected]
  Subject: Re: pg_receivewal.exe unhandled exception in zlib1.dll
  In-Reply-To: <[email protected]>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox