Skip to content

socket returns Socket values with no close finalizer for the fd #236

Description

@TomMD

Consider the following, typed not tested, code:

import Network.Socket
import System.Mem
main = do
    _ <- socket AF_INET Stream defaultProtocol
    performGC
    main

This program will quickly exhaust typical system limits on open file descriptors. Now this isn't supposed to be surprising but it seems to me that we could use a finalizer via System.Mem.Weak or similar but one which has enough information to know if this particular value :: Socket has already had close called and conditionally call close when that isn't the case. Am I missing something that makes this hard?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions