Re: [GHC] #7493: STM and TVar report incorrect results

2013-01-03 Thread GHC
#7493: STM and TVar report incorrect results
--+-
  Reporter:  parcs|  Owner:  
  Type:  bug  | Status:  closed  
  Priority:  highest  |  Milestone:  7.6.2   
 Component:  Runtime System   |Version:  7.6.1   
Resolution:  fixed|   Keywords:  
Os:  Unknown/Multiple |   Architecture:  Unknown/Multiple
   Failure:  Incorrect result at runtime  | Difficulty:  Unknown 
  Testcase:   |  Blockedby:  
  Blocking:   |Related:  
--+-
Changes (by igloo):

  * status:  merge = closed
  * resolution:  = fixed


Comment:

 Reverted, and merged as 57c8d1c2c8ceba6973a48d138d1bb018ec2988ae

-- 
Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/7493#comment:11
GHC http://www.haskell.org/ghc/
The Glasgow Haskell Compiler

___
Glasgow-haskell-bugs mailing list
Glasgow-haskell-bugs@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs


Re: [GHC] #7493: STM and TVar report incorrect results

2012-12-18 Thread GHC
#7493: STM and TVar report incorrect results
--+-
  Reporter:  parcs|  Owner:  
  Type:  bug  | Status:  new 
  Priority:  highest  |  Milestone:  7.6.2   
 Component:  Runtime System   |Version:  7.6.1   
Resolution:   |   Keywords:  
Os:  Unknown/Multiple |   Architecture:  Unknown/Multiple
   Failure:  Incorrect result at runtime  | Difficulty:  Unknown 
  Testcase:   |  Blockedby:  
  Blocking:   |Related:  
--+-

Comment(by marlowsd@…):

 commit a006ecdfd381fa75ab16ddb66c3a2b247f359eb8
 {{{
 Author: Simon Marlow marlo...@gmail.com
 Date:   Tue Dec 18 09:10:26 2012 +

 A better fix for #7493 (see comment for details)

  rts/STM.c |   64
 +---
  1 files changed, 44 insertions(+), 20 deletions(-)
 }}}

-- 
Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/7493#comment:9
GHC http://www.haskell.org/ghc/
The Glasgow Haskell Compiler

___
Glasgow-haskell-bugs mailing list
Glasgow-haskell-bugs@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs


Re: [GHC] #7493: STM and TVar report incorrect results

2012-12-18 Thread GHC
#7493: STM and TVar report incorrect results
--+-
  Reporter:  parcs|  Owner:  
  Type:  bug  | Status:  merge   
  Priority:  highest  |  Milestone:  7.6.2   
 Component:  Runtime System   |Version:  7.6.1   
Resolution:   |   Keywords:  
Os:  Unknown/Multiple |   Architecture:  Unknown/Multiple
   Failure:  Incorrect result at runtime  | Difficulty:  Unknown 
  Testcase:   |  Blockedby:  
  Blocking:   |Related:  
--+-
Changes (by simonmar):

  * status:  new = merge


Comment:

 I reverted the previous fix:

 commit 55c55f141b8b312512cce1d7e0fbd3a8088de964
 {{{
 Author: Simon Marlow marlo...@gmail.com
 Date:   Tue Dec 18 08:43:29 2012 +

 Revert Fix a bug in the handling of nested orElse

 This reverts commit f184d9caffa09750ef6a374a7987b9213d6db28e.

 The next commit will fix it in a better way.
 }}}

 please merge both commits.

 @fryguybob, @parcs: see if you can break it again!

-- 
Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/7493#comment:10
GHC http://www.haskell.org/ghc/
The Glasgow Haskell Compiler

___
Glasgow-haskell-bugs mailing list
Glasgow-haskell-bugs@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs


Re: [GHC] #7493: STM and TVar report incorrect results

2012-12-16 Thread GHC
#7493: STM and TVar report incorrect results
--+-
  Reporter:  parcs|  Owner:  
  Type:  bug  | Status:  closed  
  Priority:  highest  |  Milestone:  7.6.2   
 Component:  Runtime System   |Version:  7.6.1   
Resolution:  fixed|   Keywords:  
Os:  Unknown/Multiple |   Architecture:  Unknown/Multiple
   Failure:  Incorrect result at runtime  | Difficulty:  Unknown 
  Testcase:   |  Blockedby:  
  Blocking:   |Related:  
--+-

Comment(by fryguybob):

 I built with the fix and for the first program I'm getting:

 {{{
 [True,False]
 [False]
 []
 []
 ...
 }}}

-- 
Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/7493#comment:4
GHC http://www.haskell.org/ghc/
The Glasgow Haskell Compiler

___
Glasgow-haskell-bugs mailing list
Glasgow-haskell-bugs@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs


Re: [GHC] #7493: STM and TVar report incorrect results

2012-12-16 Thread GHC
#7493: STM and TVar report incorrect results
--+-
  Reporter:  parcs|  Owner:  
  Type:  bug  | Status:  new 
  Priority:  highest  |  Milestone:  7.6.2   
 Component:  Runtime System   |Version:  7.6.1   
