From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-1.0 required=5.0 tests=DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,DKIM_VALID,FREEMAIL_FROM,MAILING_LIST_MULTI, RCVD_IN_DNSWL_NONE,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 10555 invoked from network); 19 Jun 2022 15:11:12 -0000 Received: from tb-ob21.topicbox.com (173.228.157.67) by inbox.vuxu.org with ESMTPUTF8; 19 Jun 2022 15:11:12 -0000 Received: from tb-mx0.topicbox.com (tb-mx0.nyi.icgroup.com [10.90.30.73]) by tb-ob21.topicbox.com (Postfix) with ESMTP id 41F9D2C3C5 for ; Sun, 19 Jun 2022 11:11:10 -0400 (EDT) (envelope-from bounce.mM2fc7967213269fe01e89ac5c.r522be890-2105-11eb-b15e-8d699134e1fa@9fans.bounce.topicbox.com) Received: by tb-mx0.topicbox.com (Postfix, from userid 1132) id E7DC427F3C1D; Sun, 19 Jun 2022 11:11:09 -0400 (EDT) ARC-Authentication-Results: i=2; topicbox.com; arc=pass; dkim=pass (2048-bit rsa key sha256) header.d=gmail.com header.i=@gmail.com header.b=TnbPzLwQ header.a=rsa-sha256 header.s=20210112 x-bits=2048; dmarc=pass policy.published-domain-policy=none policy.published-subdomain-policy=quarantine policy.applied-disposition=none policy.evaluated-disposition=none (p=none,sp=quarantine,d=none,d.eval=none) policy.policy-from=p header.from=gmail.com; spf=pass smtp.mailfrom=andrey100100100@gmail.com smtp.helo=mail-lf1-f51.google.com; x-internal-arc=fail (as.1.topicbox.com=pass, ams.1.topicbox.com=fail (message has been altered)) (Message modified while forwarding at Topicbox) ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d= topicbox.com; h=message-id:subject:from:to:date:in-reply-to :references:content-type:content-transfer-encoding:mime-version :list-help:list-id:list-post:list-subscribe:reply-to :list-unsubscribe; s=sysmsg-1; t=1655651469; bh=tWXYYNVDsoD4zXF9 DjaXgx1Fh26RryW6x1G4i5FXHJw=; b=J5ODAuDnjrG4xO/iHmVGZ4Z0z3HYRUCj TFjkbYvB4UN2vDjWAbLO0wSDVcUcb1BtZMgNVSx5MHai43NvyGe0vHrIzuhwzt4K PIaBoqUYEkZx8sIvnx/+ye7S1fRZj23wGlqbxJjOICUVK0XfgMozTKnt6nFHCdKf tNHZAbPgcE0= ARC-Seal: i=2; a=rsa-sha256; cv=pass; d=topicbox.com; s=sysmsg-1; t= 1655651469; b=M03OxgsAiBGao5nfxyevnA/t1mtmSHrSemq+KKraZDgVcQuPCE bsjuqzIH/bq6dX05yL+8pDSaFaoIdM579VAvyoJzwTgW7YznwmDyLHjd9o8rqe74 qoVyh+zLOO+fopVMafVWkax5PWnK0cogw6qIKWTGS4zeO8dvGE3PEWwqI= Authentication-Results: topicbox.com; arc=pass; dkim=pass (2048-bit rsa key sha256) header.d=gmail.com header.i=@gmail.com header.b=TnbPzLwQ header.a=rsa-sha256 header.s=20210112 x-bits=2048; dmarc=pass policy.published-domain-policy=none policy.published-subdomain-policy=quarantine policy.applied-disposition=none policy.evaluated-disposition=none (p=none,sp=quarantine,d=none,d.eval=none) policy.policy-from=p header.from=gmail.com; spf=pass smtp.mailfrom=andrey100100100@gmail.com smtp.helo=mail-lf1-f51.google.com; x-internal-arc=fail (as.1.topicbox.com=pass, ams.1.topicbox.com=fail (message has been altered)) (Message modified while forwarding at Topicbox) X-Received-Authentication-Results: tb-mx1.topicbox.com; arc=none (no signatures found); bimi=skipped (DMARC Policy is not at enforcement); dkim=pass (2048-bit rsa key sha256) header.d=gmail.com header.i=@gmail.com header.b=TnbPzLwQ header.a=rsa-sha256 header.s=20210112 x-bits=2048; dmarc=pass policy.published-domain-policy=none policy.published-subdomain-policy=quarantine policy.applied-disposition=none policy.evaluated-disposition=none (p=none,sp=quarantine,d=none,d.eval=none) policy.policy-from=p header.from=gmail.com; iprev=pass smtp.remote-ip=209.85.167.51 (mail-lf1-f51.google.com); spf=pass smtp.mailfrom=andrey100100100@gmail.com smtp.helo=mail-lf1-f51.google.com; x-aligned-from=pass (Address match); x-google-dkim=pass (2048-bit rsa key) header.d=1e100.net header.i=@1e100.net header.b=3JDooBmO; x-me-sender=none; x-ptr=pass smtp.helo=mail-lf1-f51.google.com policy.ptr=mail-lf1-f51.google.com; x-return-mx=pass header.domain=gmail.com policy.is_org=yes (MX Records found: alt4.gmail-smtp-in.l.google.com,alt1.gmail-smtp-in.l.google.com,gmail-smtp-in.l.google.com,alt2.gmail-smtp-in.l.google.com,alt3.gmail-smtp-in.l.google.com); x-return-mx=pass smtp.domain=gmail.com policy.is_org=yes (MX Records found: alt4.gmail-smtp-in.l.google.com,alt1.gmail-smtp-in.l.google.com,gmail-smtp-in.l.google.com,alt2.gmail-smtp-in.l.google.com,alt3.gmail-smtp-in.l.google.com); x-tls=pass smtp.version=TLSv1.2 smtp.cipher=ECDHE-RSA-AES256-GCM-SHA384 smtp.bits=256/256; x-vs=clean score=0 state=0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed; d=9fans.net; h=message-id :subject:from:to:date:in-reply-to:references:content-type :content-transfer-encoding:mime-version:list-help:list-id :list-post:list-subscribe:reply-to:list-unsubscribe; s=dkim-1; t=1655651469; x=1655737869; bh=cVtFHEIN7fep6AX9WPNnrwTVT6wVGovX 9zCO087quTs=; b=gzFLzRsFaLz+C1k03tkNyvjo632Jif1iNIju79vbKT/VgdM2 4ZoIRHxB4GZKrmEOhXKUxgxay1PWnBBMGRuVvGXx/j/HZ5bsH9KVydrFJhFok+Hd dz2qrrFSNg5M415PAr1JuSSwclTET+L+Ldvvgz0UXxc+TCNXdKo0SuVnD/Q= Received: from tb-mx1.topicbox.com (localhost.local [127.0.0.1]) by tb-mx1.topicbox.com (Postfix) with ESMTP id 09BBD1562370 for <9fans@9fans.net>; Sun, 19 Jun 2022 11:10:51 -0400 (EDT) (envelope-from andrey100100100@gmail.com) Received: from tb-mx1.topicbox.com (localhost [127.0.0.1]) by tb-mx1.topicbox.com (Authentication Milter) with ESMTP id 3A3F4E35544; Sun, 19 Jun 2022 11:10:51 -0400 ARC-Seal: i=1; a=rsa-sha256; cv=none; d=topicbox.com; s=arcseal; t= 1655651450; b=SJ17+CO4tA2Ot7ULPpAf9Pc73Y3n9ghi4k5Sxdn4jRk9kWPGWy gZGjZ3oqGk3VXnxvK8npI6ErpXqFFuClyTU8wSRviZx6vfuuvJVlOsX6IMbf0jPZ rZ0chESX8c0Zf/3WcL1GeBuYBdWRsP6dKEM/EVcBpmSEMh0/4j7uyY1XYpPucvI8 tMF1RCN9WACjMoqW6eQiImaJD0sZuX3n1kMZ6nneTgm9KXK5aYfxGY0Wt3ZBK3JZ DfXArhr3LNfXDGHrHROMOmqQCyB9Uu2kVABc2/3JXlAv6+EjNtDmC+shtkWEPwmz 5SM3rhTwmasGDuN6JJ8sPWdFMyuM65I7x4Rg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d= topicbox.com; h=message-id:subject:from:to:date:in-reply-to :references:content-type:content-transfer-encoding:mime-version; s=arcseal; t=1655651450; bh=bzpg5Npu9Sy5Bpj1++s0uewro3ZQDEWio2T 5OFP2j5s=; b=kkQab8o6p7W9pVTOtJpXtlikENnZAUVV/Yhh1FfSegQF8vrGGa0 x3PG3Pym4zzTYjexXswykFMZ8T5PmHkqKN8SCnBEz8Xc+0Pmd0HXZeG/xAkrss36 Dz/RiQyRqT56LmcHnD9QtcNtSPAjK+9K6JL+Ns3WZaTyusPCPnzzttOB/cNJjNg6 pMzc6U66VyCEBNH0SkcgjKkdZLfT+s5Q3FLj9t5nwhnrPLm96SUhoXZJCkMHe3D0 hwtmN2raatpZRl9TN6r18mL/LbL6U7QptfuKVwr6Y2dP1TPzl9YzOgIylmwUxGE5 uoLW0nhpf7nxJWYD3orrYoziack4UdghAfA== ARC-Authentication-Results: i=1; tb-mx1.topicbox.com; arc=none (no signatures found); bimi=skipped (DMARC Policy is not at enforcement); dkim=pass (2048-bit rsa key sha256) header.d=gmail.com header.i=@gmail.com header.b=TnbPzLwQ header.a=rsa-sha256 header.s=20210112 x-bits=2048; dmarc=pass policy.published-domain-policy=none policy.published-subdomain-policy=quarantine policy.applied-disposition=none policy.evaluated-disposition=none (p=none,sp=quarantine,d=none,d.eval=none) policy.policy-from=p header.from=gmail.com; iprev=pass smtp.remote-ip=209.85.167.51 (mail-lf1-f51.google.com); spf=pass smtp.mailfrom=andrey100100100@gmail.com smtp.helo=mail-lf1-f51.google.com; x-aligned-from=pass (Address match); x-google-dkim=pass (2048-bit rsa key) header.d=1e100.net header.i=@1e100.net header.b=3JDooBmO; x-me-sender=none; x-ptr=pass smtp.helo=mail-lf1-f51.google.com policy.ptr=mail-lf1-f51.google.com; x-return-mx=pass header.domain=gmail.com policy.is_org=yes (MX Records found: alt4.gmail-smtp-in.l.google.com,alt1.gmail-smtp-in.l.google.com,gmail-smtp-in.l.google.com,alt2.gmail-smtp-in.l.google.com,alt3.gmail-smtp-in.l.google.com); x-return-mx=pass smtp.domain=gmail.com policy.is_org=yes (MX Records found: alt4.gmail-smtp-in.l.google.com,alt1.gmail-smtp-in.l.google.com,gmail-smtp-in.l.google.com,alt2.gmail-smtp-in.l.google.com,alt3.gmail-smtp-in.l.google.com); x-tls=pass smtp.version=TLSv1.2 smtp.cipher=ECDHE-RSA-AES256-GCM-SHA384 smtp.bits=256/256; x-vs=clean score=0 state=0 X-ME-VSCause: gggruggvucftvghtrhhoucdtuddrgedvfedruddvledgkeeiucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdggtfgfnhhsuhgsshgtrhhisggvpdfu rfetoffkrfgpnffqhgenuceurghilhhouhhtmecufedttdenucenucfjughrpefkuffhvf ffjghftgfgfgggsehtqhertddtreejnecuhfhrohhmpegrnhgurhgvhidutddtuddttddu tddtsehgmhgrihhlrdgtohhmnecuggftrfgrthhtvghrnhepffehvdeitdekleegledvke fguefgieffuefgffdvvdehgfffiedthefgheefudejnecukfhppedvtdelrdekhedrudei jedrhedupdekhedrudejgedrudelledrkedvnecuvehluhhsthgvrhfuihiivgeptdenuc frrghrrghmpehinhgvthepvddtledrkeehrdduieejrdehuddphhgvlhhopehmrghilhdq lhhfuddqfhehuddrghhoohhglhgvrdgtohhmpdhmrghilhhfrhhomhepoegrnhgurhgvhi dutddtuddttddutddtsehgmhgrihhlrdgtohhmqe X-ME-VSScore: 0 X-ME-VSCategory: clean Received-SPF: pass (gmail.com ... _spf.google.com: Sender is authorized to use 'andrey100100100@gmail.com' in 'mfrom' identity (mechanism 'include:_netblocks.google.com' matched)) receiver=tb-mx1.topicbox.com; identity=mailfrom; envelope-from="andrey100100100@gmail.com"; helo=mail-lf1-f51.google.com; client-ip=209.85.167.51 Received: from mail-lf1-f51.google.com (mail-lf1-f51.google.com [209.85.167.51]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by tb-mx1.topicbox.com (Postfix) with ESMTPS for <9fans@9fans.net>; Sun, 19 Jun 2022 11:10:50 -0400 (EDT) (envelope-from andrey100100100@gmail.com) Received: by mail-lf1-f51.google.com with SMTP id a29so13632376lfk.2 for <9fans@9fans.net>; Sun, 19 Jun 2022 08:10:50 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:subject:from:to:date:in-reply-to :references:content-transfer-encoding:user-agent:mime-version; bh=bzpg5Npu9Sy5Bpj1++s0uewro3ZQDEWio2T5OFP2j5s=; b=3JDooBmOialja0HlLrIgVB4/RMmyqWsTA2+G6rh3gCPA+hc4g/sqjBhPIb9+Dba8D+ e4VYCG3fevp4cHwu3a4lAb9uomUeRAq505FYMabV6LMzotMnwz1auPJrJB49jSu5QrCs WTbQzUC9fwc5ma1klEV+rzTCZku6JcutEuK9RNnU1wjVJ6g2+T+MpGLe2e2ybaVAqIaY HZuuWv+bWMdadZP0vE1qCOZhRkTbCWVdGDafVt6sQUKkzX/HS8g2GZU1ycBChHmc+QND 4Q0x9dipIS48ZdX1l5pEkOS7D4jl1PkCJTu+zKreg7d9jGk8+czBG12TKH+jed8wJ8EX kD4w== X-Gm-Message-State: AJIora+jUhF7jrH/v2r50BuZJ2gxgJIFV7EZ7zUNiEHVpbZJqBJnLDAn eBviL9QeM3QWc+/lgPQtYbteSFvPM9E= X-Google-Smtp-Source: AGRyM1u1lqz5mE7+zcH59E75RU+KB9Lb8ijO3DWq5ERARDf8qF9yUYrvmisggglGcSOOcslGMKeF+A== X-Received: by 2002:a05:6512:e8d:b0:47f:5ad5:e1a1 with SMTP id bi13-20020a0565120e8d00b0047f5ad5e1a1mr4926004lfb.414.1655651448538; Sun, 19 Jun 2022 08:10:48 -0700 (PDT) Received: from [10.33.77.10] ([85.174.199.82]) by smtp.gmail.com with ESMTPSA id m3-20020a05651202e300b0047f647414eesm492627lfq.229.2022.06.19.08.10.47 for <9fans@9fans.net> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 19 Jun 2022 08:10:47 -0700 (PDT) Message-ID: <1546d1fadc4a03e6772cd93c184a3ea1cf2f7486.camel@gmail.com> Subject: Re: [9fans] syscall silently kill processes From: andrey100100100@gmail.com To: 9fans@9fans.net Date: Sun, 19 Jun 2022 18:10:46 +0300 In-Reply-To: References: <79286caa2ca77ea9b9a1cd64918bdc5f28c8f180.camel@gmail.com> <9e922645a598c69ba14b74e18e8669cc068e9717.camel@gmail.com> <0e5677e6-684d-ff37-c6cd-430d18536070@posixcafe.org> <3889a52-3fe4-c28-1c3b-a73412a489@SDF.ORG> <64a85bad-7ab-fb6-6517-acfafa819bc@SDF.ORG> <658d1591a1abef7c4a85ea3bbf23777b38247893.camel@gmail.com> <1093bce-923f-8147-1f7-ba9e146a112@SDF.ORG> <458b1f1921fb081dc181c1aaa87caea69f5f3760.camel@gmail.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.44.1 MIME-Version: 1.0 Topicbox-Policy-Reasoning: allow: sender is a member Topicbox-Message-UUID: 0483ac24-efe2-11ec-8310-ca0eadb78388 Archived-At: =?UTF-8?B?PGh0dHBzOi8vOWZhbnMudG9waWNib3guY29tL2dyb3Vwcy85?= =?UTF-8?B?ZmFucy9UZmE2ODIzMDQ4YWQ5MGEyMS1NMmZjNzk2NzIxMzI2OWZlMDFlODlh?= =?UTF-8?B?YzVjPg==?= List-Help: List-Id: "9fans" <9fans.9fans.net> List-Post: List-Software: Topicbox v0 List-Subscribe: Precedence: list Reply-To: 9fans <9fans@9fans.net> List-Unsubscribe: , Topicbox-Delivery-ID: 2:9fans:437d30aa-c441-11e9-8a57-d036212d11b0:522be890-2105-11eb-b15e-8d699134e1fa:M2fc7967213269fe01e89ac5c:1:0j-SsGkXp_g_BuVzSoEeM6kWNlPXlgVxF2khIf5qyuM =D0=92 =D0=92=D1=81, 19/06/2022 =D0=B2 10:32 +0000, adr =D0=BF=D0=B8=D1=88= =D0=B5=D1=82: > On Sun, 19 Jun 2022, andrey100100100@gmail.com=C2=A0wrote: > > No way. All processes must run simultaneously. > > NFN limit cannot be bypassed. >=20 > Yeah, that's why I said it was silly: > > > > The solution is obvious, cancel the process' handlers before it > > > > exits so we don't run out of space. > > >=20 > > > This was really silly... >=20 > The changes I'm testing are not for evading the limit, but for > making the handler managment more efficient and specially to avoid > the case when a process could remove another process' handler from > onnote[]. >=20 Yes, you were absolutely right, the thread library needs some work. It is impossible to use multiple processes with notes, due to the exhaustion of the NFN limit. as example: --------------------------------------------------------- #include #include #include static int handler_alarm(void *, char *msg) { if(strstr(msg, "alarm")){ return 1; } return 0; } static void proc_func(void *c) { Channel *chan =3D c; int fd; char req[] =3D "request"; char resp[512], *r =3D nil; if(threadnotify(handler_alarm, 1) =3D=3D 0){ fprint(1, "handler not registred\n"); } alarm(2000); if((fd =3D dial("udp!185.157.221.201!5678", nil, nil, nil)) >=3D 0){ alarm(0); alarm(2000); if(write(fd, req, strlen(req)) =3D=3D strlen(req)){ alarm(0); alarm(2000); if(read(fd, resp, sizeof(resp)) > 0){ alarm(0); if((r =3D malloc(sizeof(resp))) =3D=3D nil){ sysfatal("malloc error: %r"); } memmove(r, resp, sizeof(resp)); } } close(fd); } alarm(0); send(chan, r); threadexits(nil); } int mainstacksize =3D 5242880; void threadmain(int argc, char *argv[]) { Channel *chan =3D nil; char *data =3D nil; int nproc =3D 0; ARGBEGIN{ case 'n': nproc =3D atoi(EARGF(threadexitsall(nil))); break; default: threadexitsall(nil); }ARGEND; if((chan =3D chancreate(sizeof(char *), 0)) =3D=3D nil){ sysfatal("channel error: %r"); } for(int j =3D 0; j < 10 ; j++){ for(int i =3D 0; i < nproc; i++){ proccreate(proc_func, chan, 10240); } for(int i =3D 0; i < nproc; i++){ if(data =3D recvp(chan)){ free(data); } } fprint(1, "j: %d\n", j); } if(nproc) fprint(1, "EXIT with nproc: %d\n", nproc); threadexitsall(nil); } --------------------------------------------------------- cpu% 6.out -n 10 j: 0 j: 1 j: 2 handler not registred handler not registred handler not registred handler not registred handler not registred handler not registred handler not registred and stalled forever... And yes, threadnotify(handler_alarm, 0) in proc_func does not help. I don't know how best to get out of this situation. Probably will have to rewrite the program, so that it does not matter how many processes have fallen. But it's an increase in complexity. Regards, Andrej ------------------------------------------ 9fans: 9fans Permalink: https://9fans.topicbox.com/groups/9fans/Tfa6823048ad90a21-M2fc79= 67213269fe01e89ac5c Delivery options: https://9fans.topicbox.com/groups/9fans/subscription