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=-2.2 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, MAILING_LIST_MULTI,NICE_REPLY_A,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 6196 invoked from network); 18 Jun 2022 12:54:25 -0000 Received: from tb-ob1.topicbox.com (64.147.108.173) by inbox.vuxu.org with ESMTPUTF8; 18 Jun 2022 12:54:25 -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 607301AE5D for ; Sat, 18 Jun 2022 08:54:24 -0400 (EDT) (envelope-from bounce.mMa4f311286087163ef1e2565e.r522be890-2105-11eb-b15e-8d699134e1fa@9fans.bounce.topicbox.com) Received: by tb-mx0.topicbox.com (Postfix, from userid 1132) id 5DE7028F983C; Sat, 18 Jun 2022 08:54:24 -0400 (EDT) ARC-Authentication-Results: i=2; topicbox.com; arc=pass; dkim=pass (1024-bit rsa key sha256) header.d=posixcafe.org header.i=@posixcafe.org header.b=bz8PXfAe header.a=rsa-sha256 header.s=20200506 x-bits=1024; dmarc=pass policy.published-domain-policy=none policy.applied-disposition=none policy.evaluated-disposition=none (p=none,d=none,d.eval=none) policy.policy-from=p header.from=posixcafe.org; spf=pass smtp.mailfrom=moody@posixcafe.org smtp.helo=mail.posixcafe.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=message-id:date:mime-version:subject:to :references:from:in-reply-to:content-type :content-transfer-encoding:list-help:list-id:list-post :list-subscribe:reply-to:list-unsubscribe; s=sysmsg-1; t= 1655556864; bh=EzD/iXqo0p/ung8XXhm4I0rywbjcg6yYRbJxNWpxbYc=; b=d YSEMgbRlEICfrX2nx5qKLIBRCNfupD8/3dVi4+BybyXM+kwPJxAsXjlKgwFn5n0U 93zNgz8xsv3kvB9sw0UkZeV7dB1TzYvyMlIqPLqBdtRpAqfcEcO11oLJruPSwLS6 F/NIPMcWQY8RYrYi6QiS2T3+vQ9OjoLG/zKtfTqct0= ARC-Seal: i=2; a=rsa-sha256; cv=pass; d=topicbox.com; s=sysmsg-1; t= 1655556864; b=XEY4xrFmfFzmll+/YPupkEHmdI8C7+LoHaAEx6wzd/9NcW1+q4 EjiR0G5hao6nPEA0Fa1LKhOAXQldB9pT0E0WBACUeI8OO19/Fv253KVLt5w056lk C5ccYJhehc+IFVL3/EZkJxMXdrDKi6/VvUh+1TgPtHuFV2rTLNvOOJCng= Authentication-Results: topicbox.com; arc=pass; dkim=pass (1024-bit rsa key sha256) header.d=posixcafe.org header.i=@posixcafe.org header.b=bz8PXfAe header.a=rsa-sha256 header.s=20200506 x-bits=1024; dmarc=pass policy.published-domain-policy=none policy.applied-disposition=none policy.evaluated-disposition=none (p=none,d=none,d.eval=none) policy.policy-from=p header.from=posixcafe.org; spf=pass smtp.mailfrom=moody@posixcafe.org smtp.helo=mail.posixcafe.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=pass (1024-bit rsa key sha256) header.d=posixcafe.org header.i=@posixcafe.org header.b=bz8PXfAe header.a=rsa-sha256 header.s=20200506 x-bits=1024; dmarc=pass policy.published-domain-policy=none policy.applied-disposition=none policy.evaluated-disposition=none (p=none,d=none,d.eval=none) policy.policy-from=p header.from=posixcafe.org; iprev=pass smtp.remote-ip=45.76.19.58 (mail.posixcafe.org); spf=pass smtp.mailfrom=moody@posixcafe.org smtp.helo=mail.posixcafe.org; x-aligned-from=pass (Address match); x-me-sender=none; x-ptr=pass smtp.helo=mail.posixcafe.org policy.ptr=mail.posixcafe.org; x-return-mx=pass header.domain=posixcafe.org policy.is_org=yes (MX Records found: mail.posixcafe.org); x-return-mx=pass smtp.domain=posixcafe.org policy.is_org=yes (MX Records found: mail.posixcafe.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=message-id :date:mime-version:subject:to:references:from:in-reply-to :content-type:content-transfer-encoding:list-help:list-id :list-post:list-subscribe:reply-to:list-unsubscribe; s=dkim-1; t=1655556864; x=1655643264; bh=XLh9wm4iGQxzgXR9ajQ/gf4L3/Xjr3Kk acGWlrRmAqM=; b=TAsYOk5Qv+9H2zwUTxRgN4Tz9Evd94OeMaw3lVhqICBimseC ZKrNN1SfpzxXrVozWjNINtkMcvNZ4VOBgMlBK1wzEVqY465ELlpvehDUP6pbzNcU KFGRZlSQtygEyVL5CVyjaIMsZgDz5Q9/qEgCbEfQ3NfFyoQISaVdo0doHlw= Received: from tb-mx1.topicbox.com (localhost.local [127.0.0.1]) by tb-mx1.topicbox.com (Postfix) with ESMTP id 83C8415921FA for <9fans@9fans.net>; Sat, 18 Jun 2022 08:54:04 -0400 (EDT) (envelope-from moody@posixcafe.org) Received: from tb-mx1.topicbox.com (localhost [127.0.0.1]) by tb-mx1.topicbox.com (Authentication Milter) with ESMTP id D095C8EC4F2; Sat, 18 Jun 2022 08:54:04 -0400 ARC-Seal: i=1; a=rsa-sha256; cv=none; d=topicbox.com; s=arcseal; t= 1655556844; b=hmVd04PhTue8QicV1NhXrZmYQx2YkhzNCAIk3sPjZjkXO/0seq rlUHtfJaLhK0VLr8yTjrXYgZh7SkBQSc1lIfJjn10DJoR9cHhW1hnZbU6aHiHos/ HFExP/N5vIKMdET8BuesNctnj5nl9T57WD480RtoMvQfANGiora7eo9tmQ6zXMkE 0ImPyggZJrWoBzH0OMMlFg6SzbOzcOk5+K3GlwPvhG0sLw8z5zzjHuFaFveE0QWK QLqIJ0XINUkcpl/uvXiH+KA90ovBLdpvw6xwogY1KTn3/6l5NqBgisdIvAloFib3 WSLO0lKCBi6Z3EHJHmAuFhCn5428l2WrSKuw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d= topicbox.com; h=message-id:date:mime-version:subject:to :references:from:in-reply-to:content-type :content-transfer-encoding; s=arcseal; t=1655556844; bh=yQFWvxqB XmbFTdnXqKxZdwpNjlTFsT3ZkKDlWTR+tE8=; b=W4Fl5M8W7RW4vkc7ULd55COd TYmA0TPUt6B7rO0J9UEkfKgIIahsE1pH9k5mIrpzgY3r+zbSFN+HEU0Z4f8zef6J zWC4RQFUqdo/TLtKjTNJfyRBIzRCkL774+OIZkV9F3Vf0CkvUDbi2thjP3r8LFkZ yy9pDp7ElMUnzyndIZhV6sLDtCRzDZ10cqLp9aFuNnJBJ1gWCLotVqkaujzQAZk0 IGniB0YqY4COt5kGzrA9wRJl/DGCn9/MT7ikm/beJu+XFU0T6eF/NAT530jYDIRL D5m1xMa5sjWwXqfNN3/t28+fYp3W40Jdsk+rIuvfUFwQQd0nTXsjO0BKCrvCEg== ARC-Authentication-Results: i=1; tb-mx1.topicbox.com; arc=none (no signatures found); bimi=skipped (DMARC Policy is not at enforcement); dkim=pass (1024-bit rsa key sha256) header.d=posixcafe.org header.i=@posixcafe.org header.b=bz8PXfAe header.a=rsa-sha256 header.s=20200506 x-bits=1024; dmarc=pass policy.published-domain-policy=none policy.applied-disposition=none policy.evaluated-disposition=none (p=none,d=none,d.eval=none) policy.policy-from=p header.from=posixcafe.org; iprev=pass smtp.remote-ip=45.76.19.58 (mail.posixcafe.org); spf=pass smtp.mailfrom=moody@posixcafe.org smtp.helo=mail.posixcafe.org; x-aligned-from=pass (Address match); x-me-sender=none; x-ptr=pass smtp.helo=mail.posixcafe.org policy.ptr=mail.posixcafe.org; x-return-mx=pass header.domain=posixcafe.org policy.is_org=yes (MX Records found: mail.posixcafe.org); x-return-mx=pass smtp.domain=posixcafe.org policy.is_org=yes (MX Records found: mail.posixcafe.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: gggruggvucftvghtrhhoucdtuddrgedvfedruddvjedgheelucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdggtfgfnhhsuhgsshgtrhhisggvpdfu rfetoffkrfgpnffqhgenuceurghilhhouhhtmecufedttdenucenucfjughrpefkffggfg fuvfhfhfgjtgfgsehtjeertddtfeejnecuhfhrohhmpeflrggtohgsucfoohhougihuceo mhhoohguhiesphhoshhigigtrghfvgdrohhrgheqnecuggftrfgrthhtvghrnhepgfejve ejleetheejiedvveeffeegvdehhfeffedvvdeludeugeeuledvfffhgeffnecuffhomhgr ihhnpehtohhpihgtsghogidrtghomhenucfkphepgeehrdejiedrudelrdehkedpudeiud drleejrddvvdekrddufeehnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehi nhgvthepgeehrdejiedrudelrdehkedphhgvlhhopehmrghilhdrphhoshhigigtrghfvg drohhrghdpmhgrihhlfhhrohhmpeeomhhoohguhiesphhoshhigigtrghfvgdrohhrgheq X-ME-VSScore: 0 X-ME-VSCategory: clean Received-SPF: pass (posixcafe.org: 45.76.19.58 is authorized to use 'moody@posixcafe.org' in 'mfrom' identity (mechanism 'mx' matched)) receiver=tb-mx1.topicbox.com; identity=mailfrom; envelope-from="moody@posixcafe.org"; helo=mail.posixcafe.org; client-ip=45.76.19.58 Received: from mail.posixcafe.org (mail.posixcafe.org [45.76.19.58]) (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>; Sat, 18 Jun 2022 08:54:03 -0400 (EDT) (envelope-from moody@posixcafe.org) Received: from [192.168.168.200] (161-97-228-135.lpcnextlight.net [161.97.228.135]) by mail.posixcafe.org (OpenSMTPD) with ESMTPSA id 060a12ac (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO) for <9fans@9fans.net>; Sat, 18 Jun 2022 07:54:01 -0500 (CDT) Message-ID: <55d376e1-fddb-135c-c7e3-ffca9ed621d7@posixcafe.org> Date: Sat, 18 Jun 2022 06:53:08 -0600 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.8.1 Subject: Re: [9fans] syscall silently kill processes Content-Language: en-US To: 9fans@9fans.net 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> <5e2f8566-da80-6c40-9718-3a9199434e7d@SDF.ORG> From: Jacob Moody In-Reply-To: <5e2f8566-da80-6c40-9718-3a9199434e7d@SDF.ORG> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Topicbox-Policy-Reasoning: allow: sender is a member Topicbox-Message-UUID: bf8c1caa-ef05-11ec-a6fd-8c8ff5390abd Archived-At: =?UTF-8?B?PGh0dHBzOi8vOWZhbnMudG9waWNib3guY29tL2dyb3Vwcy85?= =?UTF-8?B?ZmFucy9UZmE2ODIzMDQ4YWQ5MGEyMS1NYTRmMzExMjg2MDg3MTYzZWYxZTI1?= =?UTF-8?B?NjVlPg==?= 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:Ma4f311286087163ef1e2565e:1:4vLJYcKIX91LTUtyv-fHnOBeUcJJ0LsUmpX3s1iQXs4 On 6/18/22 03:22, adr wrote: > On Sat, 18 Jun 2022, adr wrote: >=20 >> On Sat, 18 Jun 2022, andrey100100100@gmail.com wrote: >> >>> --------------------------------------------- >>> >>> cpu% 6.out | grep end | wc -l >>> 33 >>> >>> >>> Problem in unregistered handlers. >> >> But unregistered handlers shouldn't be a problem. The process is >> been killed when alarm sends the note. That's why the code worked >> removing the read statement, the alarm is set off and the note is >> not sent before the process ends. I just don't see why the process >> is been killed. The documentation describes another behavior. To >> me it smells like bug barbecue (corrupted onnote?). Maybe I got >> something wrong, bear with me. >> >>>> Note that you could register the handler in threadmain and avoid >>>> completely this issue, but as I said before, something seems wrong >>>> to me here. >>> >>> I'm don't understand how handler in threadmain would solve the problem. >>> I need in 'alarm' on per process basis. >> >> You need alarm() in every process, but you don't need to register the >> same handler 80 times! >> >> adr. >=20 > I think there is some confussion here, so I'll explain myself a > little more. >=20 > Lets change your last example to not use libthread: >=20 > #include > #include >=20 > int > handler_alarm(void *, char *msg) > { > if(strstr(msg, "alarm")){ > return 1; > } >=20 > return 0; > } >=20 > int > test(void) > { > if(atnotify(handler_alarm, 1) =3D=3D 0){ > fprint(1, "handler not registered\n"); > } >=20 > alarm(10); > fprint(1, "start\n"); > sleep(40); > fprint(1, "end\n"); > alarm(0); >=20 > return 0; > } >=20 > void > main() > { > for(int i =3D 0; i < 80; i++){ > test(); > } >=20 > exits(nil); > } >=20 > You see, after the NFNth iteration of test(), onnot[NFN] in atnotify > will be full, the handlers wont be registered but the code will > work without any problem. It doesn't matter, the first handler in > onnot[] will be executed. I fact you only need one handler there, not > 80, you should move atnotify to main. >=20 > The same should be happening with libthread. I'm really the only > one smelling a bug here? No, you've got me convinced something much more wrong is going on. Because you're right, our read children shouldn't just be gone, we should return from read with an error and then print the "end" line. I've attempted to reproduce it, trying to remove the libthread/notify factors. I've come up with this: #include #include static void proc_udp(void*) { char resp[512]; char req[] =3D "request"; int fd; int n; int pid; fd =3D dial("udp!185.157.221.201!5678", nil, nil, nil); if(fd < 0) exits("can't dial"); if(write(fd, req, strlen(req)) !=3D strlen(req)) exits("can't write"); pid =3D getpid(); fprint(1, "start %d\n", pid); n =3D read(fd, resp, sizeof(resp)-1); fprint(1, "end %d %d\n", pid, n); exits(nil); } void main(int, char**) { int i; Waitmsg *wm; for(i =3D 0; i < 10; i++){ switch(fork()){ case -1: sysfatal("fork %r"); case 0: proc_udp(nil); sysfatal("ret"); default: break; } } for(i =3D 0; i < 10; i++){ wm =3D wait(); print("proc %d died with message %s\n", wm->pid, wm->msg); } exits(nil); } This code makes it pretty obvious that we are losing some children; on my machine this program never exits. I see some portion of the readers correctly returning -1, and the parent is able to get their Waitmsg but not all of them. Thanks, moody ------------------------------------------ 9fans: 9fans Permalink: https://9fans.topicbox.com/groups/9fans/Tfa6823048ad90a21-Ma4f31= 1286087163ef1e2565e Delivery options: https://9fans.topicbox.com/groups/9fans/subscription