Using context.WithCancel a call to the cancel func should interrupt the running operation (code snippet below).
ctx, cancel := context.WithCancel(context.Background())
go func () {
fmt.Println(db.ExecContext(ctx, "begin for i in 1..120 loop dbms_lock.sleep(1); end loop; end;"))
}()
go func() {
time.Sleep(1 * time.Second)
cancel()
}()
To get it work i disable Urgent-Data-Transport (OOB) because sendOOB on windows is empty. Furthermore oracle-jdbc-driver and nodejs-thin-driver in my debug cases only (can) send marker packets.
The main challenge is the race conidtion between the running operation (read) and another concurrent read from BreakConnection. That's why i simplify the code with returning an error instead of reading the ORA-01013 packet.
Using
context.WithCancel
a call to thecancel
func should interrupt the running operation (code snippet below).To get it work i disable Urgent-Data-Transport (OOB) because
sendOOB
on windows is empty. Furthermore oracle-jdbc-driver and nodejs-thin-driver in my debug cases only (can) send marker packets.The main challenge is the race conidtion between the running operation (
read
) and another concurrentread
from BreakConnection. That's why i simplify the code with returning an error instead of reading the ORA-01013 packet.