[GHC] #7695: Hang when locale-archive and gconv-modules are not there
GHC
cvs-ghc at haskell.org
Fri Feb 15 18:28:25 CET 2013
#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
More information about the ghc-tickets
mailing list