Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1iIDl5-0002ak-MR for pgsql-bugs@arkaria.postgresql.org; Wed, 09 Oct 2019 15:20:11 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1iIDl4-00069u-73 for pgsql-bugs@arkaria.postgresql.org; Wed, 09 Oct 2019 15:20:10 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1iIDHn-00058d-VT for pgsql-bugs@lists.postgresql.org; Wed, 09 Oct 2019 14:49:56 +0000 Received: from starship.nidsa.net ([212.227.110.112]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1iIDHk-0005cz-DE for pgsql-bugs@lists.postgresql.org; Wed, 09 Oct 2019 14:49:54 +0000 Received: from [10.13.1.101] (port=42188 helo=starship.nidsa.net) by starship.nidsa.net with esmtps (TLSv1.2:AES256-SHA:256) (Exim 4.82_1-5b7a7c0-XX) (envelope-from ) id 1iIDHe-0003nn-2o; Wed, 09 Oct 2019 16:49:47 +0200 Received: from W2012-02.nidsa.loc (10.13.1.101) by W2012-02.nidsa.loc (10.13.1.101) with Microsoft SMTP Server (TLS) id 15.0.1263.5; Wed, 9 Oct 2019 16:50:52 +0200 Received: from W2012-02.nidsa.loc ([::1]) by W2012-02.nidsa.loc ([::1]) with mapi id 15.00.1263.000; Wed, 9 Oct 2019 16:50:52 +0200 X-CTCH-RefID: str=0001.0A0C0211.5D9DF38B.0032,ss=1,re=0.000,recu=0.000,reip=0.000,cl=1,cld=1,fgs=0 From: Hans Buschmann To: Tomas Vondra , Tom Lane CC: "pgsql-bugs@lists.postgresql.org" Subject: AW: BUG #16045: vacuum_db crash and illegal memory alloc after pg_upgrade from PG11 to PG12 Thread-Topic: BUG #16045: vacuum_db crash and illegal memory alloc after pg_upgrade from PG11 to PG12 Thread-Index: AQHVfqYPKdh1yrb0CkWFTCPMOd4v9qdSNJuAgAACNYCAAAX9gIAAI76Z Date: Wed, 9 Oct 2019 14:50:52 +0000 Message-ID: <1570632589151.82822@nidsa.net> References: <16045-673e8fa6b5ace196@postgresql.org> <20191009132436.uugh4r3be6vw6ex4@development> <20191009135907.km2b5nrzflcz6xey@development> <20543.1570630021@sss.pgh.pa.us>,<20191009142827.6eph24m3se4clcwh@development> In-Reply-To: <20191009142827.6eph24m3se4clcwh@development> Accept-Language: de-DE, en-US Content-Language: de-DE X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-exchange-transport-fromentityheader: Hosted x-originating-ip: [185.101.187.99] Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Hi Tomas,=0A= =0A= Nice that you could reproduce it.=0A= This was just the way I followed.=0A= =0A= For your Info, here are my no-standard config params:=0A= =0A= name | current_setting =0A= ------------------------------------+---------------------------------=0A= application_name | psql =0A= auto_explain.log_analyze | on =0A= auto_explain.log_min_duration | 0 =0A= auto_explain.log_nested_statements | on =0A= client_encoding | WIN1252 =0A= cluster_name | HB_DEV =0A= data_checksums | on =0A= DateStyle | ISO, DMY =0A= default_text_search_config | pg_catalog.german =0A= dynamic_shared_memory_type | windows =0A= effective_cache_size | 8GB =0A= lc_collate | C =0A= lc_ctype | German_Germany.1252 =0A= lc_messages | C =0A= lc_monetary | German_Germany.1252 =0A= lc_numeric | German_Germany.1252 =0A= lc_time | German_Germany.1252 =0A= log_destination | stderr =0A= log_directory | N:/ZZ_log/pg_log_hbdev =0A= log_error_verbosity | verbose =0A= log_file_mode | 0640 =0A= log_line_prefix | WHB %a %t %i %e %2l:> =0A= log_statement | mod =0A= log_temp_files | 0 =0A= log_timezone | CET =0A= logging_collector | on =0A= maintenance_work_mem | 128MB =0A= max_connections | 100 =0A= max_stack_depth | 2MB =0A= max_wal_size | 1GB =0A= min_wal_size | 80MB =0A= pg_stat_statements.max | 5000 =0A= pg_stat_statements.track | all =0A= random_page_cost | 1 =0A= search_path | public, archiv, ablage, admin =0A= server_encoding | UTF8 =0A= server_version | 12.0 =0A= shared_buffers | 1GB =0A= shared_preload_libraries | auto_explain,pg_stat_statements =0A= temp_buffers | 32MB =0A= TimeZone | CET =0A= transaction_deferrable | off =0A= transaction_isolation | read committed =0A= transaction_read_only | off =0A= update_process_title | off =0A= wal_buffers | 16MB =0A= wal_segment_size | 16MB =0A= work_mem | 32MB =0A= (48 rows)=0A= =0A= Indeed, the database has UTF8 Encoding.=0A= =0A= The Extended error-log (i have set auto_explain):=0A= =0A= =0A= =0A= WHB psql 2019-10-09 15:45:03 CEST XX000 7:> ERROR: XX000: invalid memory= alloc request size 18446744073709551613=0A= WHB psql 2019-10-09 15:45:03 CEST XX000 8:> LOCATION: palloc, d:\pginsta= ller_12.auto\postgres.windows-x64\src\backend\utils\mmgr\mcxt.c:934=0A= WHB psql 2019-10-09 15:45:03 CEST XX000 9:> STATEMENT: select * from q_t= bl_archiv;=0A= WHB vacuumdb 2019-10-09 15:46:42 CEST 00000 1:> LOG: 00000: duration: 0.= 022 ms plan:=0A= Query Text: SELECT pg_catalog.set_config('search_path', '', false);=0A= Result (cost=3D0.00..0.01 rows=3D1 width=3D32) (actual time=3D0.014..0.01= 5 rows=3D1 loops=3D1)=0A= WHB vacuumdb 2019-10-09 15:46:42 CEST 00000 2:> LOCATION: explain_Execut= orEnd, d:\pginstaller_12.auto\postgres.windows-x64\contrib\auto_explain\aut= o_explain.c:415=0A= WHB vacuumdb 2019-10-09 15:46:42 CEST 00000 3:> LOG: 00000: duration: 0.= 072 ms plan:=0A= Query Text: SELECT datname FROM pg_database WHERE datallowconn ORDER BY 1;= =0A= Sort (cost=3D1.16..1.16 rows=3D1 width=3D64) (actual time=3D0.063..0.064 = rows=3D14 loops=3D1)=0A= Sort Key: datname=0A= Sort Method: quicksort Memory: 26kB=0A= -> Seq Scan on pg_database (cost=3D0.00..1.15 rows=3D1 width=3D64) (ac= tual time=3D0.018..0.022 rows=3D14 loops=3D1)=0A= Filter: datallowconn=0A= Rows Removed by Filter: 1=0A= WHB vacuumdb 2019-10-09 15:46:42 CEST 00000 4:> LOCATION: explain_Execut= orEnd, d:\pginstaller_12.auto\postgres.windows-x64\contrib\auto_explain\aut= o_explain.c:415=0A= WHB vacuumdb 2019-10-09 15:46:43 CEST 00000 1:> LOG: 00000: duration: 0.= 027 ms plan:=0A= Query Text: SELECT pg_catalog.set_config('search_path', '', false);=0A= Result (cost=3D0.00..0.01 rows=3D1 width=3D32) (actual time=3D0.012..0.01= 3 rows=3D1 loops=3D1)=0A= WHB vacuumdb 2019-10-09 15:46:43 CEST 00000 2:> LOCATION: explain_Execut= orEnd, d:\pginstaller_12.auto\postgres.windows-x64\contrib\auto_explain\aut= o_explain.c:415=0A= WHB vacuumdb 2019-10-09 15:46:43 CEST 00000 3:> LOG: 00000: duration: 1.= 036 ms plan:=0A= Query Text: SELECT c.relname, ns.nspname FROM pg_catalog.pg_class c=0A= JOIN pg_catalog.pg_namespace ns ON c.relnamespace OPERATOR(pg_catalog.=3D= ) ns.oid=0A= LEFT JOIN pg_catalog.pg_class t ON c.reltoastrelid OPERATOR(pg_catalog.= =3D) t.oid=0A= WHERE c.relkind OPERATOR(pg_catalog.=3D) ANY (array['r', 'm'])=0A= ORDER BY c.relpages DESC;=0A= Sort (cost=3D56.56..56.59 rows=3D13 width=3D132) (actual time=3D0.843..0.= 854 rows=3D320 loops=3D1)=0A= Sort Key: c.relpages DESC=0A= Sort Method: quicksort Memory: 110kB=0A= -> Hash Join (cost=3D1.23..56.32 rows=3D13 width=3D132) (actual time= =3D0.082..0.649 rows=3D320 loops=3D1)=0A= Hash Cond: (c.relnamespace =3D ns.oid)=0A= -> Seq Scan on pg_class c (cost=3D0.00..55.05 rows=3D13 width=3D= 76) (actual time=3D0.034..0.545 rows=3D320 loops=3D1)=0A= Filter: ((relkind)::text =3D ANY ('{r,m}'::text[]))=0A= Rows Removed by Filter: 950=0A= -> Hash (cost=3D1.10..1.10 rows=3D10 width=3D68) (actual time=3D= 0.022..0.022 rows=3D10 loops=3D1)=0A= Buckets: 1024 Batches: 1 Memory Usage: 9kB=0A= -> Seq Scan on pg_namespace ns (cost=3D0.00..1.10 rows=3D1= 0 width=3D68) (actual time=3D0.010..0.011 rows=3D10 loops=3D1)=0A= WHB vacuumdb 2019-10-09 15:46:43 CEST 00000 4:> LOCATION: explain_Execut= orEnd, d:\pginstaller_12.auto\postgres.windows-x64\contrib\auto_explain\aut= o_explain.c:415=0A= WHB vacuumdb 2019-10-09 15:46:43 CEST 00000 5:> LOG: 00000: duration: 0.= 011 ms plan:=0A= Query Text: SELECT pg_catalog.set_config('search_path', '', false);=0A= Result (cost=3D0.00..0.01 rows=3D1 width=3D32) (actual time=3D0.008..0.00= 8 rows=3D1 loops=3D1)=0A= WHB vacuumdb 2019-10-09 15:46:43 CEST 00000 6:> LOCATION: explain_Execut= orEnd, d:\pginstaller_12.auto\postgres.windows-x64\contrib\auto_explain\aut= o_explain.c:415=0A= WHB 2019-10-09 15:47:01 CEST 00000 22:> LOG: 00000: server process (PID = 4708) was terminated by exception 0xC0000005=0A= WHB 2019-10-09 15:47:01 CEST 00000 23:> DETAIL: Failed process was runni= ng: ANALYZE admin.q_tbl_archiv;=0A= WHB 2019-10-09 15:47:01 CEST 00000 24:> HINT: See C include file "ntstat= us.h" for a description of the hexadecimal value.=0A= WHB 2019-10-09 15:47:01 CEST 00000 25:> LOCATION: LogChildExit, d:\pgins= taller_12.auto\postgres.windows-x64\src\backend\postmaster\postmaster.c:367= 0=0A= WHB 2019-10-09 15:47:01 CEST 00000 26:> LOG: 00000: terminating any othe= r active server processes=0A= WHB 2019-10-09 15:47:01 CEST 00000 27:> LOCATION: HandleChildCrash, d:\p= ginstaller_12.auto\postgres.windows-x64\src\backend\postmaster\postmaster.c= :3400=0A= WHB psql 2019-10-09 15:47:01 CEST 57P02 10:> WARNING: 57P02: terminating = connection because of crash of another server process=0A= WHB psql 2019-10-09 15:47:01 CEST 57P02 11:> DETAIL: The postmaster has c= ommanded this server process to roll back the current transaction and exit,= because another server process exited abnormally and possibly corrupted sh= ared memory.=0A= WHB psql 2019-10-09 15:47:01 CEST 57P02 12:> HINT: In a moment you should= be able to reconnect to the database and repeat your command.=0A= WHB psql 2019-10-09 15:47:01 CEST 57P02 13:> LOCATION: quickdie, d:\pgins= taller_12.auto\postgres.windows-x64\src\backend\tcop\postgres.c:2717=0A= WHB 2019-10-09 15:47:02 CEST 57P02 3:> WARNING: 57P02: terminating conn= ection because of crash of another server process=0A= WHB 2019-10-09 15:47:02 CEST 57P02 4:> DETAIL: The postmaster has comma= nded this server process to roll back the current transaction and exit, bec= ause another server process exited abnormally and possibly corrupted shared= memory.=0A= WHB 2019-10-09 15:47:02 CEST 57P02 5:> HINT: In a moment you should be = able to reconnect to the database and repeat your command.=0A= WHB 2019-10-09 15:47:02 CEST 57P02 6:> LOCATION: quickdie, d:\pginstall= er_12.auto\postgres.windows-x64\src\backend\tcop\postgres.c:2717=0A= WHB 2019-10-09 15:47:02 CEST 00000 28:> LOG: 00000: all server processes= terminated; reinitializing=0A= WHB 2019-10-09 15:47:02 CEST 00000 29:> LOCATION: PostmasterStateMachine= , d:\pginstaller_12.auto\postgres.windows-x64\src\backend\postmaster\postma= ster.c:3912=0A= WHB 2019-10-09 15:47:02 CEST 00000 1:> LOG: 00000: database system was = interrupted; last known up at 2019-10-09 15:46:03 CEST=0A= WHB 2019-10-09 15:47:02 CEST 00000 2:> LOCATION: StartupXLOG, d:\pginst= aller_12.auto\postgres.windows-x64\src\backend\access\transam\xlog.c:6277= =0A= =0A= =0A= The table was imported successively by pg_dump/pg_restore from the previous= versions into pg11.=0A= =0A= This was the same what I did on the other machine (pg 11.5). On this test m= achine I could successfully Export the table with pg_dump -t.=0A= =0A= On the erroneous PG12 Cluster I succeeded to recreate a similar table with= the original create table Statements: no Errors.=0A= =0A= Under PG12 upgraded, I tried to select only the first column (select table_= name from q_tbl_archiv) and got erroneaus results (shown first 2 entries):= =0A= =0A= cpsdb=3D# select table_name from q_tbl_archiv;=0A= table_name=0A= ---------------------------------------------=0A= \x11chemmat\x17chm_season=0A= !collectionsheet\x15cs_season=0A= =0A= It seems that the length Bytes are present in the Output.=0A= =0A= Hope this Information helps.=0A= =0A= Hans Buschmann=0A= =0A=