On Thu, Sep 09, 2021 at 09:50:46AM +0000, Aleksander Alekseev wrote:
> It looks like this patch needs to be updated. According to 
> http://cfbot.cputube.org/ it applies but doesn't pass any tests. Changing the 
> status to save time for reviewers.
> 
> The new status of this patch is: Waiting on Author

Just to give some more info to work on I found this patch made postgres
crash with a segmentation fault.

"""
Program terminated with signal SIGSEGV, Segmentation fault.
#0  0x0000556e37ef1b55 in bms_equal (a=0x7f6e37a9c5b0, b=0x7f6e37a9c5b0) at 
bitmapset.c:126
126                     if (shorter->words[i] != longer->words[i])
"""

attached are the query that triggers the crash and the backtrace.

-- 
Jaime Casanova
Director de Servicios Profesionales
SystemGuards - Consultores de PostgreSQL

Attachment: bug.sql
Description: application/sql

#0  0x0000556e37ef1b55 in bms_equal (a=0x7f6e37a9c5b0, b=0x7f6e37a9c5b0) at 
bitmapset.c:126
        shorter = 0x7f6e37a9c5b0
        longer = 0x7f6e37a9c5b0
        shortlen = 2139062143
        longlen = 32622
        i = 138057
#1  0x0000556e37fc9f5d in find_param_path_info (rel=0x556e3944c490, 
required_outer=0x7f6e37a9c5b0) at relnode.c:1634
        ppi = 0x7f6e37a9cc08
        lc__state = {l = 0x7f6e37a9cc40, i = 0}
        lc = 0x7f6e37a5f898
#2  0x0000556e37fbeaeb in reparameterize_path_by_child (root=0x556e394340e0, 
path=0x7f6e37a9c6c8, child_rel=0x7f6e37a77ac0) at pathnode.c:4205
        new_path = 0x7f6e37a89408
        new_ppi = 0x7f6e37a77d30
        old_ppi = 0x7f6e37a9cc08
        required_outer = 0x7f6e37a9c5b0
#3  0x0000556e37f66545 in try_nestloop_path (root=0x556e394340e0, 
joinrel=0x7f6e37a88a80, outer_path=0x7f6e37a788e8, inner_path=0x7f6e37a9c6c8, 
pathkeys=0x0, jointype=JOIN_LEFT, extra=0x7ffde36f3e50)
    at joinpath.c:662
        required_outer = 0x0
        workspace = {startup_cost = 46733.467499999999, total_cost = 
1195882.0625, run_cost = 1149148.595, inner_run_cost = 0.020375816993464052, 
inner_rescan_run_cost = 0.020375816993464052, 
          outer_rows = 6.9224208015025731e-310, inner_rows = 
6.9224208087218603e-310, outer_skip_rows = 6.9224208013235237e-310, 
inner_skip_rows = 4.640852265067508e-310, numbuckets = 960708832, 
          numbatches = 21870, inner_rows_total = 6.9224208047606396e-310}
        innerrel = 0x556e3944c490
        outerrel = 0x7f6e37a77ac0
        innerrelids = 0x556e3944c2c8
        outerrelids = 0x7f6e37a77d30
        inner_paramrels = 0x7f6e37a9c5b0
        outer_paramrels = 0x0
#4  0x0000556e37f67bf9 in match_unsorted_outer (root=0x556e394340e0, 
joinrel=0x7f6e37a88a80, outerrel=0x7f6e37a77ac0, innerrel=0x556e3944c490, 
jointype=JOIN_LEFT, extra=0x7ffde36f3e50) at joinpath.c:1702
        innerpath = 0x7f6e37a9c6c8
        mpath = 0x0
        lc2__state = {l = 0x7f6e37a9d0a0, i = 1}
        lc2 = 0x7f6e37a9d0c0
        outerpath = 0x7f6e37a788e8
        merge_pathkeys = 0x0
        lc1__state = {l = 0x7f6e37a786c8, i = 0}
        save_jointype = JOIN_LEFT
        nestjoinOK = true
        useallclauses = false
        inner_cheapest_total = 0x7f6e37a9c3b0
        matpath = 0x7f6e37a89370
        lc1 = 0x7f6e37a786e0
        __func__ = "match_unsorted_outer"