Resolution:   |   Keywords:  
Os:  Unknown/Multiple |   Architecture:  Unknown/Multiple
   Failure:  Incorrect result at runtime  | Difficulty:  Unknown 
  Testcase:   |  Blockedby:  
  Blocking:   |Related:  
--+-
Changes (by parcs):

  * status:  closed = new
  * resolution:  fixed =


Comment:

 I am getting the same output as fryguybob using GHC 7.7 20121214 and STM
 2.4.2.

-- 
Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/7493#comment:5
GHC http://www.haskell.org/ghc/
The Glasgow Haskell Compiler

___
Glasgow-haskell-bugs mailing list
Glasgow-haskell-bugs@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs


Re: [GHC] #7493: STM and TVar report incorrect results

2012-12-16 Thread GHC
#7493: STM and TVar report incorrect results
--+-
  Reporter:  parcs|  Owner:  
  Type:  bug  | Status:  new 
  Priority:  highest  |  Milestone:  7.6.2   
 Component:  Runtime System   |Version:  7.6.1   
Resolution:   |   Keywords:  
Os:  Unknown/Multiple |   Architecture:  Unknown/Multiple
   Failure:  Incorrect result at runtime  | Difficulty:  Unknown 
  Testcase:   |  Blockedby:  
  Blocking:   |Related:  
--+-

Comment(by fryguybob):

 I've reduced the first program to the following:

 {{{
 import Control.Concurrent.STM

 main = do
   x - atomically $ do
  r - newTVar []
  writeTVar r [2]
  writeTVar r [] `orElse` return ()
  readTVar r
   print x
 }}}

 This outputs `[2]` when I would expect `[]`.  If I use `Int`s it does not
 fail and if I have different values for each of the write or new's it
 works:

 {{{
 import Control.Concurrent.STM

 main = do
   x - atomically $ do
  r - newTVar [1]
  writeTVar r [2]
  writeTVar r [1] `orElse` return ()
  readTVar r
   print x
 }}}

 Outputs: `[1]`

 {{{
 import Control.Concurrent.STM

 main = do
   x - atomically $ do
  r - newTVar 1
  writeTVar r 2
  writeTVar r 1 `orElse` return ()
  readTVar r
   print x
 }}}

 Output: `1`

 Also interesting:

 {{{
 import Control.Concurrent.STM

 main = do
   x - atomically $ do
  r - newTVar Nothing
  writeTVar r (Just 2)
  writeTVar r Nothing `orElse` return ()
  readTVar r
   print x
 }}}

 Output: `Just 2`

 I'll start digging around to see what is going on with this example.

-- 
Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/7493#comment:6
GHC http://www.haskell.org/ghc/
The Glasgow Haskell Compiler

___
Glasgow-haskell-bugs mailing list
Glasgow-haskell-bugs@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs


Re: [GHC] #7493: STM and TVar report incorrect results

2012-12-16 Thread GHC
#7493: STM and TVar report incorrect results
--+-
  Reporter:  parcs|  Owner:  
  Type:  bug  | Status:  new 
  Priority:  highest  |  Milestone:  7.6.2   
 Component:  Runtime System   |Version:  7.6.1   
Resolution:   |   Keywords:  
Os:  Unknown/Multiple |   Architecture:  Unknown/Multiple
   Failure:  Incorrect result at runtime  | Difficulty:  Unknown 
  Testcase:   |  Blockedby:  
  Blocking:   |Related:  
--+-

