Ticket #2038 (closed bug: fixed)
System.Posix.Resource.setResourceLimit gives "setResourceLimit: invalid argument (Invalid argument)"
| Reported by: | slyfox | Owned by: | igloo |
|---|---|---|---|
| Priority: | high | Milestone: | 6.8.3 |
| Component: | libraries/unix | Version: | 6.8.2 |
| Keywords: | regression, ffi, unix | Cc: | hackage.haskell.org@… |
| Operating System: | Linux | Architecture: | x86 |
| Type of failure: | Difficulty: | Unknown | |
| Test Case: | resourceLimit | Blocked By: | |
| Blocking: | Related Tickets: |
Description
GHC-6.6.1 worked correctly in setResourceLimit, GHC-6.8.2 gives me an error:
$ ./m m: setResourceLimit: invalid argument (Invalid argument)
A little exploration (strange rlim_max value). Seems to be a bug in haskell -> C type conversion.
$ strace -etrace=setrlimit ./m
setrlimit(RLIMIT_CPU, {rlim_cur=3, rlim_max=0}) = -1 EINVAL (Invalid argument)
m: setResourceLimit: invalid argument (Invalid argument)
Code source:
import System.Exit (exitWith, ExitCode(ExitSuccess))
import System.IO (putStrLn)
import System.Posix.Resource
rlimit = ResourceLimit 3
f = do
putStrLn "whoooooo"
f
main = do
setResourceLimit ResourceCPUTime (ResourceLimits rlimit rlimit)
r <- getResourceLimit ResourceCPUTime
let (ResourceLimit s) = softLimit r
let (ResourceLimit h) = hardLimit r
putStrLn $ show s
putStrLn $ show h
f
exitWith ExitSuccess
Change History
Note: See
TracTickets for help on using
tickets.
