Go to:
Gentoo Home
Documentation
Forums
Lists
Bugs
Planet
Store
Wiki
Get Gentoo!
Gentoo's Bugzilla – Attachment 187755 Details for
Bug 264435
sys-apps/portage-2.1.6.7: IOError: [Errno 11] Resource temporarily unavailable (while writing to stdout)
Home
|
New
–
[Ex]
|
Browse
|
Search
|
Privacy Policy
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
handle stdout EAGAIN errors due to subprocesses setting O_NONBLOCK
stdio_noblock.patch (text/plain), 1.58 KB, created by
Zac Medico
on 2009-04-09 06:20:18 UTC
(
hide
)
Description:
handle stdout EAGAIN errors due to subprocesses setting O_NONBLOCK
Filename:
MIME Type:
Creator:
Zac Medico
Created:
2009-04-09 06:20:18 UTC
Size:
1.58 KB
patch
obsolete
>Index: pym/_emerge/__init__.py >=================================================================== >--- pym/_emerge/__init__.py (revision 13305) >+++ pym/_emerge/__init__.py (revision 13306) >@@ -2426,8 +2426,41 @@ > > if buf: > if not self.background: >- buf.tofile(files.stdout) >- files.stdout.flush() >+ write_successful = False >+ failures = 0 >+ while True: >+ try: >+ if not write_successful: >+ buf.tofile(files.stdout) >+ write_successful = True >+ files.stdout.flush() >+ break >+ except IOError, e: >+ if e.errno != errno.EAGAIN: >+ raise >+ del e >+ failures += 1 >+ if failures > 50: >+ # Avoid a potentially infinite loop. In >+ # most cases, the failure count is zero >+ # and it's unlikely to exceed 1. >+ raise >+ >+ # This means that a subprocess has put an inherited >+ # stdio file descriptor (typically stdin) into >+ # O_NONBLOCK mode. This is not acceptable (see bug >+ # #264435), so revert it. We need to use a loop >+ # here since there's a race condition due to >+ # parallel processes being able to change the >+ # flags on the inherited file descriptor. >+ # TODO: When possible, avoid having child processes >+ # inherit stdio file descriptors from portage >+ # (maybe it can't be avoided with >+ # PROPERTIES=interactive). >+ fcntl.fcntl(files.stdout.fileno(), fcntl.F_SETFL, >+ fcntl.fcntl(files.stdout.fileno(), >+ fcntl.F_GETFL) ^ os.O_NONBLOCK) >+ > buf.tofile(files.log) > files.log.flush() > else:
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 264435
: 187755