Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1x62Y2-000RCJ-19 for pgsql-hackers@arkaria.postgresql.org; Mon, 14 Sep 2026 09:00:23 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1x62Y1-00C692-2J for pgsql-hackers@arkaria.postgresql.org; Mon, 14 Sep 2026 09:00:21 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1x62Y1-00C68t-1G for pgsql-hackers@lists.postgresql.org; Mon, 14 Sep 2026 09:00:21 +0000 Received: from mail-wm2-x10.google.com ([2a00:1450:4864:31::10]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1x62Xx-00000000Kz4-1b9Z for pgsql-hackers@postgresql.org; Mon, 14 Sep 2026 09:00:20 +0000 Received: by mail-wm2-x10.google.com with SMTP id 5b1f17b1804b1-49ccf3ca626so6560655e9.0 for ; Mon, 14 Sep 2026 02:00:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cybertec.at; s=google; t=1789376416; x=1789981216; darn=postgresql.org; h=message-id:date:content-transfer-encoding:content-type:mime-version :comments:references:in-reply-to:subject:cc:to:from:from:to:cc :subject:date:message-id:reply-to:content-type; bh=LBs0zgfLj07PEeTy2k+IwTiUo4W2s+FoRxjSdKfkCIA=; b=Ow22DAN41hPKiuqq1vcb23ly7sCJ9XJ3BL4GbkOKo1ZUyzv0qZr9b4D7Yy5a1Z2HHQ MIh+iWLO8bqcPOhSHLssmtZwD4spsLWEYMqHn6mux1+TSLU9SzBtr513PRZLthWCWMKT HlCu2r6HLfRbvFy+P5dauURr9SkdkLcjYyZeahxnqEPgLeAuMcLrDOTeSje18SEX+GSA g/Hzu1/zPGjf9bZgIOavSnJLd35sTWtwi8CNVqA+7/lfRwyQPQva9uIzVtGDJ5vzlDWQ XeDp/rKUTk1nUBSZ6tb6XKz3Si8mtGQzVzIKpH8kVDxfTMcZFd+xRriEu+1vh7+mLLUm zR2Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1789376416; x=1789981216; h=message-id:date:content-transfer-encoding:content-type:mime-version :comments:references:in-reply-to:subject:cc:to:from:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=LBs0zgfLj07PEeTy2k+IwTiUo4W2s+FoRxjSdKfkCIA=; b=M5eH3WLATg9lISUDK/jlQ8Vbl7ljbTSQEB4I+cmsrAvvyVml4yQLips5tDjtqTzf5w 6+ZfLUmXtB04qLY3CzuDzfHG6aY0f9wupRS4SFrdF76SO5jdBJ6SBIgo4LT+C6QipAey 50iw4yWSR12pP2XmXj3GeGeHS//oNbeQfbh66DLoGWg89cvimJcjuU/hpe2mJi6PZgXI ppPX2qIMAsGEVr+Kaxr12nSht5NDtn29Oj9lU0nTOaFGGmjXg+VoKHZOq8nRuITRLwWN DWjrmh/8Qi/XinuWLEOmlwf3gyezE/xAEjz4FtNkNRQNC9PGmSEkcvt1OCNv+NQuww27 xDoA== X-Forwarded-Encrypted: i=1; AKwUvBy9g+LP/KgetPglEfSpKYIyuY8FU/c7aR/lU+tL0qcrDozwzqZ1jO/a3eGdclptkvd2M/yjjgwj0EW9Yssm@postgresql.org X-Gm-Message-State: AFuF++k3m37Zce4lGK6+bV7Tuq9fSmFHeBUWaQ/G6h6YtF6pZZsXsTv7 JNvGUOflwAeAIz1uw4aKaFTHMl0AntEQnyeOJLYzSIxrwn/+D5UT/db+dKxoZ+TJkv0= X-Gm-Gg: AYBFou1vj0vGqINMrL3mntl87fZc3zjfJgdkAXmGlb3it7JyeQJ1Iu1D3UOIZE4TWJc GmRvN8m3yxPUD0YBm1J6Q2wQ3nNuhmVS1+NmNzlcvDvprHmtUgid2vlijoETDKPaKRToDvMRCaX P572EJ3mtHOZuvB2BwlLeawz+UbhI2+THA9ZThC1s+Ms6URYV2YCUNj1jRST5VXsbKyyPNyyTdy I+BhLnIq3J5HEj9FGpswx+I3DghmKwi4f/8WpPFAagH4X1legW0ApDeOg2M73EW+ZjNURCom3dV ngWSSn3tkJo486zlYsRnXF/1TCRDpnYImbs5iglQlP0V6Bv/EuT4aRiHdXEBFKsGGNK/ti9GI1k zl293qQEULW72pLlKnTZJk7qcjxapfyj4MF9zBCvVu0IoP9e79n9bCcuMSx/L1NzDr4Qyff+XfR hdsR86g8V3iVadwPSMS/sDaZNal7KlDuTq3EcvWKKL7zbwR2rigAuVIowcXj7zDlYZQsX+5XV9R N3XnoiYJqx2 X-Received: by 2002:a05:600c:37cc:b0:49e:6a76:77bf with SMTP id 5b1f17b1804b1-49e7a655c1bmr15005475e9.15.1789376415304; Mon, 14 Sep 2026 02:00:15 -0700 (PDT) Received: from localhost (109-81-170-190.rct.o2.cz. [109.81.170.190]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-49e69f053b7sm222213995e9.9.2026.09.14.02.00.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 14 Sep 2026 02:00:14 -0700 (PDT) From: Antonin Houska To: Nikolay Samokhvalov cc: Bharath Rupireddy , Masahiko Sawada , Nathan Bossart , PostgreSQL-development , alvherre@kurilemu.de Subject: Re: REPACK (CONCURRENTLY) backend waits indefinitely when decoding worker fails to start In-reply-to: References: <27780.1788172295@localhost> <7564.1788851851@localhost> Comments: In-reply-to Nikolay Samokhvalov message dated "Sun, 13 Sep 2026 11:37:49 -0700." X-Mailer: MH-E 8.6+git; nmh 1.8; GNU Emacs 28.3 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Mon, 14 Sep 2026 11:00:14 +0200 Message-ID: <19643.1789376414@localhost> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Nikolay Samokhvalov wrote: > On Mon, Sep 7, 2026 at 12:15 PM Bharath Rupireddy > wrote: > > After thinking more about this, I simplified the handling. There are two > > things the backend needs to wait for. First, for the worker to come up = and > > attach to the error message queue. Second, for the worker to set up the > > logical decoding machinery before it waits for snapshot export. The fir= st > > wait catches fork failures and worker startup issues. I used similar lo= gic > > to what parallel.c uses for this. The second wait catches failures that > > happen after the worker starts up and attaches to the error queue but > > before it finishes setting up the logical decoding machinery. I kept the > > shared memory initialized flag with the CV wait as-is for this. >=20 > =C3=81lvaro pointed me here from my thread: > https://postgr.es/m/CAM527d9A7FBXJn7A3w2VAPq0Gojm7tnUDFMh1uwJitGfi2kNeQ@m= ail.gmail.com >=20 > My AI harness tested v4. Silent worker exits still hang three > post-attachment waits. Mihail raised snapshot/replay liveness in > December 2025. >=20 > Snapshot repro on a test build configured with --enable-injection-points, > with v4 plus only the attached patch's test support: >=20 > create extension injection_points; > create table t (i int primary key); > insert into t select generate_series(1, 100); > set statement_timeout =3D '2s'; > select injection_points_attach( > 'repack-worker-before-snapshot-export', > 'injection_points', 'injection_exit', null); > repack (concurrently) t; >=20 > This times out after worker exit. The attached patch applies atop v4. I'm not sure this should be considered a bug. AFAICS the problem happens due to calling proc_exit() directly, i.e. exiting the worker w/o sending a mess= age via the error queue. (If an error was sent, ConditionVariableSleep() should process it and raise ERROR in the backend running REPACK.) However, the REP= ACK worker does not call proc_exit() directly. (parallel.c tries to guard against worker calling proc_exit() and it seems = to have an issue, but it's a separate topic [1]) [1] https://www.postgresql.org/message-id/64338.1788881902%40localhost --=20 Antonin Houska Web: https://www.cybertec-postgresql.com