Skip to content

GitLab

  • Projects
  • Groups
  • Snippets
  • Help
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
  • Sign in / Register
GHC
GHC
  • Project overview
    • Project overview
    • Details
    • Activity
    • Releases
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
    • Locked Files
  • Issues 4,242
    • Issues 4,242
    • List
    • Boards
    • Labels
    • Service Desk
    • Milestones
    • Iterations
  • Merge Requests 387
    • Merge Requests 387
  • Requirements
    • Requirements
    • List
  • CI / CD
    • CI / CD
    • Pipelines
    • Jobs
    • Schedules
  • Security & Compliance
    • Security & Compliance
    • Dependency List
    • License Compliance
  • Operations
    • Operations
    • Incidents
    • Environments
  • Analytics
    • Analytics
    • CI / CD
    • Code Review
    • Insights
    • Issue
    • Repository
    • Value Stream
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Members
    • Members
  • Collapse sidebar
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
  • Glasgow Haskell Compiler
  • GHCGHC
  • Issues
  • #7930

Closed
Open
Opened May 24, 2013 by Ryan Yates@fryguybob💬Reporter

Nested STM Invariants are lost

Invariants from a successful nested transaction should be merged with the parent.

import Control.Concurrent
import Control.Concurrent.STM

main = do
    x <- atomically $
        do a <- newTVar True
           (always (readTVar a) >> retry) `orElse` return ()
           return a
    atomically (writeTVar x False) -- Should not and does not fail

    y <- atomically $
        do a <- newTVar True
           always (readTVar a) `orElse` return ()
           return a
    atomically (writeTVar y False) -- Should fail, but does not!

    putStrLn "Ahhh!"

    z <- atomically $
        do a <- newTVar True
           always (readTVar a)
           return a
    atomically (writeTVar z False) -- should and does fail

I know how to fix this. I'll have a patch with some tests and a fix soon.

Trac metadata
Trac field Value
Version 7.6.3
Type Bug
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component Runtime System
Test case
Differential revisions
BlockedBy
Related
Blocking
CC
Operating system
Architecture
Assignee
Assign to
8.0.1
Milestone
8.0.1 (Past due)
Assign milestone
Time tracking
None
Due date
None
Reference: ghc/ghc#7930