Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

file descriptor out of range for select - Recompile with -threaded to work around this

Tags:

haskell

I had a Haskell application crash today with this error message:

app: file descriptor 8758616 out of range for select (0--1024).
Recompile with -threaded to work around this.

How can I solve this? What does -threaded mean?

like image 379
Chris Stryczynski Avatar asked Dec 01 '25 23:12

Chris Stryczynski


1 Answers

If you think you're already compiling with -threaded, you can use RTS options to verify:

$ ./app +RTS --info
 [("GHC RTS", "YES")
 ,("GHC version", "9.4.8")
 ,("RTS way", "rts_thr")
 ,("Build platform", "x86_64-unknown-linux")
 ,("Build architecture", "x86_64")
 ,("Build OS", "linux")
 ,("Build vendor", "unknown")
 ,("Host platform", "x86_64-unknown-linux")
 ,("Host architecture", "x86_64")
 ,("Host OS", "linux")
 ,("Host vendor", "unknown")
 ,("Target platform", "x86_64-unknown-linux")
 ,("Target architecture", "x86_64")
 ,("Target OS", "linux")
 ,("Target vendor", "unknown")
 ,("Word size", "64")
 ,("Compiler unregisterised", "NO")
 ,("Tables next to code", "YES")
 ,("Flag -with-rtsopts", "")
 ]

If "RTS way" contains thr, as above, you have built the binary correctly and it should not have this issue. If it doesn't, e.g. "rts_v" (v for vanilla), then you need to rebuild it (perhaps some recompilation avoidance didn't notice the options changed?). See GHC docs for more about different RTS ways, and the other fields above.

like image 116
Ben Millwood Avatar answered Dec 04 '25 16:12

Ben Millwood



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!