Comment(by fryguybob):

 I've traced down the point of divergence between a test that works and one
 that does not.  The following works:

 {{{
 import Control.Concurrent.STM

 main = do
   x - atomically $ do
  r - newTVar 1
  writeTVar r 2
  writeTVar r 1 `orElse` return ()
  readTVar r
   print x
 }}}

 But if we change to:

 {{{
 import Control.Concurrent.STM

 main = do
   x - atomically $ do
  let a = 1
  r - newTVar a
  writeTVar r 2
  writeTVar r a `orElse` return ()
  readTVar r
   print x
 }}}

 Then when we try to commit the inner transaction with
 `stmCommitNestedTransaction` we enter `validate_and_acquire_ownership` and
 hit `entry_is_update`
 ([https://github.com/ghc/ghc/blob/ghc-7.6/rts/STM.c#L809 code here]) which
 returns false (the current value is the exact `a` that initialized in
 `newTVar`).  In the one that works each `1` is a different thunk
 (`Integer`, unlike `Int` I said before; using `Int` it does indeed fail).

 I'm still tracking down what happens after this, but now we know the
 difference between the examples.

-- 
Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/7493#comment:7
GHC http://www.haskell.org/ghc/
The Glasgow Haskell Compiler

___
Glasgow-haskell-bugs mailing list
Glasgow-haskell-bugs@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs


Re: [GHC] #7493: STM and TVar report incorrect results

2012-12-16 Thread GHC
#7493: STM and TVar report incorrect results
--+-
  Reporter:  parcs|  Owner:  
  Type:  bug  | Status:  new 
  Priority:  highest  |  Milestone:  7.6.2   
 Component:  Runtime System   |Version:  7.6.1   
Resolution:   |   Keywords:  
Os:  Unknown/Multiple |   Architecture:  Unknown/Multiple
   Failure:  Incorrect result at runtime  | Difficulty:  Unknown 
  Testcase:   |  Blockedby:  
  Blocking:   |Related:  
--+-

Comment(by fryguybob):

 It looks like this particular case is not accounted for.  If an outer
 transaction writes the inner transaction needs to compare with that value
 to know if it is an update, not with the originally read value (which we
 need for knowing if there was an update from outside).  Worse yet, the
 write we need to see could be several levels out.  Perhaps it would be
 better to fix it on the other side of things.  If a write doesn't update,
 then when we `merge_read_into` if the outer record entry ''is'' an update,
 then we know the inner has reversed the update.  But here we can't
 distinguish a write to match the expected value and a read (which we would
 not want to take as an indication that we should revert our outer update).

 Perhaps another approach could be to look when we do an `stmWriteTVar` to
 see if we are an inner transaction writing what matches the expected
 value.  If so, built a thunk (indirection?) so we are sure to get a new
 value that will be seen by the outer transaction.

-- 
Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/7493#comment:8
GHC http://www.haskell.org/ghc/
The Glasgow Haskell Compiler

___
Glasgow-haskell-bugs mailing list
Glasgow-haskell-bugs@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs


Re: [GHC] #7493: STM and TVar report incorrect results

2012-12-14 Thread GHC
#7493: STM and TVar report incorrect results
--+-
  Reporter:  parcs|  Owner:  
  Type:  bug  | Status:  closed  
  Priority:  highest  |  Milestone:  7.6.2   
 Component:  Runtime System   |Version:  7.6.1   
Resolution:  fixed|   Keywords:  
Os:  Unknown/Multiple |   Architecture:  Unknown/Multiple
   Failure:  Incorrect result at runtime  | Difficulty:  Unknown 
  Testcase:   |  Blockedby:  
  Blocking:   |Related:  
--+-
Changes (by igloo):

  * status:  merge = closed
  * resolution:  = fixed


Comment:

 Merged as 5ea49271f793ed0f872342bf6a1cb0de10a48d94

-- 
Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/7493#comment:3
GHC http://www.haskell.org/ghc/
The Glasgow Haskell Compiler

___
Glasgow-haskell-bugs mailing list
Glasgow-haskell-bugs@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs


Re: [GHC] #7493: STM and TVar report incorrect results

2012-12-10 Thread GHC
#7493: STM and TVar report incorrect results
+---
Reporter:  parcs|  Owner:  
Type:  bug  | Status:  new 
Priority:  normal   |  Component:  Runtime System  
 Version:  7.6.1|   Keywords:  
  Os:  Unknown/Multiple |   Architecture:  Unknown/Multiple
 Failure:  Incorrect result at runtime  |  Blockedby:  
Blocking:   |Related:  
+---
Changes (by meteficha):

 * cc: felipe.lessa@… (added)


-- 
Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/7493#comment:1
GHC http://www.haskell.org/ghc/
The Glasgow Haskell Compiler

___
Glasgow-haskell-bugs mailing list
Glasgow-haskell-bugs@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs


Re: [GHC] #7493: STM and TVar report incorrect results

2012-12-10 Thread GHC
#7493: STM and TVar report incorrect results
-+--
Reporter:  parcs |   Owner: 
Type:  bug   |  Status:  merge  
Priority:  highest   |   Milestone:  7.6.2  
   Component:  Runtime System| Version:  7.6.1  
Keywords:|  Os:  Unknown/Multiple   
Architecture:  Unknown/Multiple  | Failure:  Incorrect result at runtime
  Difficulty:  Unknown   |Testcase: 
   Blockedby:|Blocking: 
 Related:|  
-+--
Changes (by simonmar):

  * priority:  normal = highest
  * difficulty:  = Unknown
  * status:  new = merge
  * milestone:  = 7.6.2


Comment:

 Fixed (sorry, I didn't notice that you'd filed a ticket until just now):

 commit f184d9caffa09750ef6a374a7987b9213d6db28e
 {{{
 Author: Simon Marlow marlo...@gmail.com
 Date:   Mon Dec 10 12:00:54 2012 +

 Fix a bug in the handling of nested orElse

 Exposed by the following snippet, courtesy of Bas van Dijk and Patrick
 Palka on librar...@haskell.org:

 import Control.Concurrent.STM
 main = do
   x - atomically $ do
  t - newTVar 1
  writeTVar t 2
  ((readTVar t  retry) `orElse` return ()) `orElse` return ()
  readTVar t
   print x
 }}}

-- 
Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/7493#comment:2
GHC http://www.haskell.org/ghc/
The Glasgow Haskell Compiler

___
Glasgow-haskell-bugs mailing list
Glasgow-haskell-bugs@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs