MySQL exec_first is crashing program
⚓ Rust 📅 2026-02-16 👤 surdeus 👁️ 1Program is aborting at:
let result = conn.exec_first(SQL_LOOK_UP_UUID, select_params);
Not just an SQL error, a program crash. Never had that happen with mysql before. Should not be possible from that statement. Unfortunately, this is happening on a server under Apache FCGI, and all I get as an error message is Apache's generic
[pid 724267] util_script.c(517): End of script output before headers: uploadimpostor.fcgi
I don't get to see a backtrace, unfortunately.
I do have a logger, and that helps localize the problem. The last message in the log is
21:55:18 [DEBUG] (1) common::initialimpostors: Looking up tile UUID: Named({"asset_hash": Bytes("87a525a3"), "impostor_lod": UInt(5), "region_loc_x": UInt(286720), "region_loc_y": UInt(262144), "grid": Bytes("agni"), "asset_type": Bytes("BaseText..")})
but the "Looked up" message in the code below does not appear. So the crash happened between those two points. That exec_first somehow crashed the program.
The program has already made hundreds of other MySQL requests at this point, so the database connector is connected and running.
No matter what I send to exec_first, this should not happen. The program is compiled with #![forbid(unsafe_code)]
Crate "mysql" version 27, MySQL version 8.0. Dreamhost shared hosting.
Any ideas?
/// Look up a missing UUID in tile_assets.
fn look_up_uuid(conn: &mut PooledConn, key: &UniqueImpostorKey, face_id: usize, asset_hash: &str, asset_type: &str) -> Result<Option<Uuid>, Error> {
const SQL_LOOK_UP_UUID: &str = r"SELECT asset_uuid FROM tile_assets
WHERE grid = :grid
AND region_loc_x = :region_loc_x
AND region_loc_y = :region_loc_y
AND impostor_lod = :impostor_lod
AND asset_hash = :asset_hash
AND asset_type = :asset_type";
let select_params = params! {
"grid" => key.grid.clone(),
"region_loc_x" => key.region_loc_x,
"region_loc_y" => key.region_loc_y,
"impostor_lod" => key.impostor_lod,
"asset_hash" => asset_hash,
"asset_type" => asset_type,
};
// Look up the tile. Hash is part of the key.
log::debug!("Looking up tile UUID: {:?}", select_params);
//////Ok(conn.exec_first(SQL_LOOK_UP_UUID, select_params)?)
let result = conn.exec_first(SQL_LOOK_UP_UUID, select_params);
log::debug!("Looked up tile UUID: {:?}", result);
Ok(result?)
}
2 posts - 1 participant
🏷️ Rust_feed