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_SIGNED,DKIM_VALID, MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 28444 invoked from network); 21 Jun 2022 11:26:44 -0000 Received: from tb-ob1.topicbox.com (64.147.108.173) by inbox.vuxu.org with ESMTPUTF8; 21 Jun 2022 11:26:44 -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 4D4A634F98 for ; Tue, 21 Jun 2022 07:26:33 -0400 (EDT) (envelope-from bounce.mMf12e91abda54e653de320337.r522be890-2105-11eb-b15e-8d699134e1fa@9fans.bounce.topicbox.com) Received: by tb-mx0.topicbox.com (Postfix, from userid 1132) id 4A678295C9B4; Tue, 21 Jun 2022 07:26:33 -0400 (EDT) ARC-Authentication-Results: i=2; topicbox.com; arc=pass; dkim=none (no signatures found); dmarc=pass policy.published-domain-policy=none policy.published-subdomain-policy=none policy.applied-disposition=none policy.evaluated-disposition=none (p=none,sp=none,d=none,d.eval=none) policy.policy-from=p header.from=sdf.org; spf=pass smtp.mailfrom=adr@SDF.ORG smtp.helo=mx.sdf.org; 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=date:from:to:subject:in-reply-to:message-id :references:mime-version:content-type:list-help:list-id :list-post:list-subscribe:reply-to:content-transfer-encoding :list-unsubscribe; s=sysmsg-1; t=1655810793; bh=U15LBh+jobv7KpbW HVQYS9jz5PK7WGWihMvEIh1TCNQ=; b=RoCCPvBPrGditV4xNkoDW1W8bHzO7Z4T mmd5Ov3x1I9Z4QKOcDha/YDcRfuMLRxkFZuymMDRZj5T6bbjtWBKUaiHrKFUdR1Y C6i9RjYvPhtyMv/nH8YyYm7wY1muEworP2kIDrC4L9/w7+jYVAszgqp8kITQc1qA +Njln2Nrn/w= ARC-Seal: i=2; a=rsa-sha256; cv=pass; d=topicbox.com; s=sysmsg-1; t= 1655810793; b=WX5GwKySDfzXUKLhL/18kGnabRqCbWDCp0JdJaWep5zPK4RYqL kFps44zhjKczvTbErvhnwYFjPde07KtYLiIVit0bH0vwCA7lA1jatUmS2/Z5uQoM s7V/jZndeQqHqAes2FV2WMREZJzJaYUXDmaUPXAqXB+lzSZyTBzSBY0HE= Authentication-Results: topicbox.com; arc=pass; dkim=none (no signatures found); dmarc=pass policy.published-domain-policy=none policy.published-subdomain-policy=none policy.applied-disposition=none policy.evaluated-disposition=none (p=none,sp=none,d=none,d.eval=none) policy.policy-from=p header.from=sdf.org; spf=pass smtp.mailfrom=adr@SDF.ORG smtp.helo=mx.sdf.org; 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=none (no signatures found); dmarc=pass policy.published-domain-policy=none policy.published-subdomain-policy=none policy.applied-disposition=none policy.evaluated-disposition=none (p=none,sp=none,d=none,d.eval=none) policy.policy-from=p header.from=sdf.org; iprev=pass smtp.remote-ip=205.166.94.24 (mx.sdf.org); spf=pass smtp.mailfrom=adr@SDF.ORG smtp.helo=mx.sdf.org; x-aligned-from=pass (Address match); x-me-sender=none; x-ptr=pass smtp.helo=mx.sdf.org policy.ptr=mx.sdf.org; x-return-mx=pass header.domain=sdf.org policy.is_org=yes (MX Records found: mx.sdf.org); x-return-mx=pass smtp.domain=sdf.org policy.is_org=yes (MX Records found: mx.sdf.org); 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=date:from :to:subject:in-reply-to:message-id:references:mime-version :content-type:list-help:list-id:list-post:list-subscribe :reply-to:content-transfer-encoding:list-unsubscribe; s=dkim-1; t=1655810793; x=1655897193; bh=nnMfDlIa17lZ1RJrXQaF8UrUctaZVoq/ S1ljAMIqU8A=; b=d6Y8dgg0f8uQSLxVfw5Uvqj7IVaEkF6JSc/02OckW1bmGDAr fdLCPR62aSDqE6Au2u7w0rLEjJyE9afjG4XSyQt6lRFCCiY1Hu69QCgCxsFw3Fhe yaF0/0tA5HJOHqLLOx7PSpxMdGRTnUBmRUIYnchnfltx0xiAxb9lI4tjDxA= Received: from tb-mx1.topicbox.com (localhost.local [127.0.0.1]) by tb-mx1.topicbox.com (Postfix) with ESMTP id 3F7331593744 for <9fans@9fans.net>; Tue, 21 Jun 2022 07:26:21 -0400 (EDT) (envelope-from adr@SDF.ORG) Received: from tb-mx1.topicbox.com (localhost [127.0.0.1]) by tb-mx1.topicbox.com (Authentication Milter) with ESMTP id F209E17D94C; Tue, 21 Jun 2022 07:26:21 -0400 ARC-Seal: i=1; a=rsa-sha256; cv=none; d=topicbox.com; s=arcseal; t= 1655810781; b=DcZdOZ6EU+EjilxkHnwwXOzpbChhGGNv7JJXDGtFu81RCGwUyt /uQzYZTMmjVBODjSUKDbrsPd8gg7/rVkjCX/pUCaVI2qISPLc3Gw6oJM2O+8DkO0 TAKLx5AcbFxNbb+k6veoYpwHNfKby+uSRWXqJq1/Hws5Krc4VXaEOl+T5d/5Bk8D hsqNlVLnAJWthxE1FCSflk8ypX9PDXFXkQK21B0cwk6RYH/Ru/Eq4CbK5me+SKtO MFObK9g45dE7W6PU63J2utnGT0ZWgU9aeAJR75yWknY7Em6JwWfg2HARsqCv9dpA JOk6ywytyYI6jFJHWty/wkD1kQPXh+vVBNxw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d= topicbox.com; h=date:from:to:subject:in-reply-to:message-id :references:mime-version:content-type; s=arcseal; t=1655810781; bh=z7sFajCXXFSx4QWtOk61HmA+fjfCIDHUHtqvfpGzob4=; b=R6drlCLOC11I d4MnWbA5lvq4uNuiRdvsiiNnF813AeQsOKRl8IBLoA1q8xRanICSWRKsTNVRS3C5 WAXmA3zNRG9qEZJfninKaXqdroK2jB6bWQu9rxiO43crAtKT9cpZ0RzD1bkUKatw CppC++kNa9lchnUe7ZiEU7Eo+0vfv0uP5o/UGmaOTsQvNG+t3gqWqw+rksoD5RK3 eAHiDKVyeXH/7FQm7a4CNdLfdvtxA5oiIQYiJ3o29KqBde8pdr3j50NKAEbrg5kn eF2T6J9sCATMWN+5rnZ9K86D1ITUoqZSXjXozLrHysQqSSEt4g8Hs6PIfHjit/JX gKB2lxnr9w== ARC-Authentication-Results: i=1; tb-mx1.topicbox.com; arc=none (no signatures found); bimi=skipped (DMARC Policy is not at enforcement); dkim=none (no signatures found); dmarc=pass policy.published-domain-policy=none policy.published-subdomain-policy=none policy.applied-disposition=none policy.evaluated-disposition=none (p=none,sp=none,d=none,d.eval=none) policy.policy-from=p header.from=sdf.org; iprev=pass smtp.remote-ip=205.166.94.24 (mx.sdf.org); spf=pass smtp.mailfrom=adr@SDF.ORG smtp.helo=mx.sdf.org; x-aligned-from=pass (Address match); x-me-sender=none; x-ptr=pass smtp.helo=mx.sdf.org policy.ptr=mx.sdf.org; x-return-mx=pass header.domain=sdf.org policy.is_org=yes (MX Records found: mx.sdf.org); x-return-mx=pass smtp.domain=sdf.org policy.is_org=yes (MX Records found: mx.sdf.org); 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: gggruggvucftvghtrhhoucdtuddrgedvfedrudeffedgfeelucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdggtfgfnhhsuhgsshgtrhhisggvpdfu rfetoffkrfgpnffqhgenuceurghilhhouhhtmecufedttdenucenucfjughrpeffhffvuf gjkfhfgggtsehttdertddttddvnecuhfhrohhmpegrughruceorggurhesufffhfdrqfft ifeqnecuggftrfgrthhtvghrnhepkefftdejfeetudeivdejhedtkedvffehudeuieduie eihffgfeffvdeiledvjeeunecuffhomhgrihhnpehgihhthhhusgdrtghomhenucfkphep vddthedrudeiiedrleegrddvgedpvddthedrudeiiedrleegrdduieenucevlhhushhtvg hrufhiiigvpedtnecurfgrrhgrmhepihhnvghtpedvtdehrdduieeirdelgedrvdegpdhh vghlohepmhigrdhsughfrdhorhhgpdhmrghilhhfrhhomhepoegrughrsefufffhrdfqtf fiqe X-ME-VSScore: 0 X-ME-VSCategory: clean Received-SPF: pass (sdf.org: 205.166.94.24 is authorized to use 'adr@SDF.ORG' in 'mfrom' identity (mechanism 'ip4:205.166.94.0/24' matched)) receiver=tb-mx1.topicbox.com; identity=mailfrom; envelope-from="adr@SDF.ORG"; helo=mx.sdf.org; client-ip=205.166.94.24 Received: from mx.sdf.org (mx.sdf.org [205.166.94.24]) (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>; Tue, 21 Jun 2022 07:26:20 -0400 (EDT) (envelope-from adr@SDF.ORG) Received: from sdf.org (IDENT:adr@sdf.org [205.166.94.16]) by mx.sdf.org (8.15.2/8.14.5) with ESMTPS id 25LBQHHG018092 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256 bits) verified NO) for <9fans@9fans.net>; Tue, 21 Jun 2022 11:26:18 GMT Received: from localhost (adr@localhost) by sdf.org (8.15.2/8.12.8/Submit) with ESMTP id 25LBQH7r001480 for <9fans@9fans.net>; Tue, 21 Jun 2022 11:26:17 GMT Date: Tue, 21 Jun 2022 11:26:17 +0000 (UTC) From: adr To: 9fans <9fans@9fans.net> Subject: Re: [9fans] syscall silently kill processes In-Reply-To: <770c427561d318ba28f7f4fb820577398f49fef8.camel@gmail.com> Message-ID: <7d9742ec-51f0-34d1-714-6f308975da34@SDF.ORG> References: <2b857fe-c6df-a6b8-40ec-566c85b7377d@SDF.ORG> <770c427561d318ba28f7f4fb820577398f49fef8.camel@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Topicbox-Policy-Reasoning: allow: sender is a member Topicbox-Message-UUID: fc576436-f154-11ec-b4c5-ea4af0160437 Archived-At: =?UTF-8?B?PGh0dHBzOi8vOWZhbnMudG9waWNib3guY29tL2dyb3Vwcy85?= =?UTF-8?B?ZmFucy9UZmE2ODIzMDQ4YWQ5MGEyMS1NZjEyZTkxYWJkYTU0ZTY1M2RlMzIw?= =?UTF-8?B?MzM3Pg==?= List-Help: List-Id: "9fans" <9fans.9fans.net> List-Post: List-Software: Topicbox v0 List-Subscribe: Precedence: list Reply-To: 9fans <9fans@9fans.net> Content-Transfer-Encoding: quoted-printable List-Unsubscribe: , Topicbox-Delivery-ID: 2:9fans:437d30aa-c441-11e9-8a57-d036212d11b0:522be890-2105-11eb-b15e-8d699134e1fa:Mf12e91abda54e653de320337:1:dfmr8R5Nr0vkD1LCg8zme-gc0csLWqXkegS-H90tX6k On Tue, 21 Jun 2022, andrey100100100@gmail.com wrote: > ? ??, 20/06/2022 ? 15:29 -0700, Skip Tavakkolian ?????: >> It's cleaner to use channels with separate io and timer threads that >> do their syscalls via ioproc; this one doesn't require any changes to >> libthread: >> >> https://gist.github.com/9nut/aaa9b9b6a22d69996b75ccdc6e615c61 > > Thanks for the work you've done! > Yes, I have considered this possibility. > But it was precisely this kind of code bloat that I wanted to avoid. It looks like code bloat, but it really isn't. It is doing the job with the tools of the api according to the paradigm designed in libthread. That's why the word "cleaner" is completely correct. I think note.c was added to resolve some particual case, and for the state of note.c, I don't think it has been used too much. For example, let's remove note.c. You could obtain the same result in your example (all processes using the same handler) using atnotify because the notes are registered to the children when proccreate uses rfork: void threadmain(int argc, char *argv[]) { atnotify(handler_alarm, 1); ./5.out | grep end | wc -l 80 If you have to use a different handler for each processes you can't use atnotify because of RFMEM, but you can use the syscalls notify and noted: #include =20 #include =20 #include static void handler_alarm(void *, char *msg) { if(strstr(msg, "alarm")){ print("yes"); noted(NCONT); return; /* just in case */ } noted(NDFLT); } static void proc_udp(void *) { char resp[512]; char req[] =3D "request"; int fd; notify(handler_alarm); if((fd =3D dial("udp!185.157.221.201!5678", nil, nil, nil)) >=3D 0){ if(write(fd, req, strlen(req)) =3D=3D strlen(req)){ fprint(1, "start\n"); alarm(2000); read(fd, resp, sizeof(resp)); alarm(0); fprint(1, "end\n"); } close(fd); } threadexits(nil); } int mainstacksize =3D 5242880; void threadmain(int argc, char *argv[]) { for(int i =3D 0; i < 80; i++) proccreate(proc_udp, nil, 10240); sleep(5000); threadexitsall(nil); } ./5.out | grep end | wc -l 80 Threadnotify is trying to do an atnotify that works with RFMEM, but to do that onnote should be allocated to grow or shrink (or have a size thinking in the maximum number of processes the program could spawn, not the number of handlers a process could register as in atnotify), instead of pointers to handlers, it should be an array of pointers to arrays of handlers allocated by each process. Now again, does the notes mechanism actually fit in libthread? If it does it should be fixed, if not removed. adr. ------------------------------------------ 9fans: 9fans Permalink: https://9fans.topicbox.com/groups/9fans/Tfa6823048ad90a21-Mf12e9= 1abda54e653de320337 Delivery options: https://9fans.topicbox.com/groups/9fans/subscription