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,RCVD_IN_DNSWL_NONE, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 7083 invoked from network); 17 Jun 2022 19:30:18 -0000 Received: from tb-ob21.topicbox.com (173.228.157.67) by inbox.vuxu.org with ESMTPUTF8; 17 Jun 2022 19:30:18 -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 9019820930 for ; Fri, 17 Jun 2022 15:30:12 -0400 (EDT) (envelope-from bounce.mM5173390655895122a91157bf.r522be890-2105-11eb-b15e-8d699134e1fa@9fans.bounce.topicbox.com) Received: by tb-mx0.topicbox.com (Postfix, from userid 1132) id 3B4FC28E60AA; Fri, 17 Jun 2022 15:30:12 -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=NfW7Z4cG 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= 1655494212; bh=KLCSnbLHx4YYH2BIPLLq6JLStVBO46g5I6+L1Cmh644=; b=Z J8V7RnJTFz+OrTZfNzGlHetFyLZQs+FV0gMTuBnp6HMfF/SsNxD64xsrn3m/25kN a45ErqBFb/egzV+THlAUjc4sHo6asdTnhvGa1EqjJYk7bmHI/wsGpAMHyuT5uMgz k3zQ3rnLnYkaU8Plnbs417vATq9cZngFuuqqA1M5WQ= ARC-Seal: i=2; a=rsa-sha256; cv=pass; d=topicbox.com; s=sysmsg-1; t= 1655494212; b=ontVyOSdq6IPhDsaQGsouCdHsJC9MC5HSqCMK51UWgLyaF6kR3 qdixcAln28qe0rpNr2lHEVJXnd4m/H3JW3QV/+1K0tvPnx7rc2+9wDEqtcFGZM1Q AIldNAzbK5dY8kyDo9qdoBPvlz7Qt2vW6sY03YPrtiY5mCvoe7tPlZpR4= Authentication-Results: topicbox.com; arc=pass; dkim=pass (1024-bit rsa key sha256) header.d=posixcafe.org header.i=@posixcafe.org header.b=NfW7Z4cG 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=NfW7Z4cG 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=1655494211; x=1655580611; bh=GueArdgali2P9ZyPlITaHuckEAWJTwRE 92eiP4k6788=; b=FCrAyyJZ94tvDB2C8wfyv4UnY1g6g11EfQ7Ebq1ldi5bks5m BycCzi9XwPkkf3OQ2OZTnej9qFUBEBMDoxc4kufBDoIqV6BU8ka8139jXko48cUn AzakM9rSRhdJ8LK8R+fXCqTsd8muXPlUKJQWjcMIzLoWtC2dPrr62Z9RIo8= Received: from tb-mx1.topicbox.com (localhost.local [127.0.0.1]) by tb-mx1.topicbox.com (Postfix) with ESMTP id A3BAA158CA97 for <9fans@9fans.net>; Fri, 17 Jun 2022 15:29:51 -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 C027D04A1EF; Fri, 17 Jun 2022 15:29:51 -0400 ARC-Seal: i=1; a=rsa-sha256; cv=none; d=topicbox.com; s=arcseal; t= 1655494191; b=OI8e0U6dA9TJvthwIw8HYu4eFKy0GS3O05siWXmkd/kDvo1/6c fW0l5ePxpjBSc350TD2XIQi0rkg40wIYH423dbh5QvUq5Em+Uc5wG/epHwH7VdYT aurB0ALRTK1umbKq3hcl4McHKRSB888P1fC+xS4sTv+wancLwNJr7bJO2EyWH414 O4erAoCUhNs/RgBp/GnOxiTT+YtiD0h+NhgVS8v7h5vfACLtzOIGaVCMiBplWDIL fZfeNjFevuupNBjSUL2RZErV82MPwObdF75VgpnaXe55xMqiSHM5XxHalkvpOSZE OWQUvl4n7MiYQJA8LbPlcq1prUoPRpvLfpcQ== 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=1655494191; bh=hVafnjgU M+QG/WPPCAv0pF0eSTzCr54EVGbOfdIhCUw=; b=l/SXKwGoYZb9/e3GylfX7Mxh dOUscPO07SrbjbBT8MDd2C/IyimzxyLblCANcBPauerGWfFjsiat6j2w0IIWMfdP NsyzKGDEMdIHuGW3mKNVYfKNOkpVus8cjxDm00FhzlFS7o6OwkKu/dvn4oAnm7Tm 1RkdlgkVbatJfK5usnveHYzH0htnAJOl+B6jUDTY2yg+sMwUbGuUq1fqLMgMtC+j MSrmEgSI4UbXfSR8AD3Vyi1RNQN7Sc4kfdt+YCv6eUB+PEoRbSTs3+wy8u9/YWUt A2fkbvfJl8kBopKfmg4lzxWd4Pca9IRwtfVl/sqiCW4f1vsg71XFs8Va8UCmrQ== 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=NfW7Z4cG 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: gggruggvucftvghtrhhoucdtuddrgedvfedruddvhedgudefhecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpggftfghnshhusghstghrihgsvgdp uffrtefokffrpgfnqfghnecuuegrihhlohhuthemuceftddtnecunecujfgurhepkfffgg gfuffvfhfhjggtgfesthekredttdefjeenucfhrhhomheplfgrtghosgcuofhoohguhicu oehmohhougihsehpohhsihigtggrfhgvrdhorhhgqeenucggtffrrghtthgvrhhnpeefvd eltddttdehvddugfefffdtveevleejheduffetgeehieehkeevffdvkeevkeenucffohhm rghinheplehfrhhonhhtrdhorhhgnecukfhppeeghedrjeeirdduledrheekpdduiedurd eljedrvddvkedrudefheenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepihhn vghtpeeghedrjeeirdduledrheekpdhhvghlohepmhgrihhlrdhpohhsihigtggrfhgvrd horhhgpdhmrghilhhfrhhomhepoehmohhougihsehpohhsihigtggrfhgvrdhorhhgqe 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>; Fri, 17 Jun 2022 15:29:51 -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 d73804f3 (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO) for <9fans@9fans.net>; Fri, 17 Jun 2022 14:29:49 -0500 (CDT) Message-ID: <03831b77-a3a4-5be2-aabc-7b3c2997c4b1@posixcafe.org> Date: Fri, 17 Jun 2022 13:28:57 -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> From: Jacob Moody In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Topicbox-Policy-Reasoning: allow: sender is a member Topicbox-Message-UUID: de423284-ee73-11ec-8f8a-a622c05c1c46 Archived-At: =?UTF-8?B?PGh0dHBzOi8vOWZhbnMudG9waWNib3guY29tL2dyb3Vwcy85?= =?UTF-8?B?ZmFucy9UZmE2ODIzMDQ4YWQ5MGEyMS1NNTE3MzM5MDY1NTg5NTEyMmE5MTE1?= =?UTF-8?B?N2JmPg==?= 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:M5173390655895122a91157bf:1:gTlqLCvIQirJn-IoNIFn9EiDpM3y_xSFVK3BaGjixew On 6/17/22 12:48, andrey100100100@gmail.com wrote: > =D0=92 =D0=9F=D1=82, 17/06/2022 =D0=B2 10:11 -0600, Jacob Moody =D0=BF=D0= =B8=D1=88=D0=B5=D1=82: >> On 6/17/22 09:06, andrey100100100@gmail.com=C2=A0wrote: >>> =D0=92 =D0=9F=D1=82, 17/06/2022 =D0=B2 08:11 -0600, Jacob Moody =D0=BF= =D0=B8=D1=88=D0=B5=D1=82: >>>> On 6/17/22 07:46, Thaddeus Woskowiak wrote: >>>>> I believe threadnotify() should be called from threadmain() to >>>>> properly register the handler in the rendez group >>>> >>>> This is incorrect, according to thread(2): >>>> >>>> "The thread library depends on all procs >>>> being in the same rendezvous group" >>> >>> >>> From sleep(2): >>> >>> =C2=A0=C2=A0=C2=A0 Alarm causes an alarm note (see notify(2)) to be sen= t to the >>> =C2=A0=C2=A0=C2=A0 invoking process after the number of milliseconds gi= ven by >>> =C2=A0=C2=A0=C2=A0 the argument. >>> >>> Mean to be sent only to the invoking process, NOT to the process >>> group. >> >> Yes this is correct, If I implied otherwise I apologize. My point >> with >> pointing out that excerpt is that groups likely had nothing to do >> with this. >> >>>> >>>> The issue here is that your note handler has to call noted, >>>> you are returning from the handler without actually resuming the >>>> program. >>>> You either need to call noted(NCONT) to resume execution or >>>> noted(NDFLT) >>>> to stop execution. >>>> >>>> An excerpt from notify(2): >>>> >>>> "A notification handler must finish either by exiting the >>>> program or by calling noted; if the handler returns the >>>> behavior is undefined and probably erroneous." >>>> >>>> So you are indeed observing undefined behavior. >>>> >>> >>> With: >>> >>> ------------------------------------ >>> static int >>> handler_alarm(void *, char *msg) >>> { >>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 if(strstr(msg, "alarm")){ >>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0 noted(NCONT); >>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0 return 1; >>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 } >>> >>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 return 0; >>> } >>> ------------------------------------ >>> result the same: >>> >>> cpu% 6.out | grep end | wc -l >>> =C2=A0=C2=A0=C2=A0=C2=A0 33 >>> >>> >>> And noted(NCONT) may be needed, when process recieved many (2 and >>> more) >>> notes at once. >>> >>> May be something wrong=C2=A0 with interrupted an incomplete=C2=A0 system >>> call? >> >> You _always_ should call either noted(NCONT) or noted(NDFLT). >=20 > But from atnotify(2) (section 'Atnotify'): >=20 > When the system > posts a note to the process, each handler registered with > atnotify is called with arguments as described above until > one of the handlers returns non-zero. Then noted is called > with argument NCONT. If no registered function returns > non-zero, atnotify calls noted with argument NDFLT. >=20 > from /sys/src/libc/port/atnotify.c : >=20 > -------------------------------- > static > void > notifier(void *v, char *s) > { > int i; >=20 > for(i=3D0; i if(onnot[i] && ((*onnot[i])(v, s))){ > noted(NCONT); > return; > } > noted(NDFLT); > } > -------------------------------- >=20 > Seems like noted() call not needed in user code. >=20 Oh look at that, my apologies. That's the whole difference between just notify() and atnotify(), how did I miss that. >> But you are correct in that this wasn't the exact issue. I poked >> around with the code a bit. I rewrote it to just use >> fork(), and I got all 80 "end" messages.=C2=A0 >=20 > Yes, with fork() is working: >=20 > ------------------------------------------------------------------ > #include > #include >=20 > static int > handler_alarm(void *, char *msg) > { > if(strstr(msg, "alarm")) > return 1; >=20 > return 0; > } >=20 > static void > proc_udp(void *) > { > char resp[512]; > char req[] =3D "request"; > int fd; >=20 > atnotify(handler_alarm, 1); >=20 > 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); > } >=20 > } >=20 > void > main(int argc, char *argv[]) > { > for(int i =3D 0; i < 80; i++){ > switch(fork()){ > case -1: > sysfatal("fork: %r"); > case 0: > proc_udp(nil); > exits(nil); > } > } >=20 > sleep(5000); > exits(nil); > } > ------------------------------------------------------------------ >=20 > cpu% 6.out | grep end | wc -l > 80 >=20 > But with rfork(RFPROC|RFMEM|RFNOWAIT) (the same, how in proccreate) > not: >=20 > cpu% 6.out | grep end | wc -l > 6 >=20 > strange... >=20 >> So I suspected >> libthread had some arbitrary limit: >> >> #define NFN=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0 33 >> #define ERRLEN=C2=A0 48 >> typedef struct Note Note; >> struct Note >> { >> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 Lock=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 inuse; >> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 Proc=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 *proc;=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 /* recipient */ >> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 char=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 s[ERRMAX];=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0 /* arg2 */ >> }; >> >> static Note=C2=A0=C2=A0=C2=A0=C2=A0 notes[128]; >> static Note=C2=A0=C2=A0=C2=A0=C2=A0 *enotes =3D notes+nelem(notes); >> static int=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0 (*onnote[NFN])(void*, char*); >> static int=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0 onnotepid[NFN]; >> static Lock=C2=A0=C2=A0=C2=A0=C2=A0 onnotelock; >> >> int >> threadnotify(int (*f)(void*, char*), int in) >> { >> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 int i, topid; >> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 int (*from)(void*, char*), (*= to)(void*, char*); >> >> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 if(in){ >> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0 from =3D nil; >> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0 to =3D f; >> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0 topid =3D _threadgetproc()->pid; >> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 }else{ >> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0 from =3D f; >> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0 to =3D nil; >> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0 topid =3D 0; >> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 } >> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 lock(&onnotelock); >> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 for(i=3D0; i> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0 if(onnote[i]=3D=3Dfrom){ >> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 onnote[i= ] =3D to; >> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 onnotepi= d[i] =3D topid; >> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 break; >> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0 } >> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 unlock(&onnotelock); >> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 return i> } >> >> That >> >> #define NFN 33 >> >> seems like the culprit. Looks like if you checked >> the return value of threadnotify you would have seen >> your notes handler was not registered. >=20 > Very impotant note about the return value of threadnotify. > Thanks. My mistake. > So it seemed to me that the processes silently fall. >=20 >> >> Now as to why this limit is so low, I am not sure. Perhaps >> it should be bumped up. >> >=20 > Funny, in /sys/src/libc/port/atnotify.c:4=C2=A0the same limit: >=20 > #define NFN 33 >=20 >=20 > But in case of using fork() this limit does not affect. > Maybe becose RFMEM not set and and there can be 33 handlers per child. This is exactly it, when you fork with RFMEM you share that global function array. Thus all of your children are competing for one of those 33 slots. Without it, it is exactly as you say, each child gets its own array. Thanks for doing some digging in to the code in libc. I would have complete= ly missed that. Either way it makes sense to me that these limits should be bumped. >> >> Thanks, >> moody >> >> >=20 >=20 > I did not find other way to interrupt the stalled system call > in a program, other than to send a signal to the process. >=20 > Maybe there is a better way... You are correct in thinking alarm() is how you'd interrupt a system call. That is to say, I am not aware of a better way of doing it right now. But I think you're correct in wanting something a bit better. I've never looked at code using alarm lovingly. Perhaps its time to kick some ideas around for a better way of signaling io timeouts other then alarm(). To me, it makes sense to tie them to the fd itself rather then the process as a whole. Perhaps through the /fd/*ctl interface? >=20 > Many thanks Jacob Moody and Skip Tavakkolian for showing me the light. Thank you for using the system and taking some time to report and dig in to bugs :D I also wanted to tell you that 9front does have its own mailing list for bugs and patches. If you are actively working with the system you might find the discussions there useful. http://lists.9front.org/ Thanks, moody ------------------------------------------ 9fans: 9fans Permalink: https://9fans.topicbox.com/groups/9fans/Tfa6823048ad90a21-M51733= 90655895122a91157bf Delivery options: https://9fans.topicbox.com/groups/9fans/subscription