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 1tN3DE-008ChO-Pp for pgsql-hackers@arkaria.postgresql.org; Mon, 16 Dec 2024 05:00:08 +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 1tN3DC-002nQZ-8r for pgsql-hackers@arkaria.postgresql.org; Mon, 16 Dec 2024 05:00:07 +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 1tN3DB-002nQ3-Uu for pgsql-hackers@lists.postgresql.org; Mon, 16 Dec 2024 05:00:07 +0000 Received: from mail-ej1-x632.google.com ([2a00:1450:4864:20::632]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1tN3DA-0035Kv-Ax for pgsql-hackers@postgresql.org; Mon, 16 Dec 2024 05:00:06 +0000 Received: by mail-ej1-x632.google.com with SMTP id a640c23a62f3a-aa6aee68a57so536983766b.3 for ; Sun, 15 Dec 2024 21:00:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1734325202; x=1734930002; darn=postgresql.org; h=content-transfer-encoding:to:subject:from:content-language :user-agent:mime-version:date:message-id:from:to:cc:subject:date :message-id:reply-to; bh=/XE4rVMRVyEN0kVD/zYkGMg1zYM30zcelzcXhcLR5XA=; b=glZrdsJ05kQ/UfxCrMeD1e2njkcDWvAUQC+3IgGLHQwbfGJ+g/e2FZiF+6HUi4DRqp EWueVOzyVn1ZDagOMjkZmqu4sLVr6R+l05NFIxZLqRKobicI1OS1Y5Z0U1VQKmNy1i1i tGjDmKb1qY0sC5cioSHiWLoHhW3ReNnHpNFHPFbSNDaokm0mW/o1DvTtvXFc6DM3JB1R QA7wZ0lX9BQZ+YABsh/OFgG0HP6VSq3H/Bs+AWIgi0mjbsvFeCbRyU+Z9vGjbnsohHjW EBd2i8I5+o8Q0xJKz+6AdYbNpMW4dtk6iHPxFdngNt8cyb21i+UGipGcIZ6Og26A6ZTN 4Ljw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1734325202; x=1734930002; h=content-transfer-encoding:to:subject:from:content-language :user-agent:mime-version:date:message-id:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=/XE4rVMRVyEN0kVD/zYkGMg1zYM30zcelzcXhcLR5XA=; b=qgtMtepnu4AELVtCPO0hGctvvDxqtkHSKb/i1suVAuVq4FpNQKN52W7HBrK+p/tdjM B5JQRxQojr9yl7ySb2uJk2eIkvExeRcOr1nBlOHw43guPID6McpuruFaDjTM4+GmYaKD 9RwcLKWgA4Aj+zBKIE5F50yZ/MNDfny3O/g1aUOWacc2xJJJeDSxeqmlmPi0gFA2lIC+ MOK0vc/S3NfPFqkIz/WZ9BnIKryV+upBABTc/DzHxKba3qrd6J4JQV9DHgbJXHpRjQVq QtCOhfTlcaD2JIoP7SCs+qw8UjAwBLyHZADdmPNi6HM314hXVMbEAsGfiiPk6y73um1g mnvQ== X-Gm-Message-State: AOJu0YxPQgIF+gHZnHJrZswsgLyIR96gCt1p7NC+720eycWEucwam2r3 qriMQNfoIUJn2yTUnMlcsvtJYQCT4NRfgYSqfthxIFiSMuoyglyBaoAr/+qi X-Gm-Gg: ASbGncvvW/lOSzPhohdmPhX/tws3MfL3VBz5nTP7RMau9wV2z6/4A4ryVpwmJ2kyxam BOLzTRyGmXGctBoSn4Ea7qwti8fZWUi+Bdtv5HR0SqmNpxSCk7vgOWdTNaRHILuJb9dcbY+NtA2 ARkyGyor61keUz3J3dK1K5ukXPH7CSHT9w4N7QZPgoxuOPTpJHDHrtxZtP55iq9cQ+81GrZoJhN 3xzsOLWu0onRbkXhZ63hyxz2ixi13yA/QBwBLzU7Rp5Vig/giEHa4UjhfKDvA== X-Google-Smtp-Source: AGHT+IGWiGkTlEpAxb9X6x0bNYVjMEkOyyZhl6sKYIX8y6yNDs3XsBnad2zFCQLH53LlBbq6CLAGHw== X-Received: by 2002:a17:907:2d2c:b0:aa6:834b:d138 with SMTP id a640c23a62f3a-aab77909eecmr1087099766b.19.1734325202039; Sun, 15 Dec 2024 21:00:02 -0800 (PST) Received: from [192.168.100.26] ([178.168.43.57]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-aab960049b3sm285624266b.11.2024.12.15.21.00.01 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 15 Dec 2024 21:00:01 -0800 (PST) Message-ID: Date: Mon, 16 Dec 2024 07:00:00 +0200 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Content-Language: en-US From: Alexander Lakhin Subject: Regression tests fail on OpenBSD due to low semmns value To: pgsql-hackers 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, A recent buildfarm timeout failure on sawshark [1] made me wonder, what's wrong with that animal — beside that failure, this animal (running on OpenBSD 7.4) produced "too many clients" errors from time to time, e. g., [2], [3]. I deployed OpenBSD 7.4 locally and reproduced "too many clients" and that hang as well. It turned out that OpenBSD has semmns as low as 60 (see [4]) and as a consequence, initdb sets max_connections = 20 for the regression test database. (This can be helpful sometimes, see e.g., [5].) At the same time, paralell_schedule contains groups of 20 tests, for instance: # parallel group (20 tests):  select_into random delete select_having select_distinct_on case prepared_xacts namespace select_implicit union arrays portals transactions select_distinct subselect update join aggregates hash_index btree_index Moreover, prepared_xacts performs "\c", and it adds one more connection for a short time, according to postmaster.log: 2024-12-16 06:18:20.290 EET [regression][1563560:91][client backend] [pg_regress/prepared_xacts] LOG:  statement: rollback; ... 2024-12-16 06:18:20.290 EET [regression][1563561:2][client backend] [[unknown]] FATAL:  sorry, too many clients already ... 2024-12-16 06:18:20.291 EET [regression][1563560:95][client backend] [pg_regress/prepared_xacts] LOG:  disconnection: session time: 0:00:00.018 user=law database=regression host=[local] sysctl kern.seminfo.semmns=120 makes the issue go away on this OS; on the hand, "too many clients" failures can be reproduced on other OS, with "max_connections=20" in TEMP_CONFIG. As to the hang, it can be reproduced easily with: TEMP_CONFIG containing max_connections=2 superuser_reserved_connections=0 and parallel_schedule as simple as: test: transactions prepared_xacts test: transactions prepared_xacts Running `TEMP_CONFIG=.../extra.config make -s check`, I can see: # +++ regress check in src/test/regress +++ ... # parallel group (2 tests):  prepared_xacts transactions not ok 1     + transactions                               56 ms not ok 2     + prepared_xacts                             21 ms # (test process exited with exit code 2) # parallel group (2 tests): ### the test is hanging here ### with one backend waiting inside: #0  0x000070c41ed2a007 in epoll_wait (epfd=6, events=0x629f1ce529e8, maxevents=1, timeout=-1) at ../sysdeps/unix/sysv/linux/epoll_wait.c:30 #1  0x0000629f1410d64a in WaitEventSetWaitBlock (set=0x629f1ce52980, cur_timeout=-1, occurred_events=0x7ffd4c4ffed0, nevents=1) at latch.c:1564 #2  0x0000629f1410d534 in WaitEventSetWait (set=0x629f1ce52980, timeout=-1, occurred_events=0x7ffd4c4ffed0, nevents=1, wait_event_info=134217779) at latch.c:1510 #3  0x0000629f1410c764 in WaitLatch (latch=0x70c41b86bc24, wakeEvents=33, timeout=0, wait_event_info=134217779) at latch.c:538 #4  0x0000629f1413d032 in ProcWaitForSignal (wait_event_info=134217779) at proc.c:1893 #5  0x0000629f14132eb9 in GetSafeSnapshot (origSnapshot=0x629f147ad360 ) at predicate.c:1579 #6  0x0000629f14133261 in GetSerializableTransactionSnapshot (snapshot=0x629f147ad360 ) at predicate.c:1695 #7  0x0000629f143afafe in GetTransactionSnapshot () at snapmgr.c:253 #8  0x0000629f1414a7b8 in exec_simple_query (query_string=0x629f1ce580f0 "SELECT * FROM writetest;") at postgres.c:1172 ... So GetSafeSnapshot() waits indefinitely for possibleUnsafeConflicts to become empty (for other backend to remove itself from the list of possible conflicts inside ReleasePredicateLocks()), but it doesn't happen. [1] https://buildfarm.postgresql.org/cgi-bin/show_log.pl?nm=sawshark&dt=2024-12-11%2012%3A20%3A05 [2] https://buildfarm.postgresql.org/cgi-bin/show_log.pl?nm=sawshark&dt=2024-07-22%2001%3A20%3A22 [3] https://buildfarm.postgresql.org/cgi-bin/show_log.pl?nm=sawshark&dt=2024-11-25%2006%3A20%3A22 [4] https://man.openbsd.org/options [5] https://git.postgresql.org/gitweb/?p=postgresql.git;a=commit;h=73c9f91a1 Best regards, Alexander