Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit ae0f7b1

Browse files
committed
Paper over regression failures in infinite_recurse() on PPC64 Linux.
Our infinite_recurse() test to verify sane stack-overrun behavior is affected by a bug of the Linux kernel on PPC64: it will get SIGSEGV if it receives a signal when the stack depth is (a) over 1MB and (b) within a few kB of filling the current physical stack allocation. See https://bugzilla.kernel.org/show_bug.cgi?id=205183. Since this test is a bit time-consuming and we run it in parallel with test scripts that do a lot of DDL, it can be expected to get an sinval catchup interrupt at some point, leading to failure if the timing is wrong. This has caused more than 100 buildfarm failures over the past year or so. While a fix exists for the kernel bug, it might be years before that propagates into all production kernels, particularly in some of the older distros we have in the buildfarm. For now, let's just back off and not run this test on Linux PPC64; that loses nothing in test coverage so far as our own code is concerned. To do that, split this test into a new script infinite_recurse.sql and skip the test when the platform name is powerpc64...-linux-gnu. Back-patch to v12. Branches before that have not been seen to get this failure. No doubt that's because the "errors" test was not run in parallel with other tests before commit 798070e, greatly reducing the odds of an sinval catchup being necessary. I also back-patched 3c85535 into v12, just so the new regression script would look the same in all branches having it. Discussion: https://postgr.es/m/3479046.1602607848@sss.pgh.pa.us Discussion: https://postgr.es/m/20190723162703.GM22387%40telsasoft.com
1 parent 1375422 commit ae0f7b1

File tree

7 files changed

+71
-20
lines changed

7 files changed

+71
-20
lines changed

src/test/regress/expected/errors.out

-10
Original file line numberDiff line numberDiff line change
@@ -440,13 +440,3 @@ NULL);
440440
ERROR: syntax error at or near "NUL"
441441
LINE 16: ...L, id2 TEXT NOT NULL PRIMARY KEY, id3 INTEGER NOT NUL, id4 I...
442442
^
443-
-- Check that stack depth detection mechanism works and
444-
-- max_stack_depth is not set too high. The full error report is not
445-
-- very stable, so show only SQLSTATE and primary error message.
446-
create function infinite_recurse() returns int as
447-
'select infinite_recurse()' language sql;
448-
\set VERBOSITY sqlstate
449-
select infinite_recurse();
450-
ERROR: 54001
451-
\echo :LAST_ERROR_MESSAGE
452-
stack depth limit exceeded
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
-- Check that stack depth detection mechanism works and
2+
-- max_stack_depth is not set too high.
3+
create function infinite_recurse() returns int as
4+
'select infinite_recurse()' language sql;
5+
-- Unfortunately, up till mid 2020 the Linux kernel had a bug in PPC64
6+
-- signal handling that would cause this test to crash if it happened
7+
-- to receive an sinval catchup interrupt while the stack is deep:
8+
-- https://bugzilla.kernel.org/show_bug.cgi?id=205183
9+
-- It is likely to be many years before that bug disappears from all
10+
-- production kernels, so disable this test on such platforms.
11+
-- (We still create the function, so as not to have a cross-platform
12+
-- difference in the end state of the regression database.)
13+
SELECT version() ~ 'powerpc64[^,]*-linux-gnu'
14+
AS skip_test \gset
15+
\if :skip_test
16+
\quit
17+
\endif
18+
-- The full error report is not very stable, so we show only SQLSTATE
19+
-- and primary error message.
20+
\set VERBOSITY sqlstate
21+
select infinite_recurse();
22+
ERROR: 54001
23+
\echo :LAST_ERROR_MESSAGE
24+
stack depth limit exceeded
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
-- Check that stack depth detection mechanism works and
2+
-- max_stack_depth is not set too high.
3+
create function infinite_recurse() returns int as
4+
'select infinite_recurse()' language sql;
5+
-- Unfortunately, up till mid 2020 the Linux kernel had a bug in PPC64
6+
-- signal handling that would cause this test to crash if it happened
7+
-- to receive an sinval catchup interrupt while the stack is deep:
8+
-- https://bugzilla.kernel.org/show_bug.cgi?id=205183
9+
-- It is likely to be many years before that bug disappears from all
10+
-- production kernels, so disable this test on such platforms.
11+
-- (We still create the function, so as not to have a cross-platform
12+
-- difference in the end state of the regression database.)
13+
SELECT version() ~ 'powerpc64[^,]*-linux-gnu'
14+
AS skip_test \gset
15+
\if :skip_test
16+
\quit

src/test/regress/parallel_schedule

+1-1
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ test: create_index create_index_spgist create_view index_including index_includi
5555
# ----------
5656
# Another group of parallel tests
5757
# ----------
58-
test: create_aggregate create_function_3 create_cast constraints triggers select inherit typed_table vacuum drop_if_exists updatable_views roleattributes create_am hash_func errors
58+
test: create_aggregate create_function_3 create_cast constraints triggers select inherit typed_table vacuum drop_if_exists updatable_views roleattributes create_am hash_func errors infinite_recurse
5959

6060
# ----------
6161
# sanity_check does a vacuum, affecting the sort order of SELECT *

src/test/regress/serial_schedule

+1
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ test: roleattributes
8383
test: create_am
8484
test: hash_func
8585
test: errors
86+
test: infinite_recurse
8687
test: sanity_check
8788
test: select_into
8889
test: select_distinct

src/test/regress/sql/errors.sql

-9
Original file line numberDiff line numberDiff line change
@@ -364,12 +364,3 @@ INT4
364364
UNIQUE
365365
NOT
366366
NULL);
367-
368-
-- Check that stack depth detection mechanism works and
369-
-- max_stack_depth is not set too high. The full error report is not
370-
-- very stable, so show only SQLSTATE and primary error message.
371-
create function infinite_recurse() returns int as
372-
'select infinite_recurse()' language sql;
373-
\set VERBOSITY sqlstate
374-
select infinite_recurse();
375-
\echo :LAST_ERROR_MESSAGE
+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
-- Check that stack depth detection mechanism works and
2+
-- max_stack_depth is not set too high.
3+
4+
create function infinite_recurse() returns int as
5+
'select infinite_recurse()' language sql;
6+
7+
-- Unfortunately, up till mid 2020 the Linux kernel had a bug in PPC64
8+
-- signal handling that would cause this test to crash if it happened
9+
-- to receive an sinval catchup interrupt while the stack is deep:
10+
-- https://bugzilla.kernel.org/show_bug.cgi?id=205183
11+
-- It is likely to be many years before that bug disappears from all
12+
-- production kernels, so disable this test on such platforms.
13+
-- (We still create the function, so as not to have a cross-platform
14+
-- difference in the end state of the regression database.)
15+
16+
SELECT version() ~ 'powerpc64[^,]*-linux-gnu'
17+
AS skip_test \gset
18+
\if :skip_test
19+
\quit
20+
\endif
21+
22+
-- The full error report is not very stable, so we show only SQLSTATE
23+
-- and primary error message.
24+
25+
\set VERBOSITY sqlstate
26+
27+
select infinite_recurse();
28+
29+
\echo :LAST_ERROR_MESSAGE

0 commit comments

Comments
 (0)