9front - general discussion about 9front
 help / color / mirror / Atom feed
* [9front] aux/wacom: possible race
@ 2021-12-06  2:50 qwx
  2021-12-06  3:08 ` Stanley Lieber
  2021-12-14 23:55 ` qwx
  0 siblings, 2 replies; 4+ messages in thread
From: qwx @ 2021-12-06  2:50 UTC (permalink / raw)
  To: 9front

Hello,

I've been playing with aux/wacom and aux/tablet on x61t.
aux/tablet often crashes with a `no concurrent reads, please'
error mid-drawing.  From what I can tell both of these
programs are early 9front additions.  Has anyone else seen
these errors?

I think that the issue is that nothing prevents the .req
field of each Reader from being modified at the same time
as a read(2) comes in, so at some point a new read could
check the field before sendout() can clear it.  The patch
below seems to work.

What do you think?

Thanks,
qwx


diff 69249e8313fb8853c5c162dd16b927099e25bb15 uncommitted
--- a//sys/src/cmd/aux/wacom.c
+++ b//sys/src/cmd/aux/wacom.c
@@ -303,11 +303,13 @@
 		reply(req, m);
 		msgdecref(m);
 	} else {
+		lock(&readers);
 		if(r->req) {
 			respond(req, "no concurrent reads, please");
 		} else {
 			r->req = req;
 		}
+		unlock(&readers);
 	}
 }
 

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [9front] aux/wacom: possible race
  2021-12-06  2:50 [9front] aux/wacom: possible race qwx
@ 2021-12-06  3:08 ` Stanley Lieber
  2021-12-14 23:55 ` qwx
  1 sibling, 0 replies; 4+ messages in thread
From: Stanley Lieber @ 2021-12-06  3:08 UTC (permalink / raw)
  To: 9front

On December 6, 2021 2:50:19 AM UTC, qwx@sciops.net wrote:
>Hello,
>
>I've been playing with aux/wacom and aux/tablet on x61t.
>aux/tablet often crashes with a `no concurrent reads, please'
>error mid-drawing.  From what I can tell both of these
>programs are early 9front additions.  Has anyone else seen
>these errors?
>
>I think that the issue is that nothing prevents the .req
>field of each Reader from being modified at the same time
>as a read(2) comes in, so at some point a new read could
>check the field before sendout() can clear it.  The patch
>below seems to work.
>
>What do you think?
>
>Thanks,
>qwx
>
>
>diff 69249e8313fb8853c5c162dd16b927099e25bb15 uncommitted
>--- a//sys/src/cmd/aux/wacom.c
>+++ b//sys/src/cmd/aux/wacom.c
>@@ -303,11 +303,13 @@
> 		reply(req, m);
> 		msgdecref(m);
> 	} else {
>+		lock(&readers);
> 		if(r->req) {
> 			respond(req, "no concurrent reads, please");
> 		} else {
> 			r->req = req;
> 		}
>+		unlock(&readers);
> 	}
> }
> 
>

no clue as to the cause, but i do occasionally see this on both x60t and x61t.

sl

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [9front] aux/wacom: possible race
  2021-12-06  2:50 [9front] aux/wacom: possible race qwx
  2021-12-06  3:08 ` Stanley Lieber
@ 2021-12-14 23:55 ` qwx
  2021-12-15  0:00   ` Stanley Lieber
  1 sibling, 1 reply; 4+ messages in thread
From: qwx @ 2021-12-14 23:55 UTC (permalink / raw)
  To: 9front

On Mon Dec  6 02:57:05 +0100 2021, qwx@sciops.net wrote:
> Hello,
> 
> I've been playing with aux/wacom and aux/tablet on x61t.
> aux/tablet often crashes with a `no concurrent reads, please'
> error mid-drawing.  From what I can tell both of these
> programs are early 9front additions.  Has anyone else seen
> these errors?
> 
> I think that the issue is that nothing prevents the .req
> field of each Reader from being modified at the same time
> as a read(2) comes in, so at some point a new read could
> check the field before sendout() can clear it.  The patch
> below seems to work.
> 
> What do you think?
> 
> Thanks,
> qwx

After testing, the errors no longer occur.  I believe
that this is the right fix, and have pushed it.

Cheers!
qwx

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [9front] aux/wacom: possible race
  2021-12-14 23:55 ` qwx
@ 2021-12-15  0:00   ` Stanley Lieber
  0 siblings, 0 replies; 4+ messages in thread
From: Stanley Lieber @ 2021-12-15  0:00 UTC (permalink / raw)
  To: 9front

thanks!

sl

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-12-15  0:08 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-06  2:50 [9front] aux/wacom: possible race qwx
2021-12-06  3:08 ` Stanley Lieber
2021-12-14 23:55 ` qwx
2021-12-15  0:00   ` Stanley Lieber

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).