#5  0x0000556e37f65c14 in add_paths_to_joinrel (root=0x556e394340e0, 
joinrel=0x7f6e37a88a80, outerrel=0x7f6e37a77ac0, innerrel=0x556e3944c490, 
jointype=JOIN_LEFT, sjinfo=0x7f6e37a88630, 
    restrictlist=0x7f6e37a88a28) at joinpath.c:291
        extra = {restrictlist = 0x7f6e37a88a28, mergeclause_list = 
0x7f6e37a88e28, inner_unique = true, sjinfo = 0x7f6e37a88630, semifactors = 
{outer_match_frac = 0.00039215686274509802, match_count = 2550}, 
          param_source_rels = 0x0}
        mergejoin_allowed = true
        lc = 0x0
        joinrelids = 0x7f6e37a886e8
#6  0x0000556e37f6a3d9 in populate_joinrel_with_paths (root=0x556e394340e0, 
rel1=0x7f6e37a77ac0, rel2=0x556e3944c490, joinrel=0x7f6e37a88a80, 
sjinfo=0x7f6e37a88630, restrictlist=0x7f6e37a88a28)
    at joinrels.c:825
        __func__ = "populate_joinrel_with_paths"
#7  0x0000556e37f6bca5 in extract_asymmetric_partitionwise_subjoin 
(root=0x556e394340e0, joinrel=0x7f6e37a86bd8, append_path=0x7f6e37a7b6c8, 
inner_rel=0x556e3944c490, jointype=JOIN_LEFT, extra=0x7ffde36f4150)
    at joinrels.c:1617
        child_path = 0x7f6e37a788e8
        child_joinrelids = 0x7f6e37a885e0
        child_sjinfo = 0x7f6e37a88630
        child_rel = 0x7f6e37a77ac0
        parent_relids = 0x7f6e37a88608
        child_joinrel = 0x7f6e37a88a80
        child_restrictlist = 0x7f6e37a88a28
        lc__state = {l = 0x7f6e37a7b8a8, i = 0}
        result = 0x0
        lc = 0x7f6e37a7b8c0
#8  0x0000556e37f6bfb8 in try_asymmetric_partitionwise_join 
(root=0x556e394340e0, joinrel=0x7f6e37a86bd8, outer_rel=0x7f6e37a65f68, 
inner_rel=0x556e3944c490, jointype=JOIN_LEFT, extra=0x7ffde36f4150)
    at joinrels.c:1713
        _save_exception_stack = 0x7ffde36f4b80
        _save_context_stack = 0x0
        _local_sigjmp_buf = {{__jmpbuf = {0, -1508331243234128262, 
93931869773824, 140728419176608, 0, 0, -1508331245744419206, 
-4740322787736023430}, __mask_was_saved = 0, __saved_mask = {__val = {0, 
                140728419172688, 4294967296, 93931895571600, 140111356780392, 
140111356914648, 93931895472352, 140111357005984, 4294967298, 140111356901176, 
140110423130113, 140111356915312, 93930934763521, 
                140111356850992, 0, 140111357003464}}}}
        _do_rethrow = false
        join_rel_level_saved = 0x7f6e37aa0128
        live_childrels = 0x0
        append_path = 0x7f6e37a7b6c8
        lc__state = {l = 0x7f6e37a663c0, i = 2}
        lc = 0x7f6e37a663e8
#9  0x0000556e37f65d10 in add_paths_to_joinrel (root=0x556e394340e0, 
joinrel=0x7f6e37a86bd8, outerrel=0x7f6e37a65f68, innerrel=0x556e3944c490, 
jointype=JOIN_LEFT, sjinfo=0x556e3944f9a8, 
    restrictlist=0x7f6e37a86e70) at joinpath.c:344
        extra = {restrictlist = 0x7f6e37a86e70, mergeclause_list = 
0x7f6e37a86f98, inner_unique = true, sjinfo = 0x556e3944f9a8, semifactors = 
{outer_match_frac = 0.00039215686274509802, match_count = 2550}, 
          param_source_rels = 0x0}
        mergejoin_allowed = true
        lc = 0x0
        joinrelids = 0x7f6e37a86df0
