Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 525552 - os.waitpid() may fail with EINTR, maybe others too
Summary: os.waitpid() may fail with EINTR, maybe others too
Status: RESOLVED FIXED
Alias: None
Product: Portage Development
Classification: Unclassified
Component: Core (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Portage team
URL:
Whiteboard:
Keywords: InVCS
: 500436 504568 (view as bug list)
Depends on:
Blocks: 484436
  Show dependency tree
 
Reported: 2014-10-16 10:05 UTC by Michael Haubenwallner
Modified: 2015-04-22 01:46 UTC (History)
2 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
retry os calls upon EINTR (portage-eintr.patch,652 bytes, patch)
2014-10-16 10:05 UTC, Michael Haubenwallner
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Michael Haubenwallner gentoo-dev 2014-10-16 10:05:46 UTC
Created attachment 386760 [details, diff]
retry os calls upon EINTR

This backtrace in a Prefix buildbot slave on some sparc-solaris2.10 machine leads me to attached patch:

  File "/.../lib/portage/pym/portage/util/_async/ForkProcess.py", line 45, in _spawn
    rval = self._run()
  File "/.../lib/portage/pym/_emerge/EbuildFetcher.py", line 172, in _run
    allow_missing_digests=allow_missing):
  File "/.../lib/portage/pym/portage/package/ebuild/fetch.py", line 515, in fetch
    if _userpriv_test_write_file(mysettings, write_test_file):
  File "/.../lib/portage/pym/portage/package/ebuild/fetch.py", line 130, in _userpriv_test_write_file
    returncode = _spawn_fetch(settings, args)
  File "/.../lib/portage/pym/portage/package/ebuild/fetch.py", line 98, in _spawn_fetch
    rval = spawn_func(args, env=settings.environ(), **kwargs)
  File "/.../lib/portage/pym/portage/process.py", line 378, in spawn
    retval = os.waitpid(pid, 0)[1]
  File "/.../lib/portage/pym/portage/__init__.py", line 260, in __call__
    rval = self._func(*wrapped_args, **wrapped_kwargs)
OSError: [Errno 4] Interrupted system call

What do you think?
Comment 1 Zac Medico gentoo-dev 2014-10-16 10:38:28 UTC
Note that modules wrapped by _unicode_module_wrapper include os, shutil, and selinux. It doesn't necessarily make sense to loop (as your patch does) for all of the functions in all of those modules. I'm not sure whether or not that loop will have any negative consequences for some of the wrapped functions. You might consider limiting this behavior to specific modules, or to specific functions in those modules.
Comment 2 Zac Medico gentoo-dev 2014-10-16 19:31:15 UTC
(In reply to Zac Medico from comment #1)
> You might consider limiting this behavior to specific modules, or
> to specific functions in those modules.

For example, see the _os_overrides variable, which is used to specify which os functions should not be wrapped by _unicode_func_wrapper. You could put your EINTR/loop behavior in a separate wrapper class, and use that wrapper to wrap the specific functions that would benefit from it (such as os.waitpid).
Comment 3 Zac Medico gentoo-dev 2014-12-03 08:58:34 UTC
(In reply to Zac Medico from comment #2)
> For example, see the _os_overrides variable, which is used to specify which
> os functions should not be wrapped by _unicode_func_wrapper. You could put
> your EINTR/loop behavior in a separate wrapper class, and use that wrapper
> to wrap the specific functions that would benefit from it (such as
> os.waitpid).

I have a patch in this branch:

	https://github.com/zmedico/portage/tree/bug_525552

I've posted it for review here:

	http://thread.gmane.org/gmane.linux.gentoo.portage.devel/4896
Comment 4 Michael Haubenwallner gentoo-dev 2014-12-03 10:49:33 UTC
LGTM, thanks!
Comment 5 Zac Medico gentoo-dev 2014-12-03 18:31:37 UTC
This is in the master branch now:

https://github.com/gentoo/portage/commit/7c70eea2f607baffcbb9d465c03578d69b09decf(

In reply to Michael Haubenwallner from comment #4)
> LGTM, thanks!

You're welcome!
Comment 6 Zac Medico gentoo-dev 2015-02-26 16:56:12 UTC
*** Bug 500436 has been marked as a duplicate of this bug. ***
Comment 7 Zac Medico gentoo-dev 2015-04-22 01:31:03 UTC
*** Bug 504568 has been marked as a duplicate of this bug. ***
Comment 8 Zac Medico gentoo-dev 2015-04-22 01:45:51 UTC
This is fixed in since 2.2.15.