Skip to content

Crash using the JIT plugin's "jit_sleep" option in a script with debug symbols #22

@badabingbadabooom

Description

@badabingbadabooom

I can't quite explain what happens, but I made an example with the MySQL plugin:

#pragma option -d3

#include <a_samp>
#include <a_mysql>

new MySQL:db_handle;

public OnGameModeInit()
{
	db_handle = mysql_connect(/* example database connection data */);
	mysql_tquery(db_handle, "SELECT 1 AS \"ONE\";", "QueryDone", "i", 10);

	return 1;
}

forward QueryDone(test_param);
public QueryDone(test_param)
{
	printf("QueryDone(test_param = %i)", test_param);

	new rowcount;
	cache_get_row_count(rowcount);
	// On the JIT, the native above crashes the server, so everything below wouldn't get printed.

	printf("rowcount = %i", rowcount);
	if(rowcount)
	{
		new one;
		cache_get_value_name_int(0, "ONE", one);
		printf("one = %i", one);
	}

	mysql_close(db_handle);
	return 1;
}

Running this code in a default server with the JIT and MySQL plugins and jit_sleep 1 in the server.cfg, the server will crash when the cache_get_row_count native gets called.
But if I remove only the -d3 option (without toggling jit_sleep), I get the expected output:

QueryDone(test_param = 10)
rowcount = 1
one = 1

Messing around with a debugger and log-core 0.4 with debug symbols, I could find out that log-core crashes because of an access violation exception in this line:

cell ret_addr = *(reinterpret_cast<cell *>(dat + frm_addr + sizeof(cell)));

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions