Asynchronous exceptions and laziness bugs in Control.Concurrent.QSem/QSemN

Bas van Dijk v.dijk.bas at gmail.com
Thu Mar 18 16:54:14 EDT 2010


Hello,

after discovering the bugs regarding asynchronous exceptions and
laziness in Data.Unique and Control.Concurrent.SampleVar I became a
bit suspicious about the other concurrency mechanisms.

It looks like Control.Concurrent.Chan is safe because it uses
modifyMVar_ internally which performs the necessary block.

Control.Concurrent.QSem and QSemN are not alright however! They both
suffer the same bugs:

* Potential dead-lock due to not blocking asynchronous exceptions.
* Potential space-leak because of lazily putting numeric expression in a MVar.

The attached patch fixes these bugs.

regards,

Bas
-------------- next part --------------
A non-text attachment was scrubbed...
Name: async-exceptions-and-laziness-in-qsem-qsemn.dpatch
Type: application/octet-stream
Size: 31819 bytes
Desc: not available
Url : http://www.haskell.org/pipermail/libraries/attachments/20100318/5782291f/async-exceptions-and-laziness-in-qsem-qsemn-0001.obj


More information about the Libraries mailing list