[GHC] #11627: Segmentation fault for space_leak_001 with profiling (-hc)
#11627: Segmentation fault for space_leak_001 with profiling (-hc) -------------------------------------+------------------------------------- Reporter: thomie | Owner: Type: bug | Status: new Priority: high | Milestone: Component: Profiling | Version: 7.10.3 Keywords: | Operating System: Unknown/Multiple Architecture: | Type of failure: None/Unknown Unknown/Multiple | Test Case: | Blocked By: perf/space_leaks/space_leak_001 | Blocking: | Related Tickets: Differential Rev(s): | Wiki Page: -------------------------------------+------------------------------------- `WAY=profasm` is omitted by default for this test, but the code looks like this: Test.hs: {{{ import Data.List main = print $ length $ show (foldl' (*) 1 [1..100000] :: Integer) }}} {{{ $ ghc Test.hs -prof -O $ ./Test +RTS -hc Segmentation fault (core dumped) }}} Reproducible with at least 7.10.3 and HEAD, also without `-O`. -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/11627> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#11627: Segmentation fault for space_leak_001 with profiling (-hc) -------------------------------------+------------------------------------- Reporter: thomie | Owner: jme Type: bug | Status: new Priority: high | Milestone: Component: Profiling | Version: 7.10.3 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: | perf/space_leaks/space_leak_001 Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by jme): * owner: => jme Comment: The segfault occurs because `shrinkMutableByteArray#` and `resizeMutableByteArray#` introduce slop at the ends of the `large_object` `MutableByteArray#`s holding the `Integer`s. Since the arrays are large, they are not copied during GC, so this slop is still present when the heap census is run (after GC). But when `heapCensusChain` encounters a shrunken `MutableByteArray#`, it thinks the slop following the array is another closure, and chaos quickly ensues. The fix should be straightforward. -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/11627#comment:1> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#11627: Segmentation fault for space_leak_001 with profiling (-hc) -------------------------------------+------------------------------------- Reporter: thomie | Owner: jme Type: bug | Status: new Priority: high | Milestone: Component: Profiling | Version: 7.10.3 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: | perf/space_leaks/space_leak_001 Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by thomie): Nice find. I do wonder why arrays need to ever be shrunk for this example. The `Integer` only increases in size. -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/11627#comment:2> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#11627: Segmentation fault for space_leak_001 with profiling (-hc) -------------------------------------+------------------------------------- Reporter: thomie | Owner: jme Type: bug | Status: new Priority: high | Milestone: Component: Profiling | Version: 7.10.3 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: | perf/space_leaks/space_leak_001 Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by jme): Thanks. Although I didn't verify it, I believe the culprit is the `show`, which repeatedly calls `quotRemInteger` to divide the result into smaller chunks. -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/11627#comment:3> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#11627: Segmentation fault for space_leak_001 with profiling (-hc) -------------------------------------+------------------------------------- Reporter: thomie | Owner: jme Type: bug | Status: new Priority: high | Milestone: Component: Profiling | Version: 7.10.3 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: | perf/space_leaks/space_leak_001 Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by jme): Actually, in `show`, it also possible for the `p*p` in `jsplitf` to trigger a segfault. If `p` is ''w'' words long, 2''w'' words are initially allocated for the result of the multiply. But if the most significant word turns out to be 0, the result is shrunk by a word. -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/11627#comment:4> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#11627: Segmentation fault for space_leak_001 with profiling (-hc) -------------------------------------+------------------------------------- Reporter: thomie | Owner: jme Type: bug | Status: patch Priority: high | Milestone: Component: Profiling | Version: 7.10.3 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: | perf/space_leaks/space_leak_001 Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Phab:D2005 Wiki Page: | -------------------------------------+------------------------------------- Changes (by jme): * status: new => patch * differential: => Phab:D2005 -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/11627#comment:5> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#11627: Segmentation fault for space_leak_001 with profiling (-hc) -------------------------------------+------------------------------------- Reporter: thomie | Owner: jme Type: bug | Status: patch Priority: high | Milestone: Component: Profiling | Version: 7.10.3 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: | perf/space_leaks/space_leak_001 Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Phab:D2005 Wiki Page: | -------------------------------------+------------------------------------- Comment (by Ben Gamari <ben@…>): In [changeset:"ba95f22eb98cc2ee2d8d76e56df80769c379413d/ghc" ba95f22e/ghc]: {{{ #!CommitTicketReference repository="ghc" revision="ba95f22eb98cc2ee2d8d76e56df80769c379413d" prof: Fix heap census for large ARR_WORDS (#11627) The heap census now handles large ARR_WORDS objects which have been shrunk by shrinkMutableByteArray# or resizeMutableByteArray#. Test Plan: ./validate && make test WAY=profasm Reviewers: hvr, bgamari, austin, thomie Reviewed By: thomie Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2005 GHC Trac Issues: #11627 }}} -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/11627#comment:6> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#11627: Segmentation fault for space_leak_001 with profiling (-hc) -------------------------------------+------------------------------------- Reporter: thomie | Owner: jme Type: bug | Status: merge Priority: high | Milestone: Component: Profiling | Version: 7.10.3 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: | perf/space_leaks/space_leak_001 Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Phab:D2005 Wiki Page: | -------------------------------------+------------------------------------- Changes (by bgamari): * status: patch => merge -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/11627#comment:7> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#11627: Segmentation fault for space_leak_001 with profiling (-hc) -------------------------------------+------------------------------------- Reporter: thomie | Owner: jme Type: bug | Status: closed Priority: high | Milestone: 8.0.1 Component: Profiling | Version: 7.10.3 Resolution: fixed | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: Runtime crash | Test Case: | perf/space_leaks/space_leak_001 Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Phab:D2005 Wiki Page: | -------------------------------------+------------------------------------- Changes (by bgamari): * status: merge => closed * failure: None/Unknown => Runtime crash * resolution: => fixed * milestone: => 8.0.1 @@ -5,1 +5,1 @@ - {{{ + {{{#!hs New description: `WAY=profasm` is omitted by default for this test, but the code looks like this: Test.hs: {{{#!hs import Data.List main = print $ length $ show (foldl' (*) 1 [1..100000] :: Integer) }}} {{{ $ ghc Test.hs -prof -O $ ./Test +RTS -hc Segmentation fault (core dumped) }}} Reproducible with at least 7.10.3 and HEAD, also without `-O`. -- Comment: Merged as d1fbcbb6710db0e06deac66a77f90d74001acd16. -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/11627#comment:8> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#11627: Segmentation fault for space_leak_001 with profiling (-hc) -------------------------------------+------------------------------------- Reporter: thomie | Owner: jme Type: bug | Status: closed Priority: high | Milestone: 8.0.1 Component: Profiling | Version: 7.10.3 Resolution: fixed | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: Runtime crash | Test Case: | perf/space_leaks/space_leak_001 Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Phab:D2005 Wiki Page: | -------------------------------------+------------------------------------- Comment (by Ben Gamari <ben@…>): In [changeset:"f0179e3adf6677243f587a05307a4a42833aa8d1/ghc" f0179e3/ghc]: {{{ #!CommitTicketReference repository="ghc" revision="f0179e3adf6677243f587a05307a4a42833aa8d1" testsuite: Skip T11627a and T11627b on Darwin Darwin tends to give us a very small stack which the retainer profiler tends to overflow. Strangely, this manifested on CircleCI yet not Harbormaster. See #15287 and #11627. }}} -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/11627#comment:9> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#11627: Segmentation fault for space_leak_001 with profiling (-hc) -------------------------------------+------------------------------------- Reporter: thomie | Owner: jme Type: bug | Status: closed Priority: high | Milestone: 8.0.1 Component: Profiling | Version: 7.10.3 Resolution: fixed | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: Runtime crash | Test Case: | perf/space_leaks/space_leak_001 Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Phab:D2005 Wiki Page: | -------------------------------------+------------------------------------- Comment (by Ben Gamari <ben@…>): In [changeset:"6d9d6f9ab545eb11b4a1b72ea903a0f804109f16/ghc" 6d9d6f9a/ghc]: {{{ #!CommitTicketReference repository="ghc" revision="6d9d6f9ab545eb11b4a1b72ea903a0f804109f16" testsuite: Enable T11627a on Darwin The retainer profiler no longer uses the C stack for its mark stack (#14758). Consequently even the small C stack provided on Darwin should be sufficient to run this test. See #11627 }}} -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/11627#comment:10> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#11627: Segmentation fault for space_leak_001 with profiling (-hc) -------------------------------------+------------------------------------- Reporter: thomie | Owner: jme Type: bug | Status: closed Priority: high | Milestone: 8.0.1 Component: Profiling | Version: 7.10.3 Resolution: fixed | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: Runtime crash | Test Case: | perf/space_leaks/space_leak_001 Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Phab:D2005 Wiki Page: | -------------------------------------+------------------------------------- Comment (by Ben Gamari <ben@…>): In [changeset:"993782073c0b380908e9541c40c6c5849dbacfec/ghc" 9937820/ghc]: {{{ #!CommitTicketReference repository="ghc" revision="993782073c0b380908e9541c40c6c5849dbacfec" testsuite: Fix a variety of issues when building with integer-simple * Mark arith011 as broken with integer-simple As noted in #16091, arith011 fails when run against integer-simple with a "divide by zero" exception. This suggests that integer-gmp and integer- simple are handling division by zero differently. * This also fixes broken_without_gmp; the lack of types made the previous failure silent, sadly. Improves situation of #16043. * Mark several tests implicitly depending upon integer-gmp as broken with integer-simple. These expect to see Core coming from integer-gmp, which breaks with integer-simple. * Increase runtime timeout multiplier of T11627a with integer-simple I previously saw that T11627a timed out in all profiling ways when run against integer-simple. I suspect this is due to integer-simple's rather verbose heap representation. Let's see whether increasing the runtime timeout helps. Fixes test for #11627. This is all in service of fixing #16043. }}} -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/11627#comment:11> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
participants (1)
-
GHC