Re: [GHC] #2560: killThread and getChanContents appear to interact strangely

2008-12-02 Thread GHC
#2560: killThread and getChanContents appear to interact strangely
-+--
Reporter:  batterseapower|Owner:  
Type:  bug   |   Status:  closed  
Priority:  normal|Milestone:  6.10.2  
   Component:  Runtime System|  Version:  6.9 
Severity:  normal|   Resolution:  invalid 
Keywords:|   Difficulty:  Unknown 
Testcase:|   Os:  Unknown/Multiple
Architecture:  Unknown/Multiple  |  
-+--
Changes (by simonmar):

  * status:  new = closed
  * resolution:  = invalid

Comment:

 I've spent a long time staring at this ticket today, and I'm not convinced
 there's a bug.  `modifyMVar` is exception-safe, and so is
 `getChanContents`, as far as I can tell.  Ian's point is true, that you
 can't guarantee to keep exceptions blocked when calling a library
 function, but I don't think that makes anything unsafe in this case.
 Exception-safety is all about making sure that `MVars` get replaced if an
 exception is raised, and I think that always holds for `modifyMVar` and
 `getChanContents`.

 No, I suspect there's a bug in the program logic.  It just loops when it
 gets to a chunk size of 1, and if you look at the definition of
 `readWithTimeout`, you can see why.  If the chunk size is 1, it just
 recurses with the same value for `n`.  At least, that's my guess - I don't
 fully understand what this program is trying to do.

 If you disagree, plesae re-open the bug.

-- 
Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/2560#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] #2560: killThread and getChanContents appear to interact strangely

2008-11-28 Thread GHC
#2560: killThread and getChanContents appear to interact strangely
-+--
Reporter:  batterseapower|Owner:  
Type:  bug   |   Status:  new 
Priority:  normal|Milestone:  6.10.2  
   Component:  Runtime System|  Version:  6.9 
Severity:  normal|   Resolution:  
Keywords:|   Difficulty:  Unknown 
Testcase:|   Os:  Unknown/Multiple
Architecture:  Unknown/Multiple  |  
-+--
Comment (by igloo):

 OK, I think the problem is that
 {{{
 readChan = modifyMVar ...
 }}}
 and
 {{{
 modifyMVar :: MVar a - (a - IO (a,b)) - IO b
 modifyMVar m io =
   block $ do
 a  - takeMVar m
 (a',b) - unblock (io a) `onException` putMVar m a
 putMVar m a'
 return b
 }}}
 so although you are calling `readChan` with exceptions blocked, they are
 being unblocked by the library.

 I'm not sure what the best solution is.

-- 
Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/2560#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] #2560: killThread and getChanContents appear to interact strangely

2008-10-04 Thread GHC
#2560: killThread and getChanContents appear to interact strangely
--+-
 Reporter:  batterseapower|  Owner:  
 Type:  bug   | Status:  new 
 Priority:  normal|  Milestone:  6.10.2  
Component:  Runtime System|Version:  6.9 
 Severity:  normal| Resolution:  
 Keywords:| Difficulty:  Unknown 
 Testcase:|   Architecture:  Unknown/Multiple
   Os:  Unknown/Multiple  |  
--+-
Changes (by igloo):

  * difficulty:  = Unknown
  * os:  MacOS X = Unknown/Multiple
  * architecture:  x86 = Unknown/Multiple
  * milestone:  = 6.10.2

Comment:

 I can reproduce this on amd64/Linux too, and with 6.8.2 as well as the
 HEAD.

-- 
Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/2560#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


Re: [GHC] #2560: killThread and getChanContents appear to interact strangely

2008-09-01 Thread GHC
#2560: killThread and getChanContents appear to interact strangely
---+
Reporter:  batterseapower  |Owner: 
Type:  bug |   Status:  new
Priority:  normal  |Milestone: 
   Component:  Runtime System  |  Version:  6.9
Severity:  normal  |   Resolution: 
Keywords:  | Testcase: 
Architecture:  x86 |   Os:  MacOS X
---+
Comment (by batterseapower):

 Forgot to mention: the test case above uses a 5000 element list. For some
 reason, this causes quite a few failures on my machine. If it doesn't work
 on yours, try bumping it up to 10 or so, which should make the failure
 certain.

-- 
Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/2560#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