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.94.2) (envelope-from ) id 1r943x-00DsQj-J5 for pgsql-hackers@arkaria.postgresql.org; Fri, 01 Dec 2023 14:00:13 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1r943w-007lQP-8a for pgsql-hackers@arkaria.postgresql.org; Fri, 01 Dec 2023 14:00:12 +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.94.2) (envelope-from ) id 1r943v-007lQH-VR for pgsql-hackers@lists.postgresql.org; Fri, 01 Dec 2023 14:00:11 +0000 Received: from mail-lf1-x12f.google.com ([2a00:1450:4864:20::12f]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1r943p-008HQ9-Ft for pgsql-hackers@postgresql.org; Fri, 01 Dec 2023 14:00:10 +0000 Received: by mail-lf1-x12f.google.com with SMTP id 2adb3069b0e04-50bdec453c8so245291e87.3 for ; Fri, 01 Dec 2023 06:00:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1701439203; x=1702044003; darn=postgresql.org; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=2A1TFlomo3D1LVQpHHiB/+ci79cZR/R1hVEgraVuKMc=; b=ZZZ4ljj8tEfj/1JotaJXOSX9omKzR3Guw9AH8Q/+0cpJ/zsmPKgXoMYx+HTTmX6YVV KdWMFU1ThEfnY0PpAkQNDj+zcIRdzbdWbnGkwnvj7jtl7fXH3LthMrbUM9wHOGbWKGfi b8eZS9qqduc0lrs4NE/YrmOtCS3VIA8UF+U7Z1rsuQLjMMEFjOmnkJI0Iu6RMQ6e55sK Da54pfp2qOJegkYXQ1V9d9jNahv9Nusn6EildpWCl0didL5eD4fToCOIpR0I9+2aNURZ HcO/Ss0IT1c1K5nhtvUUfYeqEJ9oct3ZJ1mdyHs+Fqrue5vC8f/MDZGgBdUT4f8vLbsA zOSQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701439203; x=1702044003; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=2A1TFlomo3D1LVQpHHiB/+ci79cZR/R1hVEgraVuKMc=; b=F9rb0wQnv6AJ85wSth1XpcqJG+u4AqSR/R6T7Rd0yVUwMwiXS0E3odjzZQ6e+5N84s otRlWdcDXDeV/zADDjHemBYq1sLlLJUyw/1fi6sFCKgcCoII3mdOzLPB1lxlObC5qs7v Fy8A/cifpSopcxWEYaphfjJlgmi3U2vL6kU3UqHbT0EshsAnEZwAZ0PU1I7n+W8va3aL rq3Jt15Tdbv0zKGaWubjonqEQrDy6FZHARhL7LOVR+4rvhFJH8GGaQ3Pi+SqWOHlRM/e Cb4PxyTKblqM99yNGJrsdS46xvS1me6qDq1RRnUDba6wKbKEGmxYwCljh+W4Zqaca9NY VBYg== X-Gm-Message-State: AOJu0YxVDjJjcYCCuB551u+spDSibMNrM0rswX2ByEac7+pXilh+m1fn exn404qpr1DDDWDL2JRLk7Y= X-Google-Smtp-Source: AGHT+IHjoE2R1z3bQE0dANOAY705Z6Y8bIYUh+spPKF2QrC6ogSgqM+P4J4n3tSUv2KUya0fumbkZg== X-Received: by 2002:ac2:5e30:0:b0:50b:d2e4:e53e with SMTP id o16-20020ac25e30000000b0050bd2e4e53emr730411lfg.27.1701439202995; Fri, 01 Dec 2023 06:00:02 -0800 (PST) Received: from [1.0.0.7] ([178.155.27.119]) by smtp.gmail.com with ESMTPSA id c16-20020a056512075000b0050bca7f7c51sm429120lfs.142.2023.12.01.06.00.01 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 01 Dec 2023 06:00:02 -0800 (PST) Message-ID: <014768ed-8b39-c44f-b07c-098c87b1644c@gmail.com> Date: Fri, 1 Dec 2023 17:00:01 +0300 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.4.2 Subject: Re: Refactoring backend fork+exec code Content-Language: en-US To: Heikki Linnakangas , Tristan Partin , Andres Freund Cc: pgsql-hackers , Thomas Munro References: <7a59b073-5b5b-151e-7ed3-8b01ff7ce9ef@iki.fi> <20230710225043.svl7fqxecwshwc7a@awork3.anarazel.de> <119551e6-60f6-49b2-ae04-a382a89f900c@iki.fi> <3b02a5a1-81ea-44e4-a09e-c0a594a4cef8@iki.fi> From: Alexander Lakhin In-Reply-To: <3b02a5a1-81ea-44e4-a09e-c0a594a4cef8@iki.fi> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Hello Heikki, 01.12.2023 15:10, Heikki Linnakangas wrote: > Attached is new version of these patches. For easier review, I made the new refactorings compared in a new commit > 0003. I will squash that before pushing, but this makes it easier to see what changed. > > Barring any new feedback or issues, I will commit these. > Maybe you could look at issues with running `make check` under Valgrind when server built with CPPFLAGS="-DUSE_VALGRIND -DEXEC_BACKEND": # +++ regress check in src/test/regress +++ # initializing database system by copying initdb template # postmaster failed, examine ".../src/test/regress/log/postmaster.log" for the reason Bail out!make[1]: *** ... 2023-12-01 16:48:39.136 MSK postmaster[1307988] LOG:  listening on Unix socket "/tmp/pg_regress-pPFNk0/.s.PGSQL.55312" ==00:00:00:01.692 1259396== Syscall param write(buf) points to uninitialised byte(s) ==00:00:00:01.692 1259396==    at 0x5245A37: write (write.c:26) ==00:00:00:01.692 1259396==    by 0x51BBF6C: _IO_file_write@@GLIBC_2.2.5 (fileops.c:1180) ==00:00:00:01.692 1259396==    by 0x51BC84F: new_do_write (fileops.c:448) ==00:00:00:01.692 1259396==    by 0x51BC84F: _IO_new_file_xsputn (fileops.c:1254) ==00:00:00:01.692 1259396==    by 0x51BC84F: _IO_file_xsputn@@GLIBC_2.2.5 (fileops.c:1196) ==00:00:00:01.692 1259396==    by 0x51B1056: fwrite (iofwrite.c:39) ==00:00:00:01.692 1259396==    by 0x552E21: internal_forkexec (postmaster.c:4518) ==00:00:00:01.692 1259396==    by 0x5546A1: postmaster_forkexec (postmaster.c:4444) ==00:00:00:01.692 1259396==    by 0x55471C: StartChildProcess (postmaster.c:5275) ==00:00:00:01.692 1259396==    by 0x557B61: PostmasterMain (postmaster.c:1454) ==00:00:00:01.692 1259396==    by 0x472136: main (main.c:198) ==00:00:00:01.692 1259396==  Address 0x1ffeffdc11 is on thread 1's stack ==00:00:00:01.692 1259396==  in frame #4, created by internal_forkexec (postmaster.c:4482) ==00:00:00:01.692 1259396== With memset(param, 0, sizeof(*param)); added at the beginning of save_backend_variables(), server starts successfully, but then `make check` fails with other Valgrind error. Best regards, Alexander