Gentoo Archives: gentoo-portage-dev

From: Perry Smith <pedzsan@×××××.com>
To: gentoo-portage-dev@l.g.o
Subject: Re: [gentoo-portage-dev] EbuildProcess logs poll-error to already removed $T (on AIX)
Date: Tue, 29 Mar 2011 02:03:46
Message-Id: D1DB6BAF-B9BD-4AB2-A9E9-5C4A3917607C@gmail.com
In Reply to: Re: [gentoo-portage-dev] EbuildProcess logs poll-error to already removed $T (on AIX) by Zac Medico
1 On Mar 28, 2011, at 10:56 AM, Zac Medico wrote:
2
3 > On 03/28/2011 03:05 AM, Michael Haubenwallner wrote:
4 >>
5 >>
6 >> On 03/25/2011 05:23 PM, Zac Medico wrote:
7 >>>> * EbuildProcess received strange poll event: 16384
8 >>
9 >>> You can compare 16384 to the values of POLLERR and POLLNVAL in order to
10 >>> see what type of event it is. Apparently the values on AIX are different
11 >>> from those on Linux, because here's what I see on Linux:
12 >>
13 >> On AIX 5.3 this is:
14 >>
15 >> Python 2.7.1 (r271:86832, Feb 28 2011, 17:51:02)
16 >> [GCC 4.2.4 (Gentoo 4.2.4-r01.2 p1.1)] on aix5
17 >> Type "help", "copyright", "credits" or "license" for more information.
18 >>>>> import select
19 >>>>> dir(select)
20 >> ['PIPE_BUF', 'POLLERR', 'POLLHUP', 'POLLIN', 'POLLMSG', 'POLLNVAL', 'POLLOUT',
21 >> 'POLLPRI', 'POLLRDBAND', 'POLLRDNORM', 'POLLWRBAND', 'POLLWRNORM', '__doc__',
22 >> '__file__', '__name__', '__package__', 'error', 'poll', 'select']
23 >>>>> select.POLLNVAL
24 >> 32768
25 >>>>> select.POLLERR
26 >> 16384
27 >
28 > So, apparently POLLERR is the "strange poll event" that's being received.
29 >
30 >> On AIX 6.1 it looks similar except for missing 'PIPE_BUF'.
31 >>
32 >>> This will handle the IOError:
33 >>> http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=0a64f784003c11e151405b7f708d77770de0ed57
34 >>
35 >> Yes, that makes it work, thank you!
36 >>
37 >>> It might be risky to skip logging of the POLLNVAL / POLLERR events, so
38 >>> hopefully we can determine their cause and handle them somehow. Do they
39 >>> seem to cause any problems? It might be something specific about pty
40 >>> devices on AIX.
41 >>
42 >> There doesn't seem to go anything wrong so far.
43 >
44 > Maybe on AIX, POLLERR is essentially equivalent to POLLHUP in this case.
45 > If that's true, then we could conditionally modify portage's
46 > PollConstants class for AIX like this:
47 >
48 > diff --git a/pym/_emerge/PollConstants.py b/pym/_emerge/PollConstants.py
49 > index d0270a9..73a3908 100644
50 > --- a/pym/_emerge/PollConstants.py
51 > +++ b/pym/_emerge/PollConstants.py
52 > @@ -1,6 +1,7 @@
53 > # Copyright 1999-2009 Gentoo Foundation
54 > # Distributed under the terms of the GNU General Public License v2
55 >
56 > +import platform
57 > import select
58 > class PollConstants(object):
59 >
60 > @@ -16,3 +17,8 @@ class PollConstants(object):
61 > v *= 2
62 > del k, v
63 >
64 > +if platform.system() in ('AIX',):
65 > + # Interpret POLLERR like POLLHUP.
66 > + PollConstants.POLLHUP = \
67 > + PollConstants.POLLHUP | PollConstants.POLLERR
68 > + PollConstants.POLLERR = 0
69 >
70 > Does platform.system() return "AIX" exactly as I spelled it?
71 >
72 >> I've no idea about programming with pty devices at all.
73 >> However, one relevant (IMHO) thing I can see is:
74 >> portage/util/_pty.py:_can_test_pty_eof() returns True for Linux only.
75 >>
76 >> Anything I can try out?
77 >
78 > You can check whether or not pty support is enabled in portage like this:
79 >
80 > python -c 'import portage.util._pty, sys;
81 > sys.stdout.write(str(portage.util._pty._disable_openpty))'
82
83 I did not 100% follow this. In particular, I didn't see how we started talking about pty's. But, since you are, I'll wade in.
84
85 When the master side (the side that a daemon opens like telnetd) closes, the slave side gets the same treatment as if a modem hung up on a real tty. This is a SIGHUP *and* any further writes will return EIO (5) and further reads return 0. (All this is assuming CLOCAL is off.)
86
87 I would not be surprised if the child process is receiving a SIGHUP if all the process session and controlling tty requirements have been met and the file descriptor is also selectable for POLLHUP and POLLERR. I would peek inside the Python code because perhaps it is testing for POLLERR before it is testing for POLLHUP. Or, perhaps it is not expecting the POLLERR at all (that is the 16384 value)
88
89 This should *not* be AIX specific but is actually POSIX standard.
90
91 Does that help?
92
93 pedz

Replies