No description
Find a file
David Rheinsberg 2bdb287731 sources: make cleanup explicit
This changes the sources module to explicitly cleanup event-loops.
Additionally, the implementation is protected against re-entrency which
we do not support (and do not need).

We did occasionally get the following exception when running
source-servers:

        /usr/lib/python3.8/asyncio/base_events.py:654: ResourceWarning: unclosed event loop <_UnixSelectorEventLoop running=False closed=False debug=False>
          _warn(f"unclosed event loop {self!r}", ResourceWarning, source=self)
        ResourceWarning: Enable tracemalloc to get the object allocation traceback

        Exception ignored in: <function BaseEventLoop.__del__ at 0x7f92589d14c0>
        Traceback (most recent call last):
          File "/usr/lib/python3.8/asyncio/base_events.py", line 656, in __del__
            self.close()
          File "/usr/lib/python3.8/asyncio/unix_events.py", line 58, in close
            super().close()
          File "/usr/lib/python3.8/asyncio/selector_events.py", line 92, in close
            self._close_self_pipe()
          File "/usr/lib/python3.8/asyncio/selector_events.py", line 99, in _close_self_pipe
            self._remove_reader(self._ssock.fileno())
          File "/usr/lib/python3.8/asyncio/selector_events.py", line 274, in _remove_reader
            key = self._selector.get_key(fd)
          File "/usr/lib/python3.8/selectors.py", line 190, in get_key
            return mapping[fileobj]
          File "/usr/lib/python3.8/selectors.py", line 71, in __getitem__
            fd = self._selector._fileobj_lookup(fileobj)
          File "/usr/lib/python3.8/selectors.py", line 225, in _fileobj_lookup
            return _fileobj_to_fd(fileobj)
          File "/usr/lib/python3.8/selectors.py", line 42, in _fileobj_to_fd
            raise ValueError("Invalid file descriptor: {}".format(fd))
        ValueError: Invalid file descriptor: -1

This is triggered when an event-loop is not closed explicitly via
`event_loop.close()`. It then tries to cleanup explicitly. The problem
here is that python has no knowledge of in which order it should
collect GC'ed objects. This might end up more or less random. Therefore,
file-descriptors might be closed in arbitrary order, leading to the
event-loop being unable to unregister its internal objects.

I am not entirely sure whether this is the case here. However, the error
definitely triggers on the internal event-loop socketpair, which there
is no other external access to. Furthermore, this socketpair is only set
to -1 in its own __del__ function. So unless we have a memory
corruption, I see nothing else that could trigger this.

With this fix in place, I can run `test_sources.py` in a loop without
triggering the bug.

It is quite likely that our other `*Server` classes need the same fix. I
did not verify, yet.
2020-04-24 11:48:16 +02:00
.github/workflows ci: pylint all the things 2020-04-20 18:58:26 +02:00
assemblers osbuild: convert to jsoncomm 2020-04-21 13:47:38 +02:00
docs osbuild: add --output-directory=DIR 2020-04-15 15:40:17 +02:00
jenkins 🥊 Resilient testing + log gathering 2020-04-22 17:42:40 +00:00
osbuild sources: make cleanup explicit 2020-04-24 11:48:16 +02:00
runners osbuild: convert to jsoncomm 2020-04-21 13:47:38 +02:00
samples samples: fix grub2-legacy in base-qcow2 2020-04-20 18:58:53 +02:00
schemas schema: add json-schema describing our manifest 2020-03-07 13:43:24 +01:00
sources osbuild: unify libdir handling 2020-04-21 13:44:43 +02:00
stages osbuild: cleanup contextlib usage 2020-04-21 16:02:20 +02:00
test util/linux: add explicit FS_IMMUTABLE_FL helpers 2020-04-21 14:46:02 +02:00
.editorconfig editorconfig: add one matching current style 2019-12-13 18:15:08 +01:00
.gitignore .gitignore: remove old ignored directory 2020-03-06 11:57:17 +01:00
.pylintrc pylint: disable too-many-arguments rule 2019-07-24 12:55:48 +02:00
.travis.yml ci: import runtime tests to github actions 2020-03-24 16:08:24 +01:00
LICENSE Revert "Fill in the license template" 2019-11-18 12:23:10 +01:00
Makefile build: fix makefile comments 2020-04-15 18:21:03 +02:00
NEWS.md NEWS: add v12 entry 2020-04-15 18:21:03 +02:00
osbuild.spec osbuild: unify libdir handling 2020-04-21 13:44:43 +02:00
README.md docs: refactor README 2020-03-02 21:34:09 +01:00
setup.py util: mark as module 2020-04-21 17:00:04 +02:00
tree-diff tools/tree-diff: strip NULL character from selinux xattr 2019-10-08 21:39:35 +02:00

OSBuild

Build-Pipelines for Operating System Artifacts

OSBuild is a pipeline-based build system for operating system artifacts. It defines a universal pipeline description and a build system to execute them, producing artifacts like operating system images, working towards an image build pipeline that is more comprehensible, reproducible, and extendable.

See the osbuild(1) man-page for details on how to run osbuild, the definition of the pipeline description, and more.

Project

Requirements

The requirements for this project are:

  • python >= 3.7
  • systemd-nspawn >= 244

Additionally, the built-in stages require:

  • bash >= 5.0
  • coreutils >= 8.31
  • curl >= 7.68
  • qemu-img >= 4.2.0
  • rpm >= 4.15
  • tar >= 1.32
  • util-linux >= 235

At build-time, the following software is required:

  • python-docutils >= 0.13
  • pkg-config >= 0.29

Build

The standard python package system is used. Consult upstream documentation for detailed help. In most situations the following commands are sufficient to build and install from source:

python setup.py build
python setup.py install --skip-build --root=/

The man-pages require python-docutils and can be built via:

rst2man docs/<input-file>.rst <output-file>

Repository:

License:

  • Apache-2.0
  • See LICENSE file for details.