Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1prb0W-0005nd-Q4 for pgsql-hackers@arkaria.postgresql.org; Wed, 26 Apr 2023 09:00:12 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1prb0V-0006VU-DG for pgsql-hackers@arkaria.postgresql.org; Wed, 26 Apr 2023 09:00:11 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1prb0V-0006VL-3j for pgsql-hackers@lists.postgresql.org; Wed, 26 Apr 2023 09:00:11 +0000 Received: from mail-lf1-x131.google.com ([2a00:1450:4864:20::131]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1prb0S-001y1J-0C for pgsql-hackers@lists.postgresql.org; Wed, 26 Apr 2023 09:00:09 +0000 Received: by mail-lf1-x131.google.com with SMTP id 2adb3069b0e04-4f001a2f3aeso1474088e87.2 for ; Wed, 26 Apr 2023 02:00:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1682499605; x=1685091605; 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=mPXxrGNtyF8Foy/Brj4Vtrf2Ar4Ui1ZZ3XcV8al42kg=; b=kDEmonfKdY2213t50TdVAmXD3UUnrpIbOwvjBKWjF/rUR1biyoKDS4iLV6lXxCotpr 9oXIxh9rtlx+gm58XG+WiwKYhVvTPvlW6W+sy9ErNa4y43m2np+al9iWUBR2xnGtD0Rd 4HYmVLowGrWnGI3XMUqQdQi2y6B5YxI4Hd3qNQrYjqiagU3o3e90GiSyHf1Dw21BHWwL 6Gk8DH8HCBdqgr4BU1vyzfMkUQ0tBo7c0Zdy16n4lT07QE6xHiAldStX0JJWXouTQPBt D62ChLCAkXJlViQ62JbFyyl3/GVRVX6bCtwKoytMDsiP9AQp4U7f671hOVxRn0Udu9v3 2+dA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1682499605; x=1685091605; 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=mPXxrGNtyF8Foy/Brj4Vtrf2Ar4Ui1ZZ3XcV8al42kg=; b=KxcVxkC6MB51rHeUH1OrnN04YadNmFABCwbynJtvUmL9V/eU4YvW6s5MYP+VjkwUa0 YhJ24ls2GUC+bZJJ8owfxad32FGYcYeE0T6dBb3R10uHfmae5J/P8WeutFH95oMiQdC0 YgZIJVFYf/F2WAEmbYNhuy83q1OB7qgnWPxcnOAgK0mmCXY78mnm8iX5fnjRUcwDz9TY bbKoZTe0kodVc0qh0WIE396hO0W2nJMmO3SEVKjKTcQR4hVIyyQDcoH4jWK6Mb0Z1bf4 aI3Bjp9iSG9dYKIygw6hVYbtiOxcMNBoTJvuD+YB0q/5SxD7NyAc1ZQ6jOgB3gvIjhsW eYKg== X-Gm-Message-State: AAQBX9fFm81wX3LIhUsCi5Yr/UOK1pTy/B3eXSaf4kRO2UsaX+tM5FD/ YtSic7xmKbWTAZNhJDzhF8gaNtIRqC0= X-Google-Smtp-Source: AKy350a/UTytPqjF13+x/uOH2ghaoP5AA4avpQnGVowajo7teZvn0qDjLu/WU/z7soM0OaIaTSTiKw== X-Received: by 2002:ac2:50c1:0:b0:4ee:da89:61e2 with SMTP id h1-20020ac250c1000000b004eeda8961e2mr5109829lfm.27.1682499605182; Wed, 26 Apr 2023 02:00:05 -0700 (PDT) Received: from [1.0.0.7] ([178.155.21.87]) by smtp.gmail.com with ESMTPSA id w14-20020ac25d4e000000b004eed8de597csm2415936lfd.32.2023.04.26.02.00.03 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 26 Apr 2023 02:00:04 -0700 (PDT) Message-ID: <2185d65f-5aae-3efa-c48f-fb42b173ef5c@gmail.com> Date: Wed, 26 Apr 2023 12:00:02 +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: Perform streaming logical transactions by background workers and parallel apply Content-Language: en-US To: Masahiko Sawada , Amit Kapila Cc: PostgreSQL Hackers References: From: Alexander Lakhin In-Reply-To: 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 hackers, Please look at a new anomaly that can be observed starting from 216a7848. The following script: echo "CREATE SUBSCRIPTION testsub CONNECTION 'dbname=nodb' PUBLICATION testpub WITH (connect = false); ALTER SUBSCRIPTION testsub ENABLE;" | psql sleep 1 rm $PGINST/lib/libpqwalreceiver.so sleep 15 pg_ctl -D "$PGDB" stop -m immediate grep 'TRAP:' server.log Leads to multiple assertion failures: CREATE SUBSCRIPTION ALTER SUBSCRIPTION waiting for server to shut down.... done server stopped TRAP: failed Assert("MyProc->backendId != InvalidBackendId"), File: "lock.c", Line: 4439, PID: 2899323 TRAP: failed Assert("MyProc->backendId != InvalidBackendId"), File: "lock.c", Line: 4439, PID: 2899416 TRAP: failed Assert("MyProc->backendId != InvalidBackendId"), File: "lock.c", Line: 4439, PID: 2899427 TRAP: failed Assert("MyProc->backendId != InvalidBackendId"), File: "lock.c", Line: 4439, PID: 2899439 TRAP: failed Assert("MyProc->backendId != InvalidBackendId"), File: "lock.c", Line: 4439, PID: 2899538 TRAP: failed Assert("MyProc->backendId != InvalidBackendId"), File: "lock.c", Line: 4439, PID: 2899547 server.log contains: 2023-04-26 11:00:58.797 MSK [2899300] LOG:  database system is ready to accept connections 2023-04-26 11:00:58.821 MSK [2899416] ERROR:  could not access file "libpqwalreceiver": No such file or directory TRAP: failed Assert("MyProc->backendId != InvalidBackendId"), File: "lock.c", Line: 4439, PID: 2899416 postgres: logical replication apply worker for subscription 16385 (ExceptionalCondition+0x69)[0x558b2ac06d41] postgres: logical replication apply worker for subscription 16385 (VirtualXactLockTableCleanup+0xa4)[0x558b2aa9fd74] postgres: logical replication apply worker for subscription 16385 (LockReleaseAll+0xbb)[0x558b2aa9fe7d] postgres: logical replication apply worker for subscription 16385 (+0x4588c6)[0x558b2aa2a8c6] postgres: logical replication apply worker for subscription 16385 (shmem_exit+0x6c)[0x558b2aa87eb1] postgres: logical replication apply worker for subscription 16385 (+0x4b5faa)[0x558b2aa87faa] postgres: logical replication apply worker for subscription 16385 (proc_exit+0xc)[0x558b2aa88031] postgres: logical replication apply worker for subscription 16385 (StartBackgroundWorker+0x147)[0x558b2aa0b4d9] postgres: logical replication apply worker for subscription 16385 (+0x43fdc1)[0x558b2aa11dc1] postgres: logical replication apply worker for subscription 16385 (+0x43ff3d)[0x558b2aa11f3d] postgres: logical replication apply worker for subscription 16385 (+0x440866)[0x558b2aa12866] postgres: logical replication apply worker for subscription 16385 (+0x440e12)[0x558b2aa12e12] postgres: logical replication apply worker for subscription 16385 (BackgroundWorkerInitializeConnection+0x0)[0x558b2aa14396] postgres: logical replication apply worker for subscription 16385 (main+0x21a)[0x558b2a932e21] I understand, that removing libpqwalreceiver.so (or whole pginst/) is not what happens in a production environment every day, but nonetheless it's a new failure mode and it can produce many coredumps when testing. IIUC, that assert will fail in case of any error raised between ApplyWorkerMain()->logicalrep_worker_attach()->before_shmem_exit() and ApplyWorkerMain()->InitializeApplyWorker()->BackgroundWorkerInitializeConnectionByOid()->InitPostgres(). Best regards, Alexander