Ticket #2971 (closed merge: fixed)

Opened 4 years ago

Last modified 4 years ago

readFile "/proc/mounts" hangs on an amd64 machine

Reported by: dsf Owned by: igloo
Priority: high Milestone: 6.10.2
Component: Compiler Version: 6.10.1
Keywords: Cc:
Operating System: Linux Architecture: Unknown/Multiple
Type of failure: Difficulty: Unknown
Test Case: Blocked By:
Blocking: Related Tickets:

Description

readFile "/proc/mounts" hangs on an amd64 machine with ghc 6.10.1, it worked find in ghc 6.8.3.

Change History

  Changed 4 years ago by dsf

  • architecture changed from Unknown/Multiple to x86_64 (amd64)

  Changed 4 years ago by dsf

I'm guessing from the responses on the mailing list that this affects amd64 machines and not i386 (or amd64 machines running an i386 kernel.)

  Changed 4 years ago by dsf

Here is the related thread on the mailing list:  http://www.haskell.org/pipermail/haskell-cafe/2009-January/054126.html

  Changed 4 years ago by dsf

  • architecture changed from x86_64 (amd64) to Unknown/Multiple

No, I can now confirm that this bug affects i386 as well.

  Changed 4 years ago by rm

SBCL ran into this problem some time ago. It turned out the Linux kernel doesn't support standard select semantics on files in procfs and sysfs:  http://bugzilla.kernel.org/show_bug.cgi?id=11014

follow-up: ↓ 7   Changed 4 years ago by duncan

The question is why did it work in 6.8 and not work now in 6.10?

in reply to: ↑ 6   Changed 4 years ago by dsf

Replying to duncan:

The question is why did it work in 6.8 and not work now in 6.10?

If you try reading it using a ByteString? function in 6.8 you will get a similar failure. I suspect that that code has moved into the regular IO module.

  Changed 4 years ago by rm

I think I've tracked this down to libraries/base/GHC/Handle.hs. In order to fix #2363, calls to fdReady were added before every IO operation between 6.8.3 and 6.10.1. For real files, this works fine. For the special not-really-files files in /proc and /sys it can fail.

  Changed 4 years ago by igloo

  • priority changed from normal to high
  • difficulty set to Unknown
  • milestone set to 6.10.2

Thanks for tracking down the problem

  Changed 4 years ago by simonmar

  • owner set to simonmar

I messed up when I modified the IO library to avoid using O_NONBLOCK for external file descriptors. Fixing it now.

  Changed 4 years ago by simonmar

  • owner changed from simonmar to igloo
  • type changed from bug to merge

Fixed:

Fri Feb  6 16:59:12 GMT 2009  Simon Marlow <marlowsd@gmail.com>
  * Fix #2971: we had lost the non-blocking flag on Handles created by openFile
  This code is a mess, fortunately the new IO library cleans it up.

reading /proc/mounts works:

Prelude> readFile "/proc/mounts"
"rootfs / rootfs rw 0 0\n/dev/root / ext3 ...

  Changed 4 years ago by igloo

  • status changed from new to closed
  • resolution set to fixed

Merged

Note: See TracTickets for help on using tickets.