Retainer Profiling is broken
I had a large program which I was trying to profile, and I noticed that the program always ran into a segfault when running with
+RTS -hr. I was able to able to reliably get segfaults in both the
http-client-tls packages, as well as a third large and independent package with essentially no overlapping dependencies. This led me to believe that the bug is in the retainer profiler itself, and is not (much) dependent on the code being profiled. To that point, I was able to reproduce the bug with the
bytestring test suites.
I've modified bytestring (attached) enough to make it compile with GHC 8.6.3. To reproduce the segfault, run
$ stack build --profile $ stack exec prop-compiled -- +RTS -hr
I have confirmed the problem on Linux (Ubuntu 18.04), where prop-compiled quickly segfaults, and on Windows 10, where the program just hangs. [I observed the same behavior in all the other programs I tested: Linux segfaulted, and Windows just hung.]
Changes to bytestring:
- Renamed the package to bytestring2 to avoid circular packages.
- Removed a duplicate instance in tests/QuickCheckUtils.hs
- Changed all test-suites to executables in the cabal file so that they could be compiled with profiling.