Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

runtime: netbsd kqueue_register: event type 1 not supported for file type 5 (error 22) #22923

Closed
bradfitz opened this issue Nov 29, 2017 · 14 comments
Labels
FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done. OS-NetBSD
Milestone

Comments

@bradfitz
Copy link
Contributor

On a netbsd/amd64 builder, I saw this message, presumably from the runtime or internal/poll package:

2017/11/29 16:25:58 SERIAL: kqueue_register: event type 1 not supported for file type 5 (error 22)

/cc @ianlancetaylor

@bradfitz bradfitz added NeedsFix The path to resolution is known, but the work has not been done. OS-NetBSD labels Nov 29, 2017
@bradfitz bradfitz added this to the Go1.10 milestone Nov 29, 2017
@ianlancetaylor
Copy link
Contributor

Anybody know what file type 5 is?

@bradfitz
Copy link
Contributor Author

/cc @bsiegert @krytarowski @coypoop @cryo

@bradfitz
Copy link
Contributor Author

Maybe it's "misc":

http://cvsweb.netbsd.org/bsdweb.cgi/src/sys/sys/file.h?rev=1.77.2.4&content-type=text/x-cvsweb-markup

/*
 * Descriptor types.
 */

#define	DTYPE_VNODE	1		/* file */
#define	DTYPE_SOCKET	2		/* communications endpoint */
#define	DTYPE_PIPE	3		/* pipe */
#define	DTYPE_KQUEUE	4		/* event queue */
#define	DTYPE_MISC	5		/* misc file descriptor type */
#define	DTYPE_CRYPTO	6		/* crypto */
#define	DTYPE_MQUEUE	7		/* message queue */
#define	DTYPE_SEM	8		/* semaphore */

@bradfitz
Copy link
Contributor Author

Maybe it's /dev/urandom?

bradfitz@gdev:~/hack/netbsd-src$ git grep DTYPE_MISC
share/man/man9/file.9:.Dv DTYPE_MISC .
sys/kern/kern_descrip.c:        fp->f_type = DTYPE_MISC;
sys/miscfs/procfs/procfs_vfsops.c:                      case DTYPE_MISC:
sys/miscfs/procfs/procfs_vnops.c:               case DTYPE_MISC:
sys/rump/librump/rumpkern/cons.c:       fp->f_type = DTYPE_MISC;
sys/sys/file.h: void *fd_data;                  // DTYPE_MISC
sys/sys/file.h: struct rnd_ctx *fd_rndctx;      // DTYPE_MISC (rnd)
sys/sys/file.h: struct audio_chan *fd_audioctx; // DTYPE_MISC (audio)
sys/sys/file.h: struct pad_softc *fd_pad;       // DTYPE_MISC (pad)
sys/sys/file.h: int fd_devunit;                 // DTYPE_MISC (tap)
sys/sys/file.h: struct bpf_d *fd_bpf;           // DTYPE_MISC (bpf)
sys/sys/file.h: struct iscsifd *fd_iscsi;       // DTYPE_MISC (iscsi)
sys/sys/file.h:#define  DTYPE_MISC      5               /* misc file descriptor type */
usr.bin/fstat/fstat.c:  case DTYPE_MISC:

I'm totally guessing.

@krytarowski
Copy link
Contributor

Is there a reproducer? I'm not sure what might be wrong.

@bradfitz
Copy link
Contributor Author

@krytarowski, run Go's all.bash and watch the kernel log. I have a program that tails both and blends them together (they might not be perfectly lined up), but:

ok      html/template   0.050s
ok      image   0.265s
ok      image/color     0.032s
ok      image/draw      0.085s
2017/11/30 16:46:09 SERIAL: kqueue_register: event type 1 not supported for file type 5 (error 22)
2017/11/30 16:46:40 SERIAL: kqueue_register: event type 1 not supported for file type 5 (error 22)
2017/11/30 16:46:47 SERIAL: kqueue_register: event type 1 not supported for file type 5 (error 22)
ok      image/gif       60.090s
ok      image/jpeg      0.984s
ok      image/png       0.120s
ok      index/suffixarray       0.110s
ok      internal/cpu    0.004s
ok      internal/poll   0.039s
ok      internal/singleflight   0.014s
ok      internal/trace  6.980s
ok      io      0.531s
ok      io/ioutil       0.014s
ok      log     0.011s
ok      log/syslog      2.032s
ok      math    0.012s
ok      math/big        29.052s
ok      math/bits       0.011s
ok      math/cmplx      0.006s
ok      math/rand       2.023s
ok      mime    0.039s
ok      mime/multipart  12.584s
ok      mime/quotedprintable    11.152s
2017/11/30 16:46:59 SERIAL: kqueue_register: event type 1 not supported for file type 5 (error 22)
2017/11/30 16:47:03 SERIAL: kqueue_register: event type 0 not supported for file type 1 (error 45)
                            kqueue_register: event type 0 not supported for file type 1 (error 45)
                            kqueue_register: event type 1 not supported for file type 5 (error 22)
2017/11/30 16:48:42 SERIAL: kqueue_register: event type 0 not supported for file type 1 (error 45)

... looks like there's also event type 0 not supported for file type 1.

@bradfitz
Copy link
Contributor Author

Unrelated other fun stuff the kernel spits out during all.bash:

2017/11/30 17:06:33 SERIAL: Kernel RNG "7056 0 1" runs test FAILURE: too few runs of 2 0s (1114 <= 1114)
                            cprng 7056 0 1: failed statistical RNG test
2017/11/30 17:07:04 SERIAL: Kernel RNG "24926 9 0" long run test FAILURE: Run of 26 0s found
                            cprng 24926 9 0: failed statistical RNG test

@zoulasc
Copy link
Contributor

zoulasc commented Nov 30, 2017

kqueue_register: event type 1 not supported for file type 5 (error 22)
is trying to register an fd on /dev/urandom for write events, gets EINVAL. What go is doing is questionable, but nevertheless am considering to make it succeed.

@bradfitz
Copy link
Contributor Author

@zoulasc, thanks for confirming. Of course, Go doesn't specifically care about /dev/urandom writability (it never tries to write to it). It's just that as of Go 1.9, the os package tries registering all file handles with the OS poller, not knowing what callers are going to do with them. (IIRC)

But perhaps that's a mistake on our side too if the file was opened for only read. @ianlancetaylor?

@ianlancetaylor
Copy link
Contributor

No, this is intentional. The poller is used for reading too. It's unfortunate that the kernel logs a message but I think the Go code is acting reasonably, and it will handle the error return correctly (by not using the poller for that file). It's true that we could perhaps split the poller apart to handle reading and writing separately, but that seems like extra work for no gain.

@krytarowski
Copy link
Contributor

This message is just under DEBUG build. Without checking in detail, it should be disabled in releases as -current branches have enabled extra debugging.

@bradfitz
Copy link
Contributor Author

Thanks. Will close.

@zoulasc
Copy link
Contributor

zoulasc commented Dec 1, 2017

kqueue_register: event type 0 not supported for file type 1 (error 45)
this is trying to kqueue a file descriptor mounted on procfs and I just fixed procfs to allow that since it allows polling. I also made the urandom fd to accept registering for write events and never returning them.

@bradfitz
Copy link
Contributor Author

bradfitz commented Dec 1, 2017

@zoulasc, thanks! That'll be less kernel log spam to worry about.

@golang golang locked and limited conversation to collaborators Dec 1, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done. OS-NetBSD
Projects
None yet
Development

No branches or pull requests

5 participants