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 1x4eI4-007IX7-1d for pgsql-hackers@arkaria.postgresql.org; Thu, 10 Sep 2026 12:54:08 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1x4eI2-005gj4-1K for pgsql-hackers@arkaria.postgresql.org; Thu, 10 Sep 2026 12:54:06 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1x4eI2-005git-0G for pgsql-hackers@lists.postgresql.org; Thu, 10 Sep 2026 12:54:06 +0000 Received: from mail-wm1-x330.google.com ([2a00:1450:4864:20::330]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1x4eI0-00000004xSj-1CB2 for pgsql-hackers@lists.postgresql.org; Thu, 10 Sep 2026 12:54:05 +0000 Received: by mail-wm1-x330.google.com with SMTP id 5b1f17b1804b1-49d0b98d6d0so50557795e9.0 for ; Thu, 10 Sep 2026 05:54:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cybertec.at; s=google; t=1789044843; x=1789649643; darn=lists.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=JTD9RsVjeJQoyU9/X980XrOP9iH6WBFFd9rXk4BW50Q=; b=rNvFJYWphd68alwcXHtIn8fEt7Yr/BlAvq+KCQemMmb9K9hkv2gEVjvbRfi+pCp75R /vI+LiITh1b3eAvc1418nGwkddEN87+2l5pB38YNSIGCCBU10/bzS+7p/9eROOKTgZBK 8OOd7UqFLzHWHF4FEgIUjUbzfQBHGCnWJtz8cEnYW1XQU3aaib5bBB0CBpodTcAaDqnq GluFHIKxlXwRUtOq0xl+JAdsCA/9/zPbVn71mml9DI0+1eefsTE73i0n7FMosfMplH+a Mjqf+f5WTGrx2mcSOE1aBNcIcDXlxmm7SQwzYH2h4MYVcY8sko//wGCidfIeIPG4Nqhk vL+w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1789044843; x=1789649643; 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=JTD9RsVjeJQoyU9/X980XrOP9iH6WBFFd9rXk4BW50Q=; b=RSwTdk+bD6AtgZq6Acg4bUaw5p/zKyVaX+MEE1czmaR3FvUFSPpIKWJOMMkC7ar7Sl AlR054Q6U5rKJqrP06ZxErjjqYSy6taHcZJZo+ge/IhC6CFtEZupdLXar5E7kelphP2x v8Vm9pHXA3jz6hQS3Kfw0A4tuQpm9ZIJgnbRRO+AgTTNR3q45ClKRQi0h8INz6WX0UMb jwFCTLP6hmthq4gqRxLbkuvhz93adtAQDujJEU0+A6VW2LvpWmbSkmUoLHFf0429wgx6 rNqd4+eybRDBXH3zjIxVN+lq57bxC8tQJsUekhCsFjyJaJ2ImCMVhKCVfxRDJTpYq8R5 4Ojg== X-Gm-Message-State: AFuF++kMykMko4Dib4sSe5EN3Htd178ZxY7TLkGllaX905HJ1v5ds0kZ gpK9XIkjHXy7O98Yx85o6UHjzaQgxiKB9Cq0eO88AzkljctcVBtVUlxylb30gQZWl3M3OscU39Q ET8TxdIQ= X-Gm-Gg: AYBFou0TCUIG2aRXyH2OypvJRYQDp9TSbus3N6DqEJ6YdfIXwt/nOsL+nm3egPds6kq dygRunXd9ZmNnCIlJuBwJoCK02wksKcciz3Js2sjgz3UEVxoGEvnSYNiaF6ozwwzdwtPXYhR8Bq TDW8oCYtscZ8bq0iAAOlhcSleNJ+5oRqCvstmYsDM5TRqp/a1v8HR0G9FLPT+Zp1AXIgRDl2ydT YR/S6xecrFZ0YNyraGd5VE5vPTbhNYllflm6OUZYXbx7XM4nNUP1nmorLUT//2J+OqVLMsuWtF1 Kpm9Bi1eqDoTj4FNZ4FvyH7Jc0HqRit62Y7w6bdn/EPfx1eKzFS3mefjoN3usYoK4LkyEW1cOfW Jqn80OWMefT5UD9qlvR92/oMveEq4Y6C4FkZ0VFM5ueBkBeT1pw86r3eZh3HSNyVQo2iCzW+P8d OyBXmuLowXpnZugP22qYxZgc3YzOnCK6xJIKHC8EXWi8+Ie60qQXJGSLsHWEZPUJFDbTCuITQY+ oipAP/Kglnk X-Received: by 2002:a05:600c:8012:b0:49c:d818:8764 with SMTP id 5b1f17b1804b1-49cf826818dmr426089045e9.11.1789044842681; Thu, 10 Sep 2026 05:54:02 -0700 (PDT) Received: from localhost (109-81-170-190.rct.o2.cz. [109.81.170.190]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-49d26c1bfc1sm89677445e9.4.2026.09.10.05.54.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 10 Sep 2026 05:54:02 -0700 (PDT) From: Antonin Houska To: Sami Imseih cc: pgsql-hackers@lists.postgresql.org Subject: Re: Race conditions during parallel worker (unclean) exit In-reply-to: References: <64338.1788881902@localhost> <15111.1788979352@localhost> Comments: In-reply-to Sami Imseih message dated "Wed, 09 Sep 2026 16:38:27 -0500." 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: <19839.1789044841.1@localhost> Content-Transfer-Encoding: quoted-printable Date: Thu, 10 Sep 2026 14:54:01 +0200 Message-ID: <19840.1789044841@localhost> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Sami Imseih wrote: > > > It seems cleaner to introduce a separate message for this case, mayb= e > > > "PqMsg_ParallelAborted", and keep the existing > > > "ERROR: lost connection to parallel worker" message. > > > > I'm not sure this is worth adjusting the FE/BE protocol. I'd prefer re= gular > > ERROR message (PqMsg_ErrorResponse), but only in some minimalistic for= m. The > > worker would only send the message, w/o doing any error handling itsel= f. > = > I was thinking of PqMsg_ParallelAborted because we have precedent alread= y > with PqMsg_Progress which was introduced in f1889729dd3a as the 'P' mess= age > for parallel index progress reported, but later converted to a macro in > a99cc6c6b4b. I realize now that new message type for communication between background worker and the leader backend actually shouldn't need the protocol version= to be bumped - see commit f1889729dd3a. However, when adding a new message ty= pe, I'd use the opportunity to stop using PqMsg_Terminate in the background worker: per documentation, this one should be sent by frontend to backend. A new message, e.g. PqMsg_WorkerExit, would contain status code. The worke= r would set zero status code when sending the message at the end of ParallelWorkerMain(), and non-zero in ParallelWorkerShutdown(). Does that = make sense to you? -- = Antonin Houska Web: https://www.cybertec-postgresql.com