[GHC] #7695: Hang when locale-archive and gconv-modules are not there

#7695: Hang when locale-archive and gconv-modules are not there -------------------------+-------------------------------------------------- Reporter: hpd | Owner: Type: bug | Status: new Priority: normal | Component: None Version: 7.6.2 | Keywords: Os: Linux | Architecture: Unknown/Multiple Failure: None/Unknown | Blockedby: Blocking: | Related: -------------------------+-------------------------------------------------- Running a (statically) compiled program in an environment where /usr/lib/locale or /usr/lib/gconv (or ../lib64/..) are not there, causes it to hog the CPU and rapidly allocate memory (this happens for example in an empty chroot). Steps to reproduce: {{{ echo "main = return ()" > test.hs ghc -static -optl-static -optl-pthread -o test test.hs chroot `pwd` /test }}} Strace output: {{{ $ /strace -e trace=file -e signal= /test execve("/test", ["/test"], [/* 17 vars */]) = 0 open("/usr/lib64/locale/locale-archive", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory) open("/usr/share/locale/locale.alias", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory) open("/usr/lib64/locale/de_DE.UTF-8/LC_CTYPE", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory) open("/usr/lib64/locale/de_DE.utf8/LC_CTYPE", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory) open("/usr/lib64/locale/de_DE/LC_CTYPE", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory) open("/usr/lib64/locale/de.UTF-8/LC_CTYPE", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory) open("/usr/lib64/locale/de.utf8/LC_CTYPE", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory) open("/usr/lib64/locale/de/LC_CTYPE", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory) open("/usr/lib64/gconv/gconv-modules.cache", O_RDONLY) = -1 ENOENT (No such file or directory) open("/usr/lib64/gconv/gconv-modules", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory) }}} Strace output (with LC_ALL=C): {{{ $ LC_ALL=C strace -e trace=file -e signal= /test execve("/test", ["/test"], [/* 18 vars */]) = 0 open("/usr/lib64/gconv/gconv-modules.cache", O_RDONLY) = -1 ENOENT (No such file or directory) open("/usr/lib64/gconv/gconv-modules", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory) }}} In both cases, there are no further system calls (apart from timer ticks and mmap). I was also able to reproduce this behavior without a chroot, by replacing the paths from strace's output with something nonexistent in the binary (manually, with a hex-editor). I didn't try dynamically linked binaries, yet. One problem ''may'' be, that iconv_open constantly returns -1 if it doesn't find the files listed above. -- Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/7695 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#7695: Hang when locale-archive and gconv-modules are not there ---------------------------------+------------------------------------------ Reporter: hpd | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: None | Version: 7.6.2 Keywords: | Os: Linux Architecture: Unknown/Multiple | Failure: None/Unknown Difficulty: Unknown | Testcase: Blockedby: | Blocking: Related: | ---------------------------------+------------------------------------------ Changes (by igloo): * difficulty: => Unknown Comment: It looks like you're right; `iconv_open` returns -1, so we throw an exception, but printing the exception means we try opening iconv again, and loop forever. -- Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/7695#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#7695: Hang when locale-archive and gconv-modules are not there ---------------------------------+------------------------------------------ Reporter: hpd | Owner: Type: bug | Status: new Priority: normal | Milestone: 7.8.1 Component: None | Version: 7.6.2 Keywords: | Os: Linux Architecture: Unknown/Multiple | Failure: None/Unknown Difficulty: Unknown | Testcase: Blockedby: | Blocking: Related: | ---------------------------------+------------------------------------------ Changes (by igloo): * milestone: => 7.8.1 -- Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/7695#comment:2 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler
participants (1)
-
GHC