Skip Menu |
 
Update: The rt.cpan.org bug tracker service is no longer shutting down.

This queue is for tickets about the Danga-Socket CPAN distribution.

Report information
The Basics
Id: 129724
Status: resolved
Priority: 0/
Queue: Danga-Socket

People
Owner: Nobody in particular
Requestors: e [...] 80x24.org
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: 1.62

Attachments
0001-set-close-on-exec-flag-on-epoll-descriptors.patch
0002-fixup-use-POSIX-close-on-KQueue-FD-if-IO-Handle-is-u.patch



Subject: [PATCH] set close-on-exec flag on epoll descriptors
Date: Sat, 1 Jun 2019 03:56:24 +0000
To: bug-Danga-Socket [...] rt.cpan.org
From: Eric Wong <e [...] 80x24.org>
Download (untitled) / with headers
text/plain 146b
We should not be leaking these FDs to spawned processes, in case those processes have a bug which cause it to access the wrong FD. See attached.

Message body is not shown because sender requested not to inline it.

Subject: [rt.cpan.org #129724] fixup: use POSIX::close on KQueue FD if IO::Handle is undef
Date: Sat, 1 Jun 2019 19:09:26 +0000
To: bug-Danga-Socket [...] rt.cpan.org
From: Eric Wong <e [...] 80x24.org>
Download (untitled) / with headers
text/plain 330b
Attached a patch which can be squashed on top because kqueue is special: fixup: use POSIX::close on KQueue FD if IO::Handle is undef Note: this does not fix the case where Reset() is called across fork; we'd need to remember the creator PID of the kqueue descriptor and skip closing it if real kqueue is in use.

Message body is not shown because sender requested not to inline it.

Subject: Re: [rt.cpan.org #129724] fixup: use POSIX::close on KQueue FD if IO::Handle is undef
Date: Sat, 1 Jun 2019 20:51:43 +0000
To: bug-Danga-Socket [...] rt.cpan.org
From: Eric Wong <e [...] 80x24.org>
Download (untitled) / with headers
text/plain 1.4k
*sigh* our POSIX::close on $KQueue has always been totally broken for other reasons, too. For one, $KQueue is a scalar ref to an integer FD, so we would need use POSIX::close($$KQueue). POSIX::close($KQueue) (single '$') is closing the wrong thing, leading to EBADF in the best case. I'm inclined to only support IO::KQueue on systems with native kqueue, and not emulation layers like libkqueue; because fully emulating kqueue is tough w/o kernel support for close-on-fork. Background: Native kqueue implies both close-on-exec AND close-on-fork behavior. No other filetype I know of has close-on-fork behavior; but it sorta makes sense given kqueue is keyed exclusively by file descriptor, not the combination of [file descriptor AND file description] like epoll is. So yeah, it can be tough to future proof this in case Linux ever starts supporting close-on-fork and libkqueue uses it... Conclusion: ignore kqueue emulation layers like libkqueue and assume kqueue is always both close-on-exec and close-on-fork; like it is on FreeBSD. It's not like Danga::Socket is urgently awaiting another release given the lack of active maintainer or even ability to transfer maintainership. So I'll take a look at this another day... Anyone: Feel free to plain-text email me or Cc: me on a public list about epoll/kqueue/poll stuff any time in the future. Just don't expect me to use proprietary messaging systems or deal with JavaScript crap on the web.
Download (untitled) / with headers
text/plain 452b
The bug is fixed in https://cpan.metacpan.org/authors/id/N/NM/NML/Danga-Socket-1.62_03-TRIAL.tar.gz Please test and/or review the code. It's a preview version and I'll release normal 1.62 in a week or so if no new easy to fix problems are discovered. - CPAN Testers: http://matrix.cpantesters.org/?dist=Danga-Socket+1.62_03-TRIAL (all green at the time of the posting) - GitHub: https://github.com/nponeccop/libdanga-socket-perl/tree/windows-blocking


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.