Project: datamanagement
Issue DM-2762: Avoid leaking memory allocated by mysql_thread_init
mysql/MySqlConnection.cc contains the following comment: {code} // Dangerous to use mysql_thread_end(), because caller may belong to a // different thread other than the one that called mysql_init(). Suggest // using thread-local-storage to track users of mysql_init(), and to call // mysql_thread_end() appropriately. Not an easy thing to do right now, and // shouldn't be a big deal because we thread-pool anyway. {code} The comment is not really correct with regards to thread pooling. Instead, each rproc::InfileMerger has an rproc::InfileMerger::Mgr which contains a util::WorkQueue that spawns a thread, and so we are failing to call mysql_thread_end at least once per user query. This has been verified using the memcheck valgrind tool.
Story points: 3