Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
  • Sign in / Register
  • GHC GHC
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
    • Locked Files
  • Issues 5,256
    • Issues 5,256
    • List
    • Boards
    • Service Desk
    • Milestones
    • Iterations
  • Merge requests 563
    • Merge requests 563
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
    • Test Cases
  • Deployments
    • Deployments
    • Releases
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Code review
    • Insights
    • Issue
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • Glasgow Haskell CompilerGlasgow Haskell Compiler
  • GHCGHC
  • Issues
  • #20317
Closed
Open
Issue created Aug 31, 2021 by David Feuer@treeowlReporter

Odd interaction between unsafePerformIO and threadDelay

Summary

threadDelay doesn't seem to resume properly after an exception in an unsafePerformIO context.

Steps to reproduce

ghci -threaded
> import Control.Concurrent
> import System.IO.Unsafe
> import Control.Exception

> let okay = unsafePerformIO (evaluate (sum [1..10^7]) *> putStrLn "Hi there.")
> okay
-- Hit Ctrl-C
-- See "^CInterrupted."
> okay
-- After a few seconds, it prints "Hi there." and then "()".

> let oops = unsafePerformIO (threadDelay (10^7) *> putStrLn "Hi there.")
> oops
-- Hit Ctrl-C
-- See "^CInterrupted."
> oops
-- See "^CInterrupted."

Expected behavior

I would expect the threadDelay call to resume, and to eventually see "Hi there." and the () return value.

Environment

  • GHC version used: 9.0.1

Optional:

  • Operating System: Linux (OpenSUSE)
  • System Architecture: x86_64
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information
Assignee
Assign to
Time tracking