[Bug 2073787] Re: apport-retrace needs more than 1.5 GB memory (when using sandbox)

Benjamin Drung 2073787 at bugs.launchpad.net
Wed Apr 22 20:20:07 UTC 2026


The situation got worse: test_retrace_jammy_sandbox failed in a VM that
had 4 GiB of memory. I added following line to apport-retrace:

```
import resource
# limit to 1.5 GiB
resource.setrlimit(resource.RLIMIT_AS, (int(1.5*1024**3), int(1.5*1024**3)))
```

Then re-ran the test:

```
python3 -m pytest -ra -v tests/system/test_apport_retrace.py::test_retrace_jammy_sandbox
Traceback (most recent call last):
  File "/tmp/autopkgtest.m6bGTp/build.dPC/src/bin/apport-retrace", line 717, in <module>
    sys.exit(main(sys.argv[1:]))
             ~~~~^^^^^^^^^^^^^^
  File "/tmp/autopkgtest.m6bGTp/build.dPC/src/bin/apport-retrace", line 542, in main
    sandbox, cache, outdated_msg = apport.sandboxutils.make_sandbox(
                                   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
        report,
        ^^^^^^^
    ...<6 lines>...
        options.dynamic_origins,
        ^^^^^^^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/tmp/autopkgtest.m6bGTp/build.dPC/src/apport/sandboxutils.py", line 274, in make_sandbox
    pkgs = needed_runtime_packages(report, pkgmap_cache_dir, pkg_versions, verbose)
  File "/tmp/autopkgtest.m6bGTp/build.dPC/src/apport/sandboxutils.py", line 103, in needed_runtime_packages
    pkg = packaging.get_file_package(
        line,
    ...<3 lines>...
        arch=report.get("Architecture"),
    )
  File "/tmp/autopkgtest.m6bGTp/build.dPC/src/apport/packaging_impl/apt_dpkg.py", line 800, in get_file_package
    return self._search_contents(file, map_cachedir, release, arch)
           ~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/tmp/autopkgtest.m6bGTp/build.dPC/src/apport/packaging_impl/apt_dpkg.py", line 1752, in _search_contents
    contents_mapping = self._get_file2pkg_mapping(map_cachedir, release, arch)
  File "/tmp/autopkgtest.m6bGTp/build.dPC/src/apport/packaging_impl/apt_dpkg.py", line 1733, in _get_file2pkg_mapping
    self._update_given_file2pkg_mapping(file2pkg, contents_filename, dist)
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/tmp/autopkgtest.m6bGTp/build.dPC/src/apport/packaging_impl/apt_dpkg.py", line 1701, in _update_given_file2pkg_mapping
    for line in contents:
                ^^^^^^^^
  File "/usr/lib/python3.14/gzip.py", line 463, in readline
    return self._buffer.readline(size)
           ~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/usr/lib/python3.14/compression/_common/_streams.py", line 68, in readinto
    data = self.read(len(byte_view))
  File "/usr/lib/python3.14/gzip.py", line 578, in read
    uncompress = self._decompressor.decompress(buf, size)
MemoryError: Insufficient memory for buffer allocation
```

-- 
You received this bug notification because you are a member of Ubuntu
Foundations Bugs, which is subscribed to apport in Ubuntu.
https://bugs.launchpad.net/bugs/2073787

Title:
  apport-retrace needs more than 1.5 GB memory (when using sandbox)

Status in Apport:
  Triaged
Status in apport package in Ubuntu:
  Triaged

Bug description:
  The system tests test_retrace_system_sandbox and
  test_retrace_jammy_sandbox fail on arm64, ppc64el, s390x, because
  apport-retrace is killed by the OOM killer. Example:

  autopkgtest kernel: Out of memory: Killed process 3597 (apport-
  retrace) total-vm:1512420kB, anon-rss:1241460kB, file-rss:2592kB,
  shmem-rss:0kB, UID:0 pgtables:2554kB oom_score_adj:0

  Log: https://autopkgtest.ubuntu.com/results/autopkgtest-oracular-
  bdrung-apport/oracular/s390x/a/apport/20240722_145904_d3c2f@/log.gz

  apport-retrace should be able to retrace crashes without needing
  multiple gigabytes of memory.

To manage notifications about this bug go to:
https://bugs.launchpad.net/apport/+bug/2073787/+subscriptions





More information about the foundations-bugs mailing list