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 18265 invoked from network); 19 Jun 2022 11:40:29 -0000 Received: from tb-ob1.topicbox.com (64.147.108.173) by inbox.vuxu.org with ESMTPUTF8; 19 Jun 2022 11:40:29 -0000 Received: from tb-mx0.topicbox.com (tb-mx0.nyi.icgroup.com [10.90.30.73]) by tb-ob1.topicbox.com (Postfix) with ESMTP id C558922483 for ; Sun, 19 Jun 2022 07:40:24 -0400 (EDT) (envelope-from bounce.mMefb1eb17df6e6f347f6c5bf9.r522be890-2105-11eb-b15e-8d699134e1fa@9fans.bounce.topicbox.com) Received: by tb-mx0.topicbox.com (Postfix, from userid 1132) id C6D5229121F7; Sun, 19 Jun 2022 07:40:24 -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=T2DOXYuA 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-lj1-f181.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=1655638824; bh=TR9BWz647n7mPqAn Y9FY+E98kcYtNWPp3NpEfIY4YsY=; b=OPHxp6J0KjtusKQWTUCjz9QdAe0MxciF 15uiGRrfgAPUkAKf+yA0HkjwYCTmeSozz2dw74t1IMUFbYhqXr0LZpOCpM5eRjeV oFVl9V/7v2lo9nA0CgGpKmmYFbryhaX8zpBdZEL9esRB3qoaFlh1olR3DD7tOyrZ /BYu3v8/nms= ARC-Seal: i=2; a=rsa-sha256; cv=pass; d=topicbox.com; s=sysmsg-1; t= 1655638824; b=CNSU2NXDUbW3jtGXlUlSXRO95Wyb8mCANvpSrph1eIG4KsgR9m HfgAWncgZEVgkRlA25C7ZPMZiA46/KfxRoNm2naK+BskaXlhZbKJGuj+R1Svos3O igB6x2O3Xeti+tqjjMWb9Ff3J5l3G4IB4yRy0CoM5e0omtVidTNw+jaRA= Authentication-Results: topicbox.com; arc=pass; dkim=pass (2048-bit rsa key sha256) header.d=gmail.com header.i=@gmail.com header.b=T2DOXYuA 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-lj1-f181.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=T2DOXYuA 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.208.181 (mail-lj1-f181.google.com); spf=pass smtp.mailfrom=andrey100100100@gmail.com smtp.helo=mail-lj1-f181.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=d8VZlYbg; x-me-sender=none; x-ptr=pass smtp.helo=mail-lj1-f181.google.com policy.ptr=mail-lj1-f181.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,alt2.gmail-smtp-in.l.google.com,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,alt2.gmail-smtp-in.l.google.com,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=1655638824; x=1655725224; bh=6+2TWhU5GFXkjcEZTtnURu7gRrDBMYa0 PbIpmK01f/Y=; b=fiKyzGK/9Uk7+V5JxczyehdA/puHBTOhxjHJn58w2JOBL7Px EuJA3TuZxJBT3/bKpT3/QoodgqZ89qmeK/2dOZob20vYePVqTpP+DGG8LaT2A7YJ IuASxjUwELxHxURAoT9uMZYqcC6Vs2+7ApbMP2cYzXKffyZOVOnolIdRLvI= Received: from tb-mx1.topicbox.com (localhost.local [127.0.0.1]) by tb-mx1.topicbox.com (Postfix) with ESMTP id 05DBC1560155 for <9fans@9fans.net>; Sun, 19 Jun 2022 07:40:11 -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 F94928CA27F; Sun, 19 Jun 2022 07:40:11 -0400 ARC-Seal: i=1; a=rsa-sha256; cv=none; d=topicbox.com; s=arcseal; t= 1655638811; b=jRbdgfZdmXR2I6ylLXNSqAMtwrdLuJl7Xnc+I87N4EL5Wnm11B nnaNtrKoVczZ16Rq5UCUy9sT6LYYI256kvup5RadOzgd5SofEsKOS4XGtddNyp1H YJNJ47eRhtzvdFycbucFl0EGfxFTCMtkkuVJNu5qAcasXtJ1Sv1GIZaxYTOhQTq4 jKHV+tSPdrtCqJtgVscd4Eq6VypMg54IC/HOrR3VPXvbynnwlhv/6/RFNZnFz2zQ UcJpfCe7hVWPI98IxU4/eQbXM+nDtc857gS9zj3mwbPl0+xMylbz8x1Q1dpMyjWo JsTwmnPfhzMdCS43Sk4direz60IimyoV0n8Q== 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=1655638811; bh=HJ7VY4W1EJwWrUPOfVtX0dULRji4B/rybKb mQ6+nGVM=; b=I1riR0+qjytbLRPw6uLZiXrkLoYL4Lrpc0a4AQwl6f+/mKYaRQL WRFbLsv5kH6Q+NkbiStG4pPe01mXvr0Pp13sgNrP6/RvXEmilB7K6IwmrFyOt/+8 zIMfEpyZ2GUHPqQcYh9OopA/sTSGHAyx/S8YRV8/YF/L1SoEDWG4szsoXgQuKd+8 Roz+B84cwkzsKwd0f945na24gVg3808yilHVwKHm3nQ0reeIBSVGqWyM7v+hnZtE ejQ5ZkkxzaHkhbjVoKhHB5zNihT8b8o+r/8JsJ1oYDjW/qzquJ78ydWVxBaH/s7K m42U9JfVlTWmj3FHCvmeT6BWsOwguh+1/eA== 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=T2DOXYuA 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.208.181 (mail-lj1-f181.google.com); spf=pass smtp.mailfrom=andrey100100100@gmail.com smtp.helo=mail-lj1-f181.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=d8VZlYbg; x-me-sender=none; x-ptr=pass smtp.helo=mail-lj1-f181.google.com policy.ptr=mail-lj1-f181.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,alt2.gmail-smtp-in.l.google.com,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,alt2.gmail-smtp-in.l.google.com,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: gggruggvucftvghtrhhoucdtuddrgedvfedruddvledggeefucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdggtfgfnhhsuhgsshgtrhhisggvpdfu rfetoffkrfgpnffqhgenuceurghilhhouhhtmecufedttdenucenucfjughrpefkuffhvf ffjghftgfgfgggsehtqhertddtreejnecuhfhrohhmpegrnhgurhgvhidutddtuddttddu tddtsehgmhgrihhlrdgtohhmnecuggftrfgrthhtvghrnhepffehvdeitdekleegledvke fguefgieffuefgffdvvdehgfffiedthefgheefudejnecukfhppedvtdelrdekhedrvddt kedrudekuddpkeehrddujeegrdduleelrdekvdenucevlhhushhtvghrufhiiigvpedtne curfgrrhgrmhepihhnvghtpedvtdelrdekhedrvddtkedrudekuddphhgvlhhopehmrghi lhdqlhhjuddqfhdukedurdhgohhoghhlvgdrtghomhdpmhgrihhlfhhrohhmpeeorghnug hrvgihuddttddutddtuddttdesghhmrghilhdrtghomheq 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-lj1-f181.google.com; client-ip=209.85.208.181 Received: from mail-lj1-f181.google.com (mail-lj1-f181.google.com [209.85.208.181]) (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 07:40:11 -0400 (EDT) (envelope-from andrey100100100@gmail.com) Received: by mail-lj1-f181.google.com with SMTP id g12so3041712ljk.11 for <9fans@9fans.net>; Sun, 19 Jun 2022 04:40:10 -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=HJ7VY4W1EJwWrUPOfVtX0dULRji4B/rybKbmQ6+nGVM=; b=d8VZlYbgHrtOObNFmGcP7FRr9KnNhgVdyzNYgNrliBbl5C5eiUMeKMar0gmZQtg5Km HpTiZ9z3hUEOGQPjipWilWhA6oY66JNj2ctTWEectIGC5mW3f7ShPafx4mKJHljen4MM GtIxOVbVDMvTSXNqK/XfeLB+gHmvvy+YPFAM0AAJfiX/6nW3MDhgAZfjkxpNR/+8tELD Yh8iizca2S7SsFzd1mvPQHZPDWvkTM1cEIKkQ82AW+XhbWQHFVqWBAtA5r3xYGxYJA85 Lwc/vL+TyQkKn+I6/PklYxAewNOPIqrn/OJvrLCl55Nk8/CpxX+vwMspbAK2IeNO9hsO dkqA== X-Gm-Message-State: AJIora+4QkjckjepKVPZyCvQ4tcp+nyVlgErlPeruV4MS8uW1iAXDFdx nm3FuS8R2m2dW3csExBM3sGESzGZ14k= X-Google-Smtp-Source: AGRyM1vS1EMhgk6oBl4wNwVo/l2/5UkOHjF8DDvAnGFD6sWIEQX4UN2724MC+IjxYuDjVYDIemIBoQ== X-Received: by 2002:a05:651c:1790:b0:259:1115:1af8 with SMTP id bn16-20020a05651c179000b0025911151af8mr9413035ljb.520.1655638809318; Sun, 19 Jun 2022 04:40:09 -0700 (PDT) Received: from [10.33.77.10] ([85.174.199.82]) by smtp.gmail.com with ESMTPSA id m12-20020a19434c000000b0047daa133decsm394956lfj.166.2022.06.19.04.40.08 for <9fans@9fans.net> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 19 Jun 2022 04:40:08 -0700 (PDT) Message-ID: <9062460b3a0d6339dd0a2360c4ac35f0441a6cef.camel@gmail.com> Subject: Re: [9fans] syscall silently kill processes From: andrey100100100@gmail.com To: 9fans@9fans.net Date: Sun, 19 Jun 2022 14:40:07 +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: 9723651a-efc4-11ec-b154-c972ee773dba Archived-At: =?UTF-8?B?PGh0dHBzOi8vOWZhbnMudG9waWNib3guY29tL2dyb3Vwcy85?= =?UTF-8?B?ZmFucy9UZmE2ODIzMDQ4YWQ5MGEyMS1NZWZiMWViMTdkZjZlNmYzNDdmNmM1?= =?UTF-8?B?YmY5Pg==?= 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:Mefb1eb17df6e6f347f6c5bf9:1:5THcDtNxU5kAqQuwBsazm5BUyoxoimhMR81jETd8HLY =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[]. Ok. More complete example with thread library: ------------------------------------------------------------- #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, resp_len; 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((resp_len =3D 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); } 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 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); } } if(nproc) fprint(1, "EXIT with nproc: %d\n", nproc); threadexitsall(nil); } ------------------------------------------------------------- cpu% 6.out -n 33 EXIT with nproc: 33 with 34: cpu% 6.out -n 34 handler not registred and stalled. So it is important for me that all processes respond. Such use, it seems to me, simplifies the program. Regards, Andrej ------------------------------------------ 9fans: 9fans Permalink: https://9fans.topicbox.com/groups/9fans/Tfa6823048ad90a21-Mefb1e= b17df6e6f347f6c5bf9 Delivery options: https://9fans.topicbox.com/groups/9fans/subscription