malformed asynchronous insert query crashes servers
FrazzIe opened this issue · 5 comments
Issue checklist
Please put
x
inside of the box that matches your issue.
- I am using the latest release
- I have referenced previously reported issues
- I have referenced available documentation and cannot resolve the issue
- I'm certain this is an issue with oxymysql, and not with my resource
Describe the bug
Executing an async insert query that references an invalid table, column or provides bad data will outright kill node and crash the server.
Screenshots
Crash output from repro:
Code
AddEventHandler('onResourceStart', function(resourceName)
if GetCurrentResourceName() ~= resourceName then
return;
end
-- -- await works fine
-- local insert = MySQL.insert.await('INSERT into bad_query_table (col_1, col_2, col_3, col_4, col_5) VALUES (?, ?, ?, ?, ?)', {
-- 1, 5, 8, 'bad', true
-- });
-- -- works fine
-- local query = MySQL.query.await('SELECT col_1, col_2, col_3, col_4, col_5 FROM bad_query_table WHERE col_1 = ?', { 1 });
-- -- works fine
-- MySQL.query('SELECT col_1, col_2, col_3, col_4, col_5 FROM bad_query_table WHERE col_1 = ?', { 1 });
-- this kills the whole server
MySQL.insert('INSERT into bad_query_table (col_1, col_2, col_3, col_4, col_5) VALUES (?, ?, ?, ?, ?)', {
1, 5, 8, 'bad', true
});
end)
Expected behavior
- Blasts the error in console but doesn't crash the server in the process
Server details
- FXServer artifact: latest,6511
- OS: Windows 10 (local) & Microsoft Windows Server 2019 Datacenter (server)
Database details
Tested on:
- 10.4.22-MariaDB (server)
- 10.10.2-MariaDB-1:10.10.2+maria~ubu2204 (local)
hmm, not really sure then? I can repro it on a barebones server with cfx defaults & oxmysql. I'm also running it through txadmin.
barebones resource list:
ensure mapmanager
ensure chat
ensure spawnmanager
ensure sessionmanager
ensure basic-gamemode
ensure hardcap
ensure baseevents
ensure oxmysql
tried it on a barebones server without txadmin and it never killed the server, I believe it's reproduceable only when running through txAdmin
Did some further investigating, this is an issue 100% specific to my setup, I had a rogue node option set $env:NODE_OPTIONS = "--openssl-legacy-provider"
that I was using to circumvent a webpack issue at the time 😐.