pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Chao Li <li.evan.chao@gmail.com>
Cc: pgsql-hackers <pgsql-hackers@lists.postgresql.org>
Cc: Robert Haas <robertmhaas@gmail.com>
Subject: Re: astreamer_lz4: fix bug of output pointer advancement in decompressor
Date: Wed, 04 Mar 2026 12:16:55 -0500
Message-ID: <1531718.1772644615@sss.pgh.pa.us> (raw)
In-Reply-To: <0594CC79-1544-45DD-8AA4-26270DE777A7@gmail.com>
References: <0594CC79-1544-45DD-8AA4-26270DE777A7@gmail.com>

Chao Li <li.evan.chao@gmail.com> writes:
> There have been a couple of LZ4-related patches recently, so I spent some time playing with the LZ4 path and found a bug in astreamer_lz4_decompressor_content().

Yup, that's clearly wrong.  I failed to reproduce a crash with the
test hack you suggested, but no matter.  Pushed with some cosmetic
editorialization.

The track record of all this client-side-compression logic is
really quite awful :-(.  Another thing that I'm looking askance
at is the error handling, or rather lack of it:

        ret = LZ4F_decompress(mystreamer->dctx,
                              next_out, &out_size,
                              next_in, &read_size, NULL);

        if (LZ4F_isError(ret))
            pg_log_error("could not decompress data: %s",
                         LZ4F_getErrorName(ret));

        ... continue on our merry way ...

I suspect whoever wrote this thought pg_log_error is equivalent
to elog(ERROR), but it's not; it just prints a message.  It seems
highly unlikely to me that continuing onwards will result in a
good outcome.  I'm a bit inclined to s/pg_log_error/pg_fatal/
throughout these files, at least in places where there's no
visible effort to handle the error.

			regards, tom lane





view thread (7+ messages)  latest in thread

Message-ID: <1531718.1772644615@sss.pgh.pa.us>
Permalink:  ../1531718.1772644615@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/1531718.1772644615@sss.pgh.pa.us

 · 

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: pgsql-hackers@postgresql.org
  Cc: tgl@sss.pgh.pa.us, li.evan.chao@gmail.com, pgsql-hackers@lists.postgresql.org, robertmhaas@gmail.com
  Subject: Re: astreamer_lz4: fix bug of output pointer advancement in decompressor
  In-Reply-To: <1531718.1772644615@sss.pgh.pa.us>

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

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