id	summary	reporter	owner	description	type	status	priority	milestone	component	version	resolution	keywords	cc	os	architecture	failure	difficulty	testcase	blockedby	blocking	related
5088	TextEncoding iconv instances are shared between threads	batterseapower		"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
"	bug	closed	normal		libraries/base	7.0.3	invalid			Unknown/Multiple	Unknown/Multiple	Incorrect result at runtime					
