Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
badabingbadabooom opened this issue Mar 12, 2022 · 1 comment

Comments

@badabingbadabooom
Copy link

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)));

@badabingbadabooom
Copy link
Author

logcore_debuginfo 0 in the server.cfg "fixes" it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant