Bug #76645 trx_resurrect_table_locks function crash in ms-windows
Submitted: 10 Apr 2015 1:59 Modified: 29 Apr 2015 5:38
Reporter: aceking king Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: InnoDB storage engine Severity:S3 (Non-critical)
Version:5.7 OS:Microsoft Windows
Assigned to: CPU Architecture:Any
Tags: crash mysql

[10 Apr 2015 1:59] aceking king
Description:

in trx_resurrect_table_locks function :

.....

at 474 line:

			DBUG_PRINT("ib_trx",
				   ("resurrect" TRX_ID_FMT
				    "  table '%s' IX lock from %s undo",
				    trx->id, table->name,
				    undo == trx->insert_undo
				    ? "insert" : "update"));

It use DBUG_PRINT to print the line , But the the macro "TRX_ID_FMT" is defined as "%I64u" in 
file univ.i ,
So, DBUG_PRINT macro call functions : _db_doprnt_ -->DbugVfprintf-->my_vsnprintf_ex-->check_longlong
but check_longlong function just deal with "ll" or "z" , it cannot resolve the "I64" format, 
then mysqld crash

How to repeat:
just

DBUG_PRINT("ib_trx",
				   ("resurrect" TRX_ID_FMT
				    "  table '%s' IX lock from %s undo",
				   10, "crash in windows",
				   "crash in windows"));

Suggested fix:
replace TRX_ID_FMT to "%llu"	can fix the bug:
DBUG_PRINT("ib_trx",
				("resurrect" "%llu"
				    "  table '%s' IX lock from %s undo",
				    (uint64)trx->id, table->name,
				    (undo == trx->insert_undo
				    ? "insert" : "update")));
[10 Apr 2015 4:45] aceking king
modify the version
[25 Apr 2015 10:55] MySQL Verification Team
On 5.7 tree I got no crash.  Did you actually get a crash or is this just reported after a code inspection?

In debugger I have format: resurrect%llu  table '%s' IX lock from %s undo

In code:
/** printf(3) format used for printing DB_TRX_ID and other system fields */
#define TRX_ID_FMT		IB_ID_FMT

#define IB_ID_FMT	UINT64PF

#ifdef _WIN32
/* Use the integer types and formatting strings defined in Visual Studio. */
# define UINT32PF	"%lu"
# define UINT64PF	"%llu"   <-----------
# define UINT64PFx	"%016llx"
typedef unsigned __int64 ib_uint64_t;
typedef unsigned __int32 ib_uint32_t;
#else
[25 Apr 2015 11:08] MySQL Verification Team
as far as I can tell, this was fixed in 5.7.2+ by

Bug 16559119 - MY_VSNPRINTF DOES NOT UNDERSTAND MICROSOFT I64 AND I32 LENGTH MODIFIERS 

So, please try 5.7.7 and let us know.
[29 Apr 2015 5:38] aceking king
ok, It do not happy in 5.7.7