rust-oracle icon indicating copy to clipboard operation
rust-oracle copied to clipboard

segfault

Open manio opened this issue 4 years ago • 0 comments

Hi! I want to share what I found out with today's debugging. I am preparing a simple rust program with http server. In the beginning I am creating an "global" oracle connection and wrap it into: Arc<Mutex<oracle::Connection>>

then on every async http request I am doing this sample code:

[...]
let conn = odata.lock()?
let sql = "begin erp.my_pkg.convert(:1, :2, :3, to_date(:4, 'YYYY-MM-DD HH24:MI:SS'), :5, NULL, :6, :7, :8, :9); end;";
let mut stmt = conn.prepare(sql, &[])?;
stmt.execute(&[&id, &arg2, &id_rec, &datetime, &reader_no, &id_loc, &mode, &search, &OracleType::Varchar2(32767)])?;
let out_id: i32 = stmt.bind_value(1).unwrap_or(-1);
let outval: String = stmt.bind_value(9).unwrap_or_default();
conn.commit()?;

This is working great, but when our dba intentionally close the session on the server side to test my program then my program suddenly stops with: tokio-runtime-w[2998]: segfault at 10 ip 000055c31cfc9ade sp 00007fdcac660d00 error 4 in injector[55c31ce47000+4c7000]

so it is segfaulting without any panic()

Then I did some research and the offset in which it segfaults is: a

So it is inside dpiGen__setRefCount(), which we can see eg here: https://github.com/oracle/odpi/blob/master/src/dpiGen.c#L265

Maybe you are able to reproduce it? It is a little hard for me to reproduce as I am not the owner of this oracle server... Do you think it is a rust-oracle bug? Can you report it upstream in other case? I think something is wrong because instead of rust panic it is just segfaulting...

manio avatar Jan 21 '21 12:01 manio