#5088: TextEncoding iconv instances are shared between threads
---------------------------------+------------------------------------------
Reporter: batterseapower | Owner:
Type: bug | Status: new
Priority: normal | Component: libraries/base
Version: 7.0.3 | Keywords:
Testcase: | Blockedby:
Os: Unknown/Multiple | Blocking:
Architecture: Unknown/Multiple | Failure: Incorrect result at runtime
---------------------------------+------------------------------------------
The icon_t pointers returned from iconv_open should only be while
processing a single text stream, because in general they may contain some
state about the text being processed.
However, we currently don't take any measures to prevent this from
happening, as GHC.IO.Encoding.Iconv.mkTextEncoding shares one pointer
amongst all use sites of that TextEncoding in future -- even if those uses
occur on different threads!
This could lead to arbitrarily strange heisenbugs depending on the iconv
implementation.
Either we should:
1. Make it clear that the user should recreate a TextEncoding anew for
every use site
2. (Better), elaborate the TextEncoding interface so that we can call
iconv_open/iconv_close at the start and end of processing a particular
text block, and ensure that the token doesn't escape so it can be accessed
from multiple threads simultaneously
--
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/5088>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
_______________________________________________
Glasgow-haskell-bugs mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs