From: Vinay Fisrekar Date: December 28 2012 8:00am Subject: bzr push into mysql-trunk branch (vinay.fisrekar:5305 to 5306) List-Archive: http://lists.mysql.com/commits/145552 Message-Id: <201212280801.qBS81Z4l021732@vinayf-laptop> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit 5306 Vinay Fisrekar 2012-12-28 [merge] Null push. 5305 kevin.lewis@stripped 2012-12-27 Bug14762796-THREADEXIT() ON WINDOWS IS CALLED PREMATURELY WITH HANDLES NOT CLOSED InnoDB uses os_thread_create() as a pthread implementation. It pays no attention to what it returns on Windows. That is because on non-Windows platforms it returns the same value as the third parameter, the thread_id. If os_thread_create() actually fails to create a thread it does an exit(1). So from a *nix perspective, there is no need to check the return value. But on Windows, the return value is a handle to the thread object. This system thread object is held open by that handle even after the thread exits, until the process exits. InnoDB does not close any os_thread_t handles since it make no attempt to record them. Until FTS, there was really no need to close these handles because all threads started by InnoDB live until shutdown. But FTS introduced some short-lived threads. These threads were left open until shutdown which was fixed by Bug14759163 by explicitly closing those threads. This patch is a general fix for closing Windows thread handles by allowing os_thread_create() to close it immediately after CreateThread() starts the thread. The thread object then stays around until the thread exits. Then instead of returning this closed handle, os_thread_create() is redesigned to return void, recognizing that InnoDB code never checks that return value anyway. So the schizophrenic type os_thread_t which was a thread_id on *nix and a HANDLE on Windows is just deleted. Approved by Jimmy in RB:1416 modified: storage/innobase/include/os0thread.h storage/innobase/include/row0ftsort.h storage/innobase/log/log0recv.cc storage/innobase/os/os0thread.cc storage/innobase/row/row0ftsort.cc No bundle (reason: useless for push emails).