#10 0x0000556e37f6a3d9 in populate_joinrel_with_paths (root=0x556e394340e0, 
rel1=0x7f6e37a65f68, rel2=0x556e3944c490, joinrel=0x7f6e37a86bd8, 
sjinfo=0x556e3944f9a8, restrictlist=0x7f6e37a86e70)
    at joinrels.c:825
        __func__ = "populate_joinrel_with_paths"
#11 0x0000556e37f6a213 in make_join_rel (root=0x556e394340e0, 
rel1=0x7f6e37a65f68, rel2=0x556e3944c490) at joinrels.c:761
        joinrelids = 0x7f6e37a9cb88
        sjinfo = 0x556e3944f9a8
        reversed = false
        sjinfo_data = {type = T_SpecialJoinInfo, min_lefthand = 0x556e3944c490, 
min_righthand = 0x7f6e37a65f68, syn_lefthand = 0x556e394340e0, syn_righthand = 
0x7f6e37a662a8, jointype = JOIN_INNER, 
          lhs_strict = false, delay_upper_joins = false, semi_can_btree = 
false, semi_can_hash = false, semi_operators = 0x0, semi_rhs_exprs = 
0x556e3944bb00}
        joinrel = 0x7f6e37a86bd8
        restrictlist = 0x7f6e37a86e70
#12 0x0000556e37f69708 in make_rels_by_clause_joins (root=0x556e394340e0, 
old_rel=0x7f6e37a65f68, other_rels_list=0x7f6e37aa00d0, 
other_rels=0x7f6e37aa00e8) at joinrels.c:313
        other_rel = 0x556e3944c490
        l__state = {l = 0x7f6e37aa00d0, i = 4}
        l = 0x7f6e37aa0108
#13 0x0000556e37f691da in join_search_one_level (root=0x556e394340e0, level=4) 
at joinrels.c:124
        other_rels_list = 0x7f6e37aa00d0
        other_rels = 0x7f6e37aa00e8
        old_rel = 0x7f6e37a65f68
        r__state = {l = 0x7f6e37a63ec0, i = 1}
        joinrels = 0x7f6e37aa0128
        r = 0x7f6e37a7bd60
        k = 32622
        __func__ = "join_search_one_level"
#14 0x0000556e37f4bf87 in standard_join_search (root=0x556e394340e0, 
levels_needed=5, initial_rels=0x7f6e37aa00d0) at allpaths.c:3020
        lc = 0x0
        lev = 4
        rel = 0x7f6e37a80030
        __func__ = "standard_join_search"
#15 0x0000556e37f4bef7 in make_rel_from_joinlist (root=0x556e394340e0, 
joinlist=0x556e39452568) at allpaths.c:2951
        levels_needed = 5
        initial_rels = 0x7f6e37aa00d0
        jl = 0x0
        __func__ = "make_rel_from_joinlist"
#16 0x0000556e37f47a62 in make_one_rel (root=0x556e394340e0, 
joinlist=0x556e39452568) at allpaths.c:228
        rel = 0x394340e0
        rti = 21
        total_pages = 146
#17 0x0000556e37f84d4e in query_planner (root=0x556e394340e0, 
qp_callback=0x556e37f8aa09 <standard_qp_callback>, qp_extra=0x7ffde36f4580) at 
planmain.c:276
        parse = 0x556e3939a390
        joinlist = 0x556e39452568
        final_rel = 0x556e39449148
        __func__ = "query_planner"
