On Mon, Feb 1, 2016 at 4:15 PM, Nathan Huff <[email protected]> wrote: > It appears that port_getn with nget set to 1 can return an event with the > return value set to -1 and errno set to ETIME. Is that supposed to be > possible? I understand why it would be possible to get events and the > above behaviour with nget set > 1, but if I ask for 1 event and you give me > one event it seems odd that the return code would indicate an error. >
This is one of a family of deeply regrettable, longstanding issues with port_get()/port_getn(). It's hard to find references to the old Sun bugs describing the issues, but I did find these: http://us-east.manta.joyent.com/jmc/public/opensolaris/bugdb/bug.html#!6874410 http://us-east.manta.joyent.com/jmc/public/opensolaris/bugdb/bug.html#!6873782 http://us-east.manta.joyent.com/jmc/public/opensolaris/bugdb/bug.html#!6456558 http://us-east.manta.joyent.com/jmc/public/opensolaris/bugdb/bug.html#!6455246 http://us-east.manta.joyent.com/jmc/public/opensolaris/bugdb/bug.html#!6647115 6874410 is your issue, and 6873782 covers fixing the documentation. Part of the problem is that even if this bug were fixed, software will basically have to assume the broken behavior for the indefinite future in order to keep working on systems that predate the fix. I think that's why people haven't bothered to fix it yet. That said, it's come up enough times and caused enough pain that we should probably at least document the behavior much more clearly for future users. Here's a lengthy discussion from several years ago about the issue: http://networking-discuss.opensolaris.narkive.com/AdTgQU1i/port-getn-and-timeouts-is-this-a-bug-or-an-undocumented-feature and here are links to code and issues in several implementations (a few of which I wrote): https://github.com/antirez/redis/blob/unstable/src/ae_evport.c#L280-L293 https://github.com/libuv/libuv/blob/v1.x/src/unix/sunos.c#L193-L210 https://bz.apache.org/bugzilla/show_bug.cgi?id=48029 https://bz.apache.org/bugzilla/show_bug.cgi?id=47645 http://cvs.schmorp.de/libev/ev_port.c?view=markup#l106 https://github.com/libevent/libevent/blob/master/evport.c#L306-L323 https://github.com/apache/apr/blob/1cf591615c4d5c7df5a582aa6e3389c88af2204a/poll/unix/port.c#L110-L137 https://github.com/joyent/haproxy-1.4/blob/joyent-dev-evports/src/ev_evports.c#L208-L219 It's come up a few other times here, too: http://developer.illumos.narkive.com/nOhCzCuQ/behavior-of-tail-f-wrt-truncation#post8 -- Dave ------------------------------------------- illumos-discuss Archives: https://www.listbox.com/member/archive/182180/=now RSS Feed: https://www.listbox.com/member/archive/rss/182180/21175430-2e6923be Modify Your Subscription: https://www.listbox.com/member/?member_id=21175430&id_secret=21175430-6a77cda4 Powered by Listbox: http://www.listbox.com
