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 1rXXqp-00BBiP-LS for pgsql-hackers@arkaria.postgresql.org; Wed, 07 Feb 2024 02:39:52 +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 1rXXqm-007XKb-JH for pgsql-hackers@arkaria.postgresql.org; Wed, 07 Feb 2024 02:39:48 +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.94.2) (envelope-from ) id 1rXXqm-007XKT-A0 for pgsql-hackers@lists.postgresql.org; Wed, 07 Feb 2024 02:39:48 +0000 Received: from mail-il1-x12c.google.com ([2607:f8b0:4864:20::12c]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1rXXqj-005re7-Ib for pgsql-hackers@postgresql.org; Wed, 07 Feb 2024 02:39:47 +0000 Received: by mail-il1-x12c.google.com with SMTP id e9e14a558f8ab-363afc38a1cso385055ab.3 for ; Tue, 06 Feb 2024 18:39:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1707273583; x=1707878383; darn=postgresql.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=fgniVHAIs0IKPjogDRp6YckUJ5bu/XajndTGoGxGNnY=; b=XBRTQRK6hha1tZjpBADoOfSyx5Emif7GFO9g4u1mMtXEYqa4Spns6faoezn5gEDQ+7 U5GRPH97khTKWdj3dz2EB6cGRBTaocTNJOuSpcDo2lfyVwDAavttXpi/3eYeAsW8Jp7h 8ETHrgmnEUItDhVtCCmdUSAfYCyUCT7YwGJQLrAEW7CsafrRPn6tn9+i6GYpBrGukFjQ Cn7EdBd1GP4EZGWmQNscmsvptjGXHkUccfCy5TKZTk7HfLcXoIu7JZL8S+fWJesQRHfm LXLub+B5IH5wc5EOTcZhiwk7UAi2pM7W4cbRo196w2PdjqanTfksrcoDeYaSl9r5kZZ1 4AJg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707273583; x=1707878383; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=fgniVHAIs0IKPjogDRp6YckUJ5bu/XajndTGoGxGNnY=; b=YAyjeHXr5tfL4ScjT8FlUXhk2Ewxd5nNGFUh+iZAQD+EZzXxHWJj7mjJcZbKYiLHmn jKLgYVMEsVYaaZUqIIxicYqbRHh05KbwO83TK2zKH0EFL00OuSP/OTqieiGW/jLEx2Xp ARLz8sI6cHO05HCqkP20sddghSOCL7aYhkzZ+QdbvGhqzTzcSr06SRNO3s3lFKfO5wuy b0ZaYhVCuHcFClD2wdCXBGLokPyYPlt5J/3aV6MgkxjMzE9m3ZU7bRwmKzDHNTROyuBg D2Oo+6T0P0GR/F2a/qXyW3UBWFeHFJsyPXMmDqI2FjiGQMuCrWb9tiGX9gA2CRKmJchG hY+w== X-Gm-Message-State: AOJu0YwKmBD0EEQxT0/8g6ZmJ6EBBRF3zOULUmjvKyaQSOpl3U2001IM fVNgpZpBUMDoOsW+EaJQeZhmB6el6Geg8q4crGvCxwb0e5n/ZpKYsOJbwvDq X-Google-Smtp-Source: AGHT+IFupmXoUfK/PZJn/uyjHQjAvFCNUqSub0f8yVEAiHCOwHoymwoMl0Te5tdlFU8dGLgRJPKBeQ== X-Received: by 2002:a05:6e02:691:b0:363:8df1:c52a with SMTP id o17-20020a056e02069100b003638df1c52amr4885930ils.8.1707273583288; Tue, 06 Feb 2024 18:39:43 -0800 (PST) X-Forwarded-Encrypted: i=1; AJvYcCUJyGwhbdXV3bqTpiz9GaZanJwjn05dwwP1kH0+cw1gT6Nv75EuU7T0WsCyGz3DNWAcgSQvAIFzQK0P6m/JJUwnXQ== Received: from nathanxps13 (162-195-168-172.lightspeed.stlsmo.sbcglobal.net. [162.195.168.172]) by smtp.gmail.com with ESMTPSA id f7-20020a056e020b4700b00363cbe42a18sm68485ilu.74.2024.02.06.18.39.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 06 Feb 2024 18:39:42 -0800 (PST) Date: Tue, 6 Feb 2024 20:39:41 -0600 From: Nathan Bossart To: pgsql-hackers@postgresql.org Cc: andres@anarazel.de, noah@leadboat.com Subject: Re: common signal handler protection Message-ID: <20240207023941.GA67817@nathanxps13> References: <20231121212008.GA3742740@nathanxps13> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20231121212008.GA3742740@nathanxps13> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Tue, Nov 21, 2023 at 03:20:08PM -0600, Nathan Bossart wrote: > * Overhead: The wrapper handler calls a function pointer and getpid(), > which AFAICT is a real system call on most platforms. That might not be > a tremendous amount of overhead, but it's not zero, either. I'm > particularly worried about signal-heavy code like synchronous > replication. (Are there other areas that should be tested?) If this is > a concern, perhaps we could allow certain processes to opt out of this > wrapper handler, provided we believe it is unlikely to fork or that the > handler code is safe to run in grandchild processes. I finally spent some time trying to measure this overhead. Specifically, I sent many, many SIGUSR2 signals to postmaster, which just uses dummy_handler(), i.e., does nothing. I was just barely able to get wrapper_handler() to show up in the first page of 'perf top' in this extreme case, which leads me to think that the overhead might not be a problem. -- Nathan Bossart Amazon Web Services: https://aws.amazon.com