Public bug reported:

Problem reports are deb822 style text files. The CoreDump is zstd or
gzip compressed and base64-encoded. This add an overhead of 1/3 to the
on-disk size. In most cases the CoreDump dominates the size of the crash
report, making the overhead noticeable.

Consider using binary format like cbor/msgpack to store/submit the
report. I wrote a simple POC to convert the report:

```
#!/usr/bin/python3

import argparse
import pathlib

import problem_report
import cbor2

DEFAULT_SUFFIX = ".cbor"


def write_output(report: dict[str, str | bytes], output: pathlib.Path) -> None:
    with output.open("wb") as f:
        cbor2.dump(report, f)


def load_report(input: pathlib.Path, decompress: bool) -> dict[str, str | 
bytes]:
    report = problem_report.ProblemReport()
    with input.open("rb") as f:
        report.load(f, binary=True if decompress else "compressed")
    return report.as_dict()


def main() -> None:
    parser = argparse.ArgumentParser()
    parser.add_argument("-d", "--decompress", action="store_true")
    parser.add_argument("-s", "--suffix", default=DEFAULT_SUFFIX)
    parser.add_argument("input", type=pathlib.Path)
    args = parser.parse_args()

    report = load_report(args.input, args.decompress)
    output = pathlib.Path(f"{args.input}{args.suffix}")
    print(f"Using output file: {output}")
    write_output(report, output)


if __name__ == "__main__":
    main()
```

Example size reduction:

371M _usr_bin_gitg.1000.crash
279M _usr_bin_gitg.1000.crash.cbor
11M _usr_libexec_localsearch-3.1000.crash
7.9M _usr_libexec_localsearch-3.1000.crash.cbor

** Affects: apport (Ubuntu)
     Importance: Wishlist
         Status: New

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

Title:
  Consider using a binary format like cbor/msgpack for crash reports

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


-- 
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to