[GHC] #15634: GHCi: Segmentation fault Data.List.sum large number

#15634: GHCi: Segmentation fault Data.List.sum large number -------------------------------------+------------------------------------- Reporter: ksallberg | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: Research needed Component: GHCi | Version: 8.0.1 Keywords: segfault | Operating System: Unknown/Multiple Architecture: | Type of failure: None/Unknown Unknown/Multiple | Test Case: | Blocked By: Blocking: | Related Tickets: Differential Rev(s): | Wiki Page: -------------------------------------+------------------------------------- Hello, first bug report here, so please let me know what I should provide. I tried to search for this but didn't find it. {{{ kristian@snabbadatorn:~$ ghci GHCi, version 8.0.1: http://www.haskell.org/ghc/ :? for help Prelude> [1..100] [1,2,3,4,5,6,7,8,9,10,11,12... and so on Prelude> sum [1..10000000] 50000005000000 Prelude> sum [1..100000000] Segmentation fault }}} -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/15634 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#15634: GHCi: Segmentation fault Data.List.sum large number -------------------------------------+------------------------------------- Reporter: ksallberg | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: Research | needed Component: GHCi | Version: 8.0.1 Resolution: | Keywords: segfault Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Description changed by ksallberg: Old description:
Hello, first bug report here, so please let me know what I should provide. I tried to search for this but didn't find it.
{{{ kristian@snabbadatorn:~$ ghci GHCi, version 8.0.1: http://www.haskell.org/ghc/ :? for help Prelude> [1..100] [1,2,3,4,5,6,7,8,9,10,11,12... and so on Prelude> sum [1..10000000] 50000005000000 Prelude> sum [1..100000000] Segmentation fault }}}
New description: Hello, first bug report here, so please let me know what I should provide. I tried to search for this but didn't find it. {{{ kristian@snabbadatorn:~$ ghci GHCi, version 8.0.1: http://www.haskell.org/ghc/ :? for help Prelude> [1..100] [1,2,3,4,5,6,7,8,9,10,11,12... and so on Prelude> sum [1..10000000] 50000005000000 Prelude> sum [1..100000000] Segmentation fault }}} Machine: Google compute engine, n1-highcpu-8 (8 vCPUs, 7.2 GB memory), uname -r: 4.9.0-8-amd64 {{{ kristian@snabbadatorn:~$ lsb_release -a No LSB modules are available. Distributor ID: Debian Description: Debian GNU/Linux 9.5 (stretch) Release: 9.5 Codename: stretch }}} -- -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/15634#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#15634: GHCi: Segmentation fault Data.List.sum large number -------------------------------------+------------------------------------- Reporter: ksallberg | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: Research | needed Component: GHCi | Version: 8.0.1 Resolution: | Keywords: segfault Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Description changed by ksallberg: Old description:
Hello, first bug report here, so please let me know what I should provide. I tried to search for this but didn't find it.
{{{ kristian@snabbadatorn:~$ ghci GHCi, version 8.0.1: http://www.haskell.org/ghc/ :? for help Prelude> [1..100] [1,2,3,4,5,6,7,8,9,10,11,12... and so on Prelude> sum [1..10000000] 50000005000000 Prelude> sum [1..100000000] Segmentation fault }}}
Machine: Google compute engine, n1-highcpu-8 (8 vCPUs, 7.2 GB memory),
uname -r: 4.9.0-8-amd64
{{{ kristian@snabbadatorn:~$ lsb_release -a No LSB modules are available. Distributor ID: Debian Description: Debian GNU/Linux 9.5 (stretch) Release: 9.5 Codename: stretch }}}
New description: Hello, first bug report here, so please let me know what I should provide. I tried to search for this but didn't find it. {{{ kristian@snabbadatorn:~$ ghci GHCi, version 8.0.1: http://www.haskell.org/ghc/ :? for help Prelude> [1..100] [1,2,3,4,5,6,7,8,9,10,11,12... and so on Prelude> sum [1..10000000] 50000005000000 Prelude> sum [1..100000000] Segmentation fault }}} Machine: Google compute engine, n1-highcpu-8 (8 vCPUs, 7.2 GB memory), uname -r: 4.9.0-8-amd64 {{{ kristian@snabbadatorn:~$ lsb_release -a No LSB modules are available. Distributor ID: Debian Description: Debian GNU/Linux 9.5 (stretch) Release: 9.5 Codename: stretch }}} {{{ kristian@snabbadatorn:~$ ghci --version The Glorious Glasgow Haskell Compilation System, version 8.0.1 }}} -- -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/15634#comment:2 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#15634: GHCi: Segmentation fault Data.List.sum large number -------------------------------------+------------------------------------- Reporter: ksallberg | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: Research | needed Component: GHCi | Version: 8.0.1 Resolution: | Keywords: segfault Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Description changed by ksallberg: Old description:
Hello, first bug report here, so please let me know what I should provide. I tried to search for this but didn't find it.
{{{ kristian@snabbadatorn:~$ ghci GHCi, version 8.0.1: http://www.haskell.org/ghc/ :? for help Prelude> [1..100] [1,2,3,4,5,6,7,8,9,10,11,12... and so on Prelude> sum [1..10000000] 50000005000000 Prelude> sum [1..100000000] Segmentation fault }}}
Machine: Google compute engine, n1-highcpu-8 (8 vCPUs, 7.2 GB memory),
uname -r: 4.9.0-8-amd64
{{{ kristian@snabbadatorn:~$ lsb_release -a No LSB modules are available. Distributor ID: Debian Description: Debian GNU/Linux 9.5 (stretch) Release: 9.5 Codename: stretch }}}
{{{ kristian@snabbadatorn:~$ ghci --version The Glorious Glasgow Haskell Compilation System, version 8.0.1 }}}
New description: Hello, first bug report here, so please let me know what I should provide. I tried to search for this but didn't find it. {{{ kristian@snabbadatorn:~$ ghci GHCi, version 8.0.1: http://www.haskell.org/ghc/ :? for help Prelude> [1..100] [1,2,3,4,5,6,7,8,9,10,11,12... and so on Prelude> sum [1..10000000] 50000005000000 Prelude> sum [1..100000000] Segmentation fault }}} Machine: Google compute engine, n1-highcpu-8 (8 vCPUs, 7.2 GB memory), uname -r: 4.9.0-8-amd64 {{{ kristian@snabbadatorn:~$ lsb_release -a No LSB modules are available. Distributor ID: Debian Description: Debian GNU/Linux 9.5 (stretch) Release: 9.5 Codename: stretch }}} {{{ kristian@snabbadatorn:~$ ghci --version The Glorious Glasgow Haskell Compilation System, version 8.0.1 }}} ----------------------- Similar problem in older GHC version, although GHCi at least does not exit: Amazon ec2, r4.8xlarge, 32 cores: {{{ GHCi, version 7.10.3: http://www.haskell.org/ghc/ :? for help Prelude> sum [1..100000000] *** Exception: stack overflow Prelude> }}} {{{ ubuntu@ip-172-31-21-176:~$ lsb_release -a No LSB modules are available. Distributor ID: Ubuntu Description: Ubuntu 16.04.5 LTS Release: 16.04 Codename: xenial }}} {{{ ubuntu@ip-172-31-21-176:~$ uname -r 4.4.0-1065-aws }}} -- -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/15634#comment:3 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#15634: GHCi: Segmentation fault Data.List.sum large number -------------------------------------+------------------------------------- Reporter: ksallberg | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: Research | needed Component: GHCi | Version: 8.0.1 Resolution: | Keywords: segfault Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by osa1): Stack overflow is expected. `Prelude.sum` is implemented using `foldl` which is leaky and will overflow the stack at some point. Try this: {{{ ~ $ ghci GHCi, version 8.4.3: http://www.haskell.org/ghc/ :? for help Loaded GHCi configuration from /home/omer/rcbackup/.ghci λ:1> foldl (+) 0 [1..100000000] *** Exception: stack overflow λ:2> import Data.List λ:3> foldl' (+) 0 [1..100000000] 5000000050000000 }}} The segfault is an actual bug. Would it be possible for you to try this with GHC HEAD or at least 8.4.3? I tried with both and also with 8.0.1, but couldn't reproduce the segfault. If you can build GHC HEAD, it'd also be helpful to get a backtrace by doing this: - vim `which ghc` - Replace the last line with this: `exec gdb --args "$executablename" -B"$topdir" ${1+"$@"}` - Run ghci using `ghc --interactive` - On segfault type `bt<enter>`, and paste the backtrace. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/15634#comment:4 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#15634: GHCi: Segmentation fault Data.List.sum large number -------------------------------------+------------------------------------- Reporter: ksallberg | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: Research | needed Component: GHCi | Version: 8.0.1 Resolution: | Keywords: segfault Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by ksallberg): Thank you for the directions. I will try building GHC HEAD as soon as I can, and get back here. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/15634#comment:5 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#15634: GHCi: Segmentation fault Data.List.sum large number -------------------------------------+------------------------------------- Reporter: ksallberg | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: Research | needed Component: GHCi | Version: 8.0.1 Resolution: | Keywords: segfault Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by bgamari): I suspect that this is a duplicate of #15060 which will be fixed in 8.6.1. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/15634#comment:6 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#15634: GHCi: Segmentation fault Data.List.sum large number -------------------------------------+------------------------------------- Reporter: ksallberg | Owner: (none) Type: bug | Status: infoneeded Priority: normal | Milestone: Research | needed Component: GHCi | Version: 8.0.1 Resolution: | Keywords: segfault Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by osa1): * status: new => infoneeded Comment: ksallberg, can you try with GHC 8.6 beta instead? If bgamari is right then the segfault should be fixed in 8.6 beta 1. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/15634#comment:7 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#15634: GHCi: Segmentation fault Data.List.sum large number -------------------------------------+------------------------------------- Reporter: ksallberg | Owner: (none) Type: bug | Status: infoneeded Priority: normal | Milestone: Research | needed Component: GHCi | Version: 8.0.1 Resolution: | Keywords: segfault Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by ksallberg): The following happened when I used GHCi from https://downloads.haskell.org/~ghc/8.6.1-beta1/ (specifically ghc-8.6.0.20180810-x86_64-deb8-linux.tar.xz) {{{ kristian@snabbadatorn:/$ ./usr/local/bin/ghci GHCi, version 8.6.0.20180810: http://www.haskell.org/ghc/ :? for help Prelude> sum [1..100000000] <interactive>: internal error: Unable to commit 1048576 bytes of memory (GHC version 8.6.0.20180810 for x86_64_unknown_linux) Please report this as a GHC bug: http://www.haskell.org/ghc/reportabug Aborted }}} -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/15634#comment:8 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#15634: GHCi: Segmentation fault Data.List.sum large number -------------------------------------+------------------------------------- Reporter: ksallberg | Owner: (none) Type: bug | Status: infoneeded Priority: normal | Milestone: Research | needed Component: GHCi | Version: 8.0.1 Resolution: | Keywords: segfault Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by osa1): * cc: bgamari (added) Comment: This is basically a `mmap()` failure (`mmap()` returning `MAP_FAILED`). Whether this is expected or not probably depends on your configuration (how much the process allowed to allocate etc.). Perhaps bgamari knows how to see whether this is expected or not. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/15634#comment:9 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#15634: GHCi: Segmentation fault Data.List.sum large number -------------------------------------+------------------------------------- Reporter: ksallberg | Owner: (none) Type: bug | Status: infoneeded Priority: normal | Milestone: Research | needed Component: GHCi | Version: 8.0.1 Resolution: | Keywords: segfault Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by bgamari): Indeed this is not expected; ideally we would throw a proper exception here (which we should presumably do when the test program is compiled). -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/15634#comment:10 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler
participants (1)
-
GHC