pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Alexander Lakhin <exclusion@gmail.com>
To: Michael Paquier <michael@paquier.xyz>
Cc: Tom Lane <tgl@sss.pgh.pa.us>
Cc: a.kozhemyakin@postgrespro.ru
Cc: pgsql-bugs@lists.postgresql.org
Subject: Re: BUG #18483: Segmentation fault in tests modules
Date: Mon, 10 Jun 2024 11:00:00 +0300
Message-ID: <d959bd09-3bce-6a5e-7ae0-dff761f8ad81@gmail.com> (raw)
In-Reply-To: <ZmaUKZOmjv-L9EvK@paquier.xyz>
References: <18483-30bfff42de238000@postgresql.org>
	<Zl5GS6SHBXRAkl_c@paquier.xyz>
	<219049.1717792376@sss.pgh.pa.us>
	<ZmOJ3jfeltZQnN_M@paquier.xyz>
	<439c9310-1d71-f2c6-b213-a9a2ea732ba9@gmail.com>
	<336833.1717859243@sss.pgh.pa.us>
	<250a21e5-d677-6b2a-2692-cd4233785e37@gmail.com>
	<ZmaUKZOmjv-L9EvK@paquier.xyz>

Hello Michael,

10.06.2024 08:50, Michael Paquier wrote:
> On Sun, Jun 09, 2024 at 03:00:00PM +0300, Alexander Lakhin wrote:
>> 2)
>> echo "
>> select test_enc_conversion('\x8bc68bcf8b', 'gb18030', 'gb18030', false);
>> " >> src/test/regress/sql/conversion.sql
>> TESTS="conversion" make -s check-tests
>>
>> produces (under Valgrind):
>> ==00:00:00:05.947 3320530== Invalid read of size 1
>> ==00:00:00:05.947 3320530==    at 0x6F21E5: pg_gb18030_mblen (wchar.c:1000)
>> ==00:00:00:05.947 3320530==    by 0x6F2BA0: pg_encoding_mblen (wchar.c:2072)
>> ==00:00:00:05.947 3320530==    by 0x6B4EAF: report_invalid_encoding (mbutils.c:1700)
>> ==00:00:00:05.947 3320530==    by 0x4867D3F: test_enc_conversion (regress.c:1154)
>> ==00:00:00:05.947 3320530==    by 0x3B9796: ExecInterpExpr (execExprInterp.c:764)
>>
>> If I understand correctly, the defect is inside test_enc_conversion(), not
>> in the core code.
> Interesting, I cannot see this one, did you use a specific option with
> valgrind?

Thanks for your interest to it!

My Valgrind-testing procedure is:
git apply .../install-vrunner.patch # use the attached
CPPFLAGS="-Og -DUSE_VALGRIND" ./configure -q && make -j8 -s

echo "
select test_enc_conversion('\x8bc68bcf8b', 'gb18030', 'gb18030', false);
" >> src/test/regress/sql/conversion.sql
TESTS="conversion" make -s check-tests

not ok 1     - conversion                               3189 ms
# (test process exited with exit code 2)

Best regards,
Alexander

Attachments:

install-vrunner.patch (text/x-patch, 1.9K) download diff --git a/install-vrunner.sh b/install-vrunner.sh new file mode 100755 index 00000000000..21881d4c729 --- /dev/null +++ b/install-vrunner.sh @@ -0,0 +1,31 @@ +#!/bin/bash +set -e + +SRCDIR=$1 +PGBIN=$2 + +cd $PGBIN +cp $SRCDIR/src/tools/valgrind.supp ./ + +echo "" +cat << 'EOF' > vrunner +#!/bin/bash +set -e +BD="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" +SN="$(basename "${BASH_SOURCE[0]}")" +OBIN="_$SN" +[[ $LD_PRELOAD = *"valgrind"* ]] && exec $BD/$OBIN "$@" + +exec valgrind --quiet --exit-on-first-error=yes --track-origins=no --error-exitcode=1 --leak-check=no --time-stamp=yes \ + --gen-suppressions=all --suppressions=$BD/valgrind.supp \ + --trace-children=yes --trace-children-skip="/bin/*,/usr/bin/*" \ + $BD/$OBIN "$@" +EOF +chmod a+x vrunner + +for f in *; do + if [ "$f" = "vrunner" ] || [ ! -x "$f" ]; then continue; fi + mv "$f" "_$f" + ln -s vrunner "$f" + chmod a+x "$f" +done diff --git a/src/Makefile.global.in b/src/Makefile.global.in index 884d66920b6..87af7fd9ab8 100644 --- a/src/Makefile.global.in +++ b/src/Makefile.global.in @@ -411,2 +411,3 @@ ifeq ($(MAKELEVEL),0) $(MAKE) -j1 $(if $(CHECKPREP_TOP),-C $(CHECKPREP_TOP),) checkprep >>'$(abs_top_builddir)'/tmp_install/log/install.log 2>&1 + '$(abs_top_builddir)'/install-vrunner.sh '$(abs_top_builddir)' '$(abs_top_builddir)/tmp_install$(bindir)' diff --git a/src/bin/pg_ctl/pg_ctl.c b/src/bin/pg_ctl/pg_ctl.c index 7f427e7d60e..e6115881f6b 100644 --- a/src/bin/pg_ctl/pg_ctl.c +++ b/src/bin/pg_ctl/pg_ctl.c @@ -620,12 +620,7 @@ wait_for_postmaster(pgpid_t pm_pid, bool do_checkpoint) pmpid = atol(optlines[LOCK_FILE_LINE_PID - 1]); pmstart = atol(optlines[LOCK_FILE_LINE_START_TIME - 1]); if (pmstart >= start_time - 2 && -#ifndef WIN32 - pmpid == pm_pid -#else - /* Windows can only reject standalone-backend PIDs */ - pmpid > 0 -#endif + pmpid == pm_pid && kill(pmpid, 0) == 0 ) { /*

view thread (16+ messages)  latest in thread

Message-ID: <d959bd09-3bce-6a5e-7ae0-dff761f8ad81@gmail.com>
Permalink:  ../d959bd09-3bce-6a5e-7ae0-dff761f8ad81@gmail.com/
Also on:    postgresql.org/message-id/d959bd09-3bce-6a5e-7ae0-dff761f8ad81@gmail.com

 ·  · 

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-bugs@postgresql.org
  Cc: exclusion@gmail.com, michael@paquier.xyz, tgl@sss.pgh.pa.us, a.kozhemyakin@postgrespro.ru, pgsql-bugs@lists.postgresql.org
  Subject: Re: BUG #18483: Segmentation fault in tests modules
  In-Reply-To: <d959bd09-3bce-6a5e-7ae0-dff761f8ad81@gmail.com>

* 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