#18 0x0000556e37f87507 in grouping_planner (root=0x556e394340e0, 
tuple_fraction=0) at planner.c:1447
        sort_input_targets = 0x0
        sort_input_target_parallel_safe = false
        grouping_target = 0x556e39448d50
        scanjoin_target = 0x0
        activeWindows = 0x0
        qp_extra = {activeWindows = 0x0, groupClause = 0x0}
        sort_input_targets_contain_srfs = 0x556e3944a240
        have_grouping = false
        wflists = 0x0
        gset_data = 0x0
        sort_input_target = 0x556e39449d88
        grouping_targets = 0x0
        grouping_target_parallel_safe = false
        scanjoin_targets = 0x556e3944a0b8
        scanjoin_target_parallel_safe = false
        grouping_targets_contain_srfs = 0x556e39449df8
        scanjoin_targets_contain_srfs = 0x0
        scanjoin_target_same_exprs = false
        parse = 0x556e3939a390
        offset_est = 0
        count_est = 0
        limit_tuples = -1
        have_postponed_srfs = false
        final_target = 0x7ffde36f4710
        final_targets = 0x556e394340e0
        final_targets_contain_srfs = 0x0
        final_target_parallel_safe = false
        current_rel = 0x7ffde36f4710
        final_rel = 0x7ffde36f4650
        extra = {limit_needed = 224, limit_tuples = 4.6408511946627746e-310, 
count_est = 0, offset_est = 0}
        lc = 0x0
        __func__ = "grouping_planner"
#19 0x0000556e37f86bae in subquery_planner (glob=0x556e39448e38, 
parse=0x556e3939a390, parent_root=0x0, hasRecursion=false, tuple_fraction=0) at 
planner.c:1025
        root = 0x556e394340e0
        newWithCheckOptions = 0x0
        newHaving = 0x0
        hasOuterJoins = true
        hasResultRTEs = false
        final_rel = 0x910100004000
        l = 0x0
#20 0x0000556e37f8539b in standard_planner (parse=0x556e3939a390, 
    query_string=0x556e393728f0 "select  \n  1 \nfrom fkpart5.fk as ref_1\n     
inner join fkpart5.pk31 as sample_0 tablesample system (4.1) on (ref_1.a = 
sample_0.a )\n     inner join public.pagg_tab_para_p2 as ref_3 on (ref_1.a > 
0.3)\n"..., cursorOptions=2048, boundParams=0x0) at planner.c:406
        result = 0x556e382990f3 <palloc+273>
        glob = 0x556e39448e38
        tuple_fraction = 0
        root = 0x556e37f122ed <lappend+141>
        final_rel = 0x7ffde36f4930
        best_path = 0x556e39448de0
        top_plan = 0x7ffde36f49c0
        lp = 0x556e39437800
        lr = 0x556e37f11e04 <new_list+103>
#21 0x0000556e37f85150 in planner (parse=0x556e3939a390, 
    query_string=0x556e393728f0 "select  \n  1 \nfrom fkpart5.fk as ref_1\n     
inner join fkpart5.pk31 as sample_0 tablesample system (4.1) on (ref_1.a = 
sample_0.a )\n     inner join public.pagg_tab_para_p2 as ref_3 on (ref_1.a > 
0.3)\n"..., cursorOptions=2048, boundParams=0x0) at planner.c:277
        result = 0x556e3939a390
#22 0x0000556e380bf572 in pg_plan_query (querytree=0x556e3939a390, 
    query_string=0x556e393728f0 "select  \n  1 \nfrom fkpart5.fk as ref_1\n     
inner join fkpart5.pk31 as sample_0 tablesample system (4.1) on (ref_1.a = 
sample_0.a )\n     inner join public.pagg_tab_para_p2 as ref_3 on (ref_1.a > 
0.3)\n"..., cursorOptions=2048, boundParams=0x0) at postgres.c:847
        plan = 0xeb380bf4a3
#23 0x0000556e380bf6bc in pg_plan_queries (querytrees=0x556e39448de0, 
    query_string=0x556e393728f0 "select  \n  1 \nfrom fkpart5.fk as ref_1\n     
inner join fkpart5.pk31 as sample_0 tablesample system (4.1) on (ref_1.a = 
sample_0.a )\n     inner join public.pagg_tab_para_p2 as ref_3 on (ref_1.a > 
0.3)\n"..., cursorOptions=2048, boundParams=0x0) at postgres.c:939
        query = 0x556e3939a390
        stmt = 0x556e3939a1e8
        query_list__state = {l = 0x556e39448de0, i = 0}
        stmt_list = 0x0
        query_list = 0x556e39448df8
#24 0x0000556e380bfa2e in exec_simple_query (
    query_string=0x556e393728f0 "select  \n  1 \nfrom fkpart5.fk as ref_1\n     
