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_MSPIKE_H2,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 1828 invoked from network); 17 Jun 2022 18:48:43 -0000 Received: from tb-ob0.topicbox.com (64.147.108.117) by inbox.vuxu.org with ESMTPUTF8; 17 Jun 2022 18:48:43 -0000 Received: from tb-mx0.topicbox.com (tb-mx0.nyi.icgroup.com [10.90.30.73]) by tb-ob0.topicbox.com (Postfix) with ESMTP id AFEAD190EC for ; Fri, 17 Jun 2022 14:48:38 -0400 (EDT) (envelope-from bounce.mMd650ba9f9fcfad846fda95d8.r522be890-2105-11eb-b15e-8d699134e1fa@9fans.bounce.topicbox.com) Received: by tb-mx0.topicbox.com (Postfix, from userid 1132) id ACD3D28E2D29; Fri, 17 Jun 2022 14:48:38 -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=MdD8Vg8M 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-f45.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=1655491718; bh=8hdRtJS+I5LT/BoZ xrVtbaGrLS+2F+b+esaqmdWlXhQ=; b=YSyi0I0QnGI+mM6msXnNlU8tgB3bgfqY 5PvVadWCN5povhMTEOW/2lAgAJ8t+2zpyIVwQpb8uH0XNjmHLLPJjeGQnQxU0uq8 uEUMYdyJDu27fqCzQ5dCMdN2+1rtkA6hTfWgPyN/6Yh/nfaH8XiY8e8hEN8ylt4b ANRLAj6/neE= ARC-Seal: i=2; a=rsa-sha256; cv=pass; d=topicbox.com; s=sysmsg-1; t= 1655491718; b=LQzUxxB2sWmw1o/Qg5BpiB3sawIQBSI7CvlaOlX5xWw9hp3oFR 3k7l7xH2go08DscK+L4lwA0mCw/XGomacAF1jIao65UDj4Cn28mNaKBlUTeDJRmY ssW9TK88p6HA6nXtytxjAucNYQIN7HO6id6Zm9ApRmtZAvj9VWr9lM+G0= Authentication-Results: topicbox.com; arc=pass; dkim=pass (2048-bit rsa key sha256) header.d=gmail.com header.i=@gmail.com header.b=MdD8Vg8M 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-f45.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=MdD8Vg8M 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.45 (mail-lf1-f45.google.com); spf=pass smtp.mailfrom=andrey100100100@gmail.com smtp.helo=mail-lf1-f45.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=5kPIQ6sv; x-me-sender=none; x-ptr=pass smtp.helo=mail-lf1-f45.google.com policy.ptr=mail-lf1-f45.google.com; x-return-mx=pass header.domain=gmail.com policy.is_org=yes (MX Records found: alt2.gmail-smtp-in.l.google.com,alt1.gmail-smtp-in.l.google.com,alt3.gmail-smtp-in.l.google.com,alt4.gmail-smtp-in.l.google.com,gmail-smtp-in.l.google.com); x-return-mx=pass smtp.domain=gmail.com policy.is_org=yes (MX Records found: alt2.gmail-smtp-in.l.google.com,alt1.gmail-smtp-in.l.google.com,alt3.gmail-smtp-in.l.google.com,alt4.gmail-smtp-in.l.google.com,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=1655491718; x=1655578118; bh=1up3CxEZUtRiQqPZtpaxFm90kBCl+DDZ hR8VO+5mv0A=; b=OO3cY4IUwVvTEfcq7JWizqzlKLdj6dkRFgWq39sJBQhLnR5D nMlPmSn8eZQS32KKelRZBfDP7wZCXEVzh4i3DvYiK2qTSlPKKeasW7RVbbvHSGZR /6xZi3QJ7zpooRl0wb7gxRm8SKk4vH/HjZiAYRzMfGVOq7hIN2pC2k0QX9E= Received: from tb-mx1.topicbox.com (localhost.local [127.0.0.1]) by tb-mx1.topicbox.com (Postfix) with ESMTP id 40E09158C5DC for <9fans@9fans.net>; Fri, 17 Jun 2022 14:48:26 -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 248ABE7D934; Fri, 17 Jun 2022 14:48:26 -0400 ARC-Seal: i=1; a=rsa-sha256; cv=none; d=topicbox.com; s=arcseal; t= 1655491706; b=KX/8Qnw26PT0dit3gOSUXFQ775zyX/eJwTKvWpUCYfILMxulC5 KbFpzeMU+laX2kPzhmculhmdJApJjRrv5NGL0hcyKbWaErBIQvTzKON+OemmPeFI vBNhNmN35x3FiS+uP0RVdq596CAJTpc8OaLcvg/msovdsNgp8bPZC87S0wpnfzXa rKZuoVsfrrthVo5JwPzQXw2mX9cjHRTNNJvQZcRzlZc+D51l1O4+T/qUKzuOPxZs pkm4j2vnnbDcx6QmdxDgM82e3fPvBulJrW3KjLX/rksOYcB3JP3OBW4XIj3Q1uNf sw/Iqd32+DOlUrps8+tYGNwXRoeebOIDQ7+Q== 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=1655491706; bh=an0iETTvJPyJ/gUMxwAwXjK2ZlqYIN2Cd/8 MWNqCUuY=; b=Ugf8hVGxvEyn1VytfDLXfQWECxR1lRMuHv2hjn+M1IxhoQCiQic rKjf/cxLe7Lef5Jqic+s1PFTT2UkORmwprdecRc8EXncsaoPV3k0Ng2UUVCWrmkC gge2bj8Y1KcVnTzVrGzQu+OFUVHrUUayn9sjjmijn9pTr8S4FP2E3+DoXr08Z54w Q6b0Ij0kq+a5QOHo0agR9QyIZs/igOy2/WBS3Rc4JteUsZCrijy6i/ODQ2VQEyds kMG6bMI15e14RaHWpmAX5avGetiG1wQWGhOOFzFGydBdgeUer4mChxmv6kAQh+qh 5+S6QIgh50gBPsy29AVZFxpCuDwlJkxGp9A== 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=MdD8Vg8M 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.45 (mail-lf1-f45.google.com); spf=pass smtp.mailfrom=andrey100100100@gmail.com smtp.helo=mail-lf1-f45.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=5kPIQ6sv; x-me-sender=none; x-ptr=pass smtp.helo=mail-lf1-f45.google.com policy.ptr=mail-lf1-f45.google.com; x-return-mx=pass header.domain=gmail.com policy.is_org=yes (MX Records found: alt2.gmail-smtp-in.l.google.com,alt1.gmail-smtp-in.l.google.com,alt3.gmail-smtp-in.l.google.com,alt4.gmail-smtp-in.l.google.com,gmail-smtp-in.l.google.com); x-return-mx=pass smtp.domain=gmail.com policy.is_org=yes (MX Records found: alt2.gmail-smtp-in.l.google.com,alt1.gmail-smtp-in.l.google.com,alt3.gmail-smtp-in.l.google.com,alt4.gmail-smtp-in.l.google.com,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: gggruggvucftvghtrhhoucdtuddrgedvfedruddvhedguddvjecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpggftfghnshhusghstghrihgsvgdp uffrtefokffrpgfnqfghnecuuegrihhlohhuthemuceftddtnecunecujfgurhepkffuhf fvffgjfhgtgfgfggesthhqredttderjeenucfhrhhomheprghnughrvgihuddttddutddt uddttdesghhmrghilhdrtghomhenucggtffrrghtthgvrhhnpeffhedviedtkeelgeelvd ekgfeugfeiffeugfffvddvhefgffeitdehgfehfedujeenucfkphepvddtledrkeehrddu ieejrdeghedpkeehrddujeegrdduledvrddufeefnecuvehluhhsthgvrhfuihiivgeptd enucfrrghrrghmpehinhgvthepvddtledrkeehrdduieejrdeghedphhgvlhhopehmrghi lhdqlhhfuddqfheghedrghhoohhglhgvrdgtohhmpdhmrghilhhfrhhomhepoegrnhgurh gvhidutddtuddttddutddtsehgmhgrihhlrdgtohhmqe 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-f45.google.com; client-ip=209.85.167.45 Received: from mail-lf1-f45.google.com (mail-lf1-f45.google.com [209.85.167.45]) (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 14:48:25 -0400 (EDT) (envelope-from andrey100100100@gmail.com) Received: by mail-lf1-f45.google.com with SMTP id h23so8198591lfe.4 for <9fans@9fans.net>; Fri, 17 Jun 2022 11:48:25 -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=an0iETTvJPyJ/gUMxwAwXjK2ZlqYIN2Cd/8MWNqCUuY=; b=5kPIQ6svQnQV5RdZKa9AiCzOOFo1tRmpN3RRmdqxv81HGsD+0g8lBLo6Cs68H0nz83 6MPXpvIM+E04G57ZCgU4CFcM7hcLG3qczOADGUewgopRmZenGp6tk1xLnRDFe4KIicFl xzfYhYOGYxhQ2fY6PbeRQdmWb0Sd7Kmu6c5znNRhuVzDwFdHZRcSEHjjsGfClu92qHIS 2yd5EcT4vVYpd2FtLcspAMN68Zi35ZzqH9NURNiof2T04BPZzwr/1GS5n4Y0zbAbbYxU Slk+dc0LOXwUPPqaZDePDeyS2ehcPOdjOjA/4izY3A+X076FH2SEHfudm7rwqa/I5XPJ WtDw== X-Gm-Message-State: AJIora9l/QwqOs+JK+O/JYqMaLWt0F6M8DyN2gZvqO6VsbjOI4SooDS9 bgj+Iv1dhGJAj384fDRMWfKsoP5JWllUQw== X-Google-Smtp-Source: AGRyM1t75eb5EUedlEGNa91SrdqExIiFoLu5v5UTe90llocj711aoOZnNf6PxYclsfQeiWIsoCchFA== X-Received: by 2002:a05:6512:2087:b0:479:1615:3afe with SMTP id t7-20020a056512208700b0047916153afemr6190633lfr.114.1655491703882; Fri, 17 Jun 2022 11:48:23 -0700 (PDT) Received: from [10.33.77.10] ([85.174.192.133]) by smtp.gmail.com with ESMTPSA id l4-20020a2e99c4000000b0024f3d1dae87sm635293ljj.15.2022.06.17.11.48.22 for <9fans@9fans.net> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 17 Jun 2022 11:48:23 -0700 (PDT) Message-ID: Subject: Re: [9fans] syscall silently kill processes From: andrey100100100@gmail.com To: 9fans@9fans.net Date: Fri, 17 Jun 2022 21:48:22 +0300 In-Reply-To: <0e5677e6-684d-ff37-c6cd-430d18536070@posixcafe.org> References: <79286caa2ca77ea9b9a1cd64918bdc5f28c8f180.camel@gmail.com> <9e922645a598c69ba14b74e18e8669cc068e9717.camel@gmail.com> <0e5677e6-684d-ff37-c6cd-430d18536070@posixcafe.org> 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: 151a7826-ee6e-11ec-8a5f-9297c66bbb06 Archived-At: =?UTF-8?B?PGh0dHBzOi8vOWZhbnMudG9waWNib3guY29tL2dyb3Vwcy85?= =?UTF-8?B?ZmFucy9UZmE2ODIzMDQ4YWQ5MGEyMS1NZDY1MGJhOWY5ZmNmYWQ4NDZmZGE5?= =?UTF-8?B?NWQ4Pg==?= 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:Md650ba9f9fcfad846fda95d8:1:rkofYl3Wyu527d6EK3VMFV3Ibj7Kl36UQV5dj_CrWX0 =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 > > >=20 > > > This is incorrect, according to thread(2): > > >=20 > > > "The thread library depends on all procs > > > being in the same rendezvous group" > >=20 > >=20 > > From sleep(2): > >=20 > > =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. > >=20 > > Mean to be sent only to the invoking process, NOT to the process > > group. >=20 > 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. >=20 > > >=20 > > > 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. > > >=20 > > > An excerpt from notify(2): > > >=20 > > > "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." > > >=20 > > > So you are indeed observing undefined behavior. > > >=20 > >=20 > > With: > >=20 > > ------------------------------------ > > 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 } > >=20 > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 return 0; > > } > > ------------------------------------ > > result the same: > >=20 > > cpu% 6.out | grep end | wc -l > > =C2=A0=C2=A0=C2=A0=C2=A0 33 > >=20 > >=20 > > And noted(NCONT) may be needed, when process recieved many (2 and > > more) > > notes at once. > >=20 > > May be something wrong=C2=A0 with interrupted an incomplete=C2=A0 system > > call? >=20 > You _always_ should call either noted(NCONT) or noted(NDFLT). But from atnotify(2) (section 'Atnotify'): 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. from /sys/src/libc/port/atnotify.c : -------------------------------- static void notifier(void *v, char *s) { int i; for(i=3D0; i 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 Yes, with fork() is working: ------------------------------------------------------------------ #include #include static int handler_alarm(void *, char *msg) { if(strstr(msg, "alarm")) return 1; return 0; } static void proc_udp(void *) { char resp[512]; char req[] =3D "request"; int fd; atnotify(handler_alarm, 1); 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); } } 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); } } sleep(5000); exits(nil); } ------------------------------------------------------------------ cpu% 6.out | grep end | wc -l 80 But with rfork(RFPROC|RFMEM|RFNOWAIT) (the same, how in proccreate) not: cpu% 6.out | grep end | wc -l 6 strange... > So I suspected > libthread had some arbitrary limit: >=20 > #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 */ > }; >=20 > 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; >=20 > 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*), (*t= o)(void*, char*); >=20 > =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 } >=20 > That >=20 > #define NFN 33 >=20 > seems like the culprit. Looks like if you checked > the return value of threadnotify you would have seen > your notes handler was not registered. 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: #define NFN 33 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. >=20 > 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. Maybe there is a better way... Many thanks Jacob Moody and Skip Tavakkolian for showing me the light. Regards, Andrej ------------------------------------------ 9fans: 9fans Permalink: https://9fans.topicbox.com/groups/9fans/Tfa6823048ad90a21-Md650b= a9f9fcfad846fda95d8 Delivery options: https://9fans.topicbox.com/groups/9fans/subscription