Subject: | IO-KQueue: fflags type causing errors |
Date: | Mon, 18 Jul 2016 12:29:06 -0400 |
To: | bug-IO-KQueue [...] rt.cpan.org |
From: | Chaudhry Usman Ali <mali [...] dyn.com> |
Hi there,
Thank you for writing this module. I would like to report a bug in
IO::KQueue.
*Information:*
*http://search.cpan.org/CPAN/authors/id/M/MS/MSERGEANT/IO-KQueue-0.34.tar.gz
<http://search.cpan.org/CPAN/authors/id/M/MS/MSERGEANT/IO-KQueue-0.34.tar.gz>*
*IO-KQueue version: 0.34*
*Perl version: perl 5, version 20, subversion 3 (v5.20.3)*
*Operating System: FreeBSD 10.3-RELEASE-p4 amd64*
While testing it against perl 5.20.x, we realized that NOTE_EXIT flag is
not working because of a misconfigured flag value in KQUEUE.xs.
When you look at the NOTE_EXIT value in /usr/include/sys/event.h,
#define NOTE_EXIT 0x80000000 /* process exited */
It is being handled as u_short value for fflags in KQueue.xs
void
46 EV_SET(kq, ident, filter, flags, fflags = 0, data = 0, udata = NULL)
47 kqueue_t kq
48 uintptr_t ident
49 short filter
50 u_short flags
51 u_short fflags
52 intptr_t data
53 SV * udata
The u_short type is not able to handle the flag. This causes many
failures, zombie process generation being one of them. This behaviour was
not an issue in early versions of perl as we tested it on perl 5.8.9 as
well as perl 5.20.x. This apparently has become an issue now that leads to
failures involving EV_SET.
The solution in our case is a one line fix to change the flag to unsigned
int
--- KQueue.xs.orig 2016-07-15 19:52:38.017626000 +0000
+++ KQueue.xs 2016-07-15 19:53:56.167569000 +0000
@@ -48,7 +48,7 @@
uintptr_t ident
short filter
u_short flags
- u_short fflags
+ unsigned int fflags
intptr_t data
SV * udata
PREINIT:
On patching the port, with the above patch, the issue is resolved.
https://github.com/freebsd/freebsd-ports/tree/94e30f557b8550477e18f4bda4a23cb2c606c64f/devel/p5-IO-KQueue
Can you please advise? Thank you
*Mani*