inner join fkpart5.pk31 as sample_0 tablesample system (4.1) on (ref_1.a = 
sample_0.a )\n     inner join public.pagg_tab_para_p2 as ref_3 on (ref_1.a > 
0.3)\n"...) at postgres.c:1133
        snapshot_set = true
        per_parsetree_context = 0x0
        plantree_list = 0x556e37bb2000 <_start>
        parsetree = 0x556e3939a1e8
        commandTag = CMDTAG_SELECT
        qc = {commandTag = 3815721648, nprocessed = 93931876865050}
        querytree_list = 0x556e39448de0
        portal = 0x0
        receiver = 0x556e38274314 <pg_any_to_server+88>
        format = 0
        parsetree_item__state = {l = 0x556e3939a220, i = 0}
        dest = DestRemote
        oldcontext = 0x556e393f9710
        parsetree_list = 0x556e3939a220
        parsetree_item = 0x556e3939a238
        save_log_statement_stats = false
        was_logged = false
        use_implicit_block = false
        msec_str = 
"\360(79nU\000\000F\001\000\000\006\000\000\000\300Jo\343\375\177\000\000\061\343\356\067F\001\000"
        __func__ = "exec_simple_query"
#25 0x0000556e380c4380 in PostgresMain (argc=1, argv=0x7ffde36f4d00, 
dbname=0x556e3939f580 "regression", username=0x556e3939f558 "jcasanov") at 
postgres.c:4488
        query_string = 0x556e393728f0 "select  \n  1 \nfrom fkpart5.fk as 
ref_1\n     inner join fkpart5.pk31 as sample_0 tablesample system (4.1) on 
(ref_1.a = sample_0.a )\n     inner join public.pagg_tab_para_p2 as ref_3 on 
(ref_1.a > 0.3)\n"...
        firstchar = 81
        input_message = {
          data = 0x556e393728f0 "select  \n  1 \nfrom fkpart5.fk as ref_1\n     
inner join fkpart5.pk31 as sample_0 tablesample system (4.1) on (ref_1.a = 
sample_0.a )\n     inner join public.pagg_tab_para_p2 as ref_3 on (ref_1.a > 
0.3)\n"..., len = 327, maxlen = 1024, cursor = 327}
        local_sigjmp_buf = {{__jmpbuf = {0, -1508331243102007686, 
93931869773824, 140728419176608, 0, 0, -1508331242955207046, 
-4740352521772069254}, __mask_was_saved = 1, __saved_mask = {__val = {4194304, 
0, 
                0, 0, 0, 0, 0, 0, 0, 0, 1099511627520, 0, 0, 4294901760, 
18446462598732840960, 0}}}}
        send_ready_for_query = false
        idle_in_transaction_timeout_enabled = false
        idle_session_timeout_enabled = false
        __func__ = "PostgresMain"
#26 0x0000556e37ff9e84 in BackendRun (port=0x556e39398e70) at postmaster.c:4521
        av = {0x556e3840927f "postgres", 0x0}
        ac = 1
#27 0x0000556e37ff97b3 in BackendStartup (port=0x556e39398e70) at 
postmaster.c:4243
        bn = 0x556e39398e40
        pid = 0
        __func__ = "BackendStartup"
#28 0x0000556e37ff5b04 in ServerLoop () at postmaster.c:1765
        port = 0x556e39398e70
        i = 2
        rmask = {fds_bits = {128, 0 <repeats 15 times>}}
        selres = 1
        now = 1631170136
        readmask = {fds_bits = {224, 0 <repeats 15 times>}}
        nSockets = 8
        last_lockfile_recheck_time = 1631170106
        last_touch_time = 1631169617
        __func__ = "ServerLoop"
#29 0x0000556e37ff5353 in PostmasterMain (argc=3, argv=0x556e3936bef0) at 
postmaster.c:1437
        opt = -1
        status = 0
        userDoption = 0x556e3938f810 "data"
        listen_addr_saved = true
        i = 64
        output_config_variable = 0x0
        __func__ = "PostmasterMain"
#30 0x0000556e37ef159f in main (argc=3, argv=0x556e3936bef0) at main.c:199
        do_check_root = true

Reply via email to