Ticket #1109 (closed merge: fixed)

Opened 5 years ago

Last modified 2 years ago

lockFile: fd out of range

Reported by: guest Owned by: igloo
Priority: normal Milestone: 6.8.3
Component: libraries/base Version: 6.6
Keywords: Cc:
Operating System: Linux Architecture: Unknown/Multiple
Type of failure: Difficulty: Easy (less than 1 hour)
Test Case: Blocked By:
Blocking: Related Tickets:

Description (last modified by igloo) (diff)

My program was terminated with the following message:

internal error: lockFile: fd out of range
    (GHC version 6.6 for i386_unknown_linux)
    Please report this as a GHC bug:  http://www.haskell.org/ghc/reportabug

The reason appears to be the large number of simultaneously open files. If I limit the number of open descriptors to 1025 or lower, I get "openFile: resource exhausted (Too many open files" instead.

Change History

Changed 5 years ago by igloo

  • description modified (diff)
  • milestone set to 6.6.1

Can anyone give us a testcase for this please?

Changed 5 years ago by simonmar

See this thread:  http://www.haskell.org/pipermail/haskell-cafe/2005-October/011928.html

GHC uses FD_SETSIZE to determine the maximum number of file descriptors. Perhaps we should be using sysconf(_SC_OPEN_MAX) instead?

Changed 5 years ago by simonmar

Oh, even if we used sysconf(_SC_OPEN_MAX). the IO manager thread would probably crash because it is using FD_SETSIZE sized tables. What's the real story here - is FD_SETSIZE supposed to be large enough, or not?

Changed 5 years ago by igloo

  • milestone changed from 6.6.1 to 6.6.2

According to  http://www.delorie.com/gnu/docs/glibc/libc_248.html FD_SETSIZE is the largest number of things that can be put into an fd_set. The number of open files can be higher (unlimited in the case of GNU HURD, although I'm unclear how you assign unlimited FDs).

We probably want a new datastructure that can cope with unlimited entries; punting for now.

Changed 5 years ago by simonmar

  • owner set to simonmar
  • difficulty changed from Unknown to Easy (1 hr)
  • component changed from Runtime System to libraries/base
  • milestone changed from 6.6.2 to 6.8

Changed 4 years ago by simonmar

  • milestone changed from 6.8 branch to 6.8.3

Changed 4 years ago by simonmar

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

Fixed.

Patch to GHC:

Tue Nov 20 06:08:59 PST 2007  Simon Marlow <simonmar@microsoft.com>
  * Move file locking into the RTS, fixing #629, #1109

Patch to libraries/base:

Tue Nov 20 04:10:53 PST 2007  Simon Marlow <simonmar@microsoft.com>
  * Move file locking into the RTS, fixing #629, #1109

Patch to libraries/process:

Tue Nov 20 04:42:40 PST 2007  Simon Marlow <simonmar@microsoft.com>
  * catch up with changes to GHC.Handle.fdToHandle'

Changed 4 years ago by simonmar

One more patch to merge, in libraries/base:

Wed Nov 21 10:22:48 GMT 2007  Simon Marlow <simonmar@microsoft.com>
  * remove lockFile.h from install-includes

Changed 4 years ago by igloo

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

As discussed on IRC, some projects (e.g. darcs, I believe) use GHC.Handle.fdToHandle', so we shouldn't change its interface on the branch.

<JaffaCake> it's easy enough to make it compatible, I should probably do that

Changed 4 years ago by simonmar

Done. Revised list of patches to merge:

GHC:

Tue Nov 20 06:08:59 PST 2007  Simon Marlow <simonmar@microsoft.com>
  * Move file locking into the RTS, fixing #629, #1109

libraries/base:

Tue Nov 20 04:10:53 PST 2007  Simon Marlow <simonmar@microsoft.com>
  * Move file locking into the RTS, fixing #629, #1109

Fri Nov 30 13:51:22 GMT 2007  Simon Marlow <simonmar@microsoft.com>
  * restore fdToHandle' to avoid breaking clients (#1109)

Wed Nov 21 10:22:48 GMT 2007  Simon Marlow <simonmar@microsoft.com>
  * remove lockFile.h from install-includes

libraries/process can now work without modification on the stable branch, but I'll be updating it to use the new API in the HEAD.

Changed 4 years ago by igloo

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

Changed 4 years ago by igloo

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

All four merged

Changed 3 years ago by simonmar

  • architecture changed from Unknown to Unknown/Multiple

Changed 2 years ago by simonmar

  • difficulty changed from Easy (1 hr) to Easy (less than 1 hour)
Note: See TracTickets for help on using tickets.