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 1x6QND-000Dyl-0y for pgsql-hackers@arkaria.postgresql.org; Tue, 15 Sep 2026 10:26:47 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1x6QNC-001Bvq-1Y for pgsql-hackers@arkaria.postgresql.org; Tue, 15 Sep 2026 10:26:46 +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 1x6QNC-001Bvg-0U for pgsql-hackers@lists.postgresql.org; Tue, 15 Sep 2026 10:26:46 +0000 Received: from mail-wr2-x10.google.com ([2a00:1450:4864:30::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 1x6QN7-00000000YIO-39R6 for pgsql-hackers@postgresql.org; Tue, 15 Sep 2026 10:26:45 +0000 Received: by mail-wr2-x10.google.com with SMTP id ffacd0b85a97d-4843f22dcb8so70350f8f.0 for ; Tue, 15 Sep 2026 03:26:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cybertec.at; s=google; t=1789468001; x=1790072801; darn=postgresql.org; h=message-id:date:content-transfer-encoding:content-id: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=dm66KRo/PDpLSMIehFqcI9205e92r/g3C1yat8G3jbY=; b=QWJ4upuy+VNd+/1DHqXMXGy3OT8By54IJ+FyqHPNhRnHXMlYW6hyWDx+8wMijRDcU/ 5f7UAiG2DrusJLHbbDFdBFCWGX2fw6vccy+VBwrWr8Di6gnDbIMBhiRacAcI3PWGEzKF tUXlNuLrgZY4Njfwz+L4HMangMlqfk2ecq3FsgtFbvEZXC5lgb1HLspu2Xn+YcDe6Wiv yjcJrOXBqwUjS6AhuBohE11GAoCC+NxF6loX7nq3OGTSYhQEvmMDKvrF7sA5UL5GclGP l9MgP9dtG/auBnSRJUaqcQmY7ZzVn34WLBKhuPVMEd3FRMVuEK9Acb0Qwp3NAbzvHo9m 8sTw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1789468001; x=1790072801; h=message-id:date:content-transfer-encoding:content-id: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=dm66KRo/PDpLSMIehFqcI9205e92r/g3C1yat8G3jbY=; b=AHMQu+qlIrCxjh08FY2rf67D0BEgjt1l+dbVrWq6+ksFVosuRqnc0jdc1GE4xUDgv1 wmlziHgYejZnf8lBZe3koKXzVJwcJpfzJzGCBy+jjZxa7FNYnVr9ubwOQqhQL+vZvm+N HkHxYfwC+s1JdMquWUpvHw4FzAdHhMN1EfUc1f7gUnW/kme/NKVPKmxlhiPDiYRw6o+k p3tDpgW1bJzwyiJwLggHfqyhc0GKEZYwdWE4aGLvGKfFCGca//4Yhk9+B3PvE/HEGPcD gqFYs6QmrwjZuZJ0aVCTNbEzZy9j2HrfWn9n6xk+ixYH7i/TUaJAZCWa0jHQgfl57a8m nBnQ== X-Forwarded-Encrypted: i=1; AKwUvByhlp1nesfl5kbdVOW+bQE1uNajpTTPEfyQGWSwE7cB9KadlRT0OPHnobc6CK8AF3EOZCYnUwPO4MaVpQUN@postgresql.org X-Gm-Message-State: AFuF++nnpswj0g1K2MiT2sbS4/Apev4R8XsrLo+v4dOozKIzTUuMT8Tg AbejSG0rhqAkFM2LaK+zXUgL7J5OaRpc1PNq4rb8d8gCrkANAdMxXcNhpoZvLiupKTY= X-Gm-Gg: AYBFou3/LFNBFNWRzszbfMCg90Y69Ob2Pb3V7nRdyi2BKg7Ohbu9xXW4SdctXaOgaOF tAKIYzNNeyu9noKt39iFBOnOYopmy9faHF/guaF/l9Tjxi9NUaQ02Tl8+OsD5VlRwp/d6uAGG5v 3RUxDKEiPsDk0fHDJv4cgoC4+YNCYzsD/d0c3KL5SwW8qeu2ACKTFPhH2mOW2UabDnU7NUlDqgA 4mHY8H6Wtx47ddS5lWOalPV/tOIONRfTnaNk5CGOmFtxrA860MsYaQ48P+ORJRWFfKildkUg9en x3O07CRU6+GKaXnu7g8Z93BmZxxCOzqHwiQC8pWvxEvj5oitvUveVT7VcE+ru0K9vfKouPTK6XM VrScMwhmPcDPEPge9n+w3ni6Bo7nVj3nlonYIy9RIFHaeoS9W9JXqLCgrO36ScqzyPr7aN5n88S qEd15gIIIVP1zrCa0JSwBlwqw6DyijZS0/VQefaDhzQBErprpSukb4DBSdzKt9SggNOqKFsyr5r cxnECJIzUdz X-Received: by 2002:a05:6000:468d:b0:486:f3c0:c26b with SMTP id ffacd0b85a97d-4870aa1f08fmr50099f8f.57.1789468001422; Tue, 15 Sep 2026 03:26:41 -0700 (PDT) Received: from localhost (109-81-170-190.rct.o2.cz. [109.81.170.190]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-486eb32e81asm35675046f8f.7.2026.09.15.03.26.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 15 Sep 2026 03:26:41 -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> <19643.1789376414@localhost> Comments: In-reply-to Nikolay Samokhvalov message dated "Mon, 14 Sep 2026 18:31:47 -0700." X-Mailer: MH-E 8.6+git; nmh 1.8; GNU Emacs 28.3 MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <26323.1789468000.1@localhost> Content-Transfer-Encoding: quoted-printable Date: Tue, 15 Sep 2026 12:26:40 +0200 Message-ID: <26324.1789468000@localhost> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Nikolay Samokhvalov wrote: > On Mon, Sep 14, 2026 at 2:00 AM Antonin Houska wrote: > > I'm not sure this should be considered a bug. AFAICS the problem happe= ns > > due to calling proc_exit() directly, i.e. exiting the worker w/o sendi= ng a > > message via the error queue. (If an error was sent, > > ConditionVariableSleep() should process it and raise ERROR in the back= end > > running REPACK.) > > > > However, the REPACK worker does not call proc_exit() directly. > = > Yes, agreed: the direct proc_exit() test alone didn't establish a bug. I > checked whether error delivery can actually fail after attachment. > = > There is a path in mq_putmessage(): an interrupt while blocked on the fu= ll > error queue makes recursive FATAL output detach it via pq_mq_busy. The F= ATAL > reaches the server log, but not the REPACK backend. > = > I reproduced this on v4 plus only the attached repack_worker.c test hook= s, > built with injection points and server-wide client_min_messages=3Ddebug1= : > = > 1. For queue_t with a primary key, attach the standard wait action: > = > create extension injection_points; > select injection_points_attach( > 'repack-worker-before-snapshot-export', 'wait'); > = > 2. In another session run repack (concurrently) queue_t. When the worker= waits > at InjectionPoint/repack-worker-before-snapshot-export, SIGSTOP the R= EPACK > backend and run: > = > select injection_points_wakeup( > 'repack-worker-before-snapshot-export'); > = > 3. Repeat until the worker waits at IPC/MessageQueuePutMessage: > = > select pg_logical_emit_message(false, 'repack-queue-test', > repeat('x', 15 * 1024 * 1024)); > = > 4. Run select pg_terminate_backend(worker_pid), wait for the worker to e= xit, > then SIGCONT the REPACK backend. > = I wonder if you forgot to attach some files (I don't see the queue_t table= in the scripts you posted earlier), but I think I was able to reproduce the problem using the instructions above. IMO the problem is that the backend ignores the SHM_MQ_DETACHED state in ProcessRepackMessages(). If all the messages in the queue have severity lo= wer than ERROR, the worker just processes them and continues waiting for the worker to export the snapshot. However, as the worker is gone, there's no = way to wake the backend up. Patch 0002 in [1] should fix that. [1] https://www.postgresql.org/message-id/CALj2ACWJsOG0-2SQUxBXG9ULFs_GJpe= Vhhmp8AHf8c9iKDjMXA%40mail.gmail.com Thanks for testing! -- = Antonin Houska Web: https://www.cybertec-postgresql.com