Menu

#4 OTL/ODBC (Informix) segfaults in commits

open
nobody
None
5
2004-05-04
2004-05-04
No

I am using OTL 4.0.82 with unixODBC 2.2.5 (ANSI) and
Informix's ODBC driver 2.81 (UC3) under Linux 2.4.18.
Sometimes when calling commit() on an OTL connection
the application segfaults and I get the following stack
trace:

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 311316 (LWP 9831)]
0x401f3be6 in SQLEndTran (handle_type=1,
handle=0x8128db0, completion_type=0) at
SQLEndTran.c:433
433 if ( statement -> connection ==
connection )
Current language: auto; currently c
(gdb) bt
#0 0x401f3be6 in SQLEndTran (handle_type=1,
handle=0x8128db0, completion_type=0) at
SQLEndTran.c:433
#1 0x080ac839 in
hl7::SPM_Proc_Authorization_Handler::log_response()
(this=0x81f6aa8) at otlv4.h:8950
#2 0x0808fd86 in
hl7::SPM_Backend_Handler::handle_request(HL7_Message_Struct*,
HL7_Message_Struct*, bool&) (this=0x81f6aa8,
hl7_response=0x1,
hl7_request=0x812b59c) at
spm/spm_backend_handler.cpp:86
[stack trace continues...]

Apparently the application is segfaulting in the
SQLEndTran() function called from otl_conn::commit()
in line 8950, which says:

#if (ODBCVER >= 0x0300)
status=SQLEndTran(SQL_HANDLE_DBC,hdbc,SQL_COMMIT);
#else
status=SQLTransact(henv,hdbc,SQL_COMMIT);
#endif

The code that is invoking the otl_conn::commit()
method is similar to:

int
SPM_Proc_Authorization_Handler::log_response( void )
{
static const char QUERY_LOG_PROCEDURE[] =
"INSERT INTO "
"PRACTICA ( ID_TRANSACCION,
NUMERO_PRACTICA, "
"TIPO_ID_PRACTICA, ID_PRACTICA, "
"CANTIDAD_TRATAMIENTOS,
FECHA_AUTORIZACION, "
"COPAGO, CODIGO_RESPUESTA,
NECESITA_AUTH ) "
"VALUES
( :id_transaccion<long>, :numero_practica<int>, "
":tipo_id_practica<char[3]>, :id_practica<char[11]>,
"
":cantidad_tratamientos<int>, :fecha_autorizacion<timestamp>,
"
":copago<char[19]>, :codigo_respuesta<char[7]>,
"
":necesita_autorizacion<char[2]> )";

bool success = true;

{
this->spm_db_->auto_commit_off();

// This function inserts a row in another table.
if ( SPM_Eligibility_Handler::log_response() == 0 )
{
// Several variable definitions, including
procedure_count
// [...]
otl_stream query( 1, QUERY_LOG_PROCEDURE,
*this->spm_db_ );
int i;

for ( i = 0; i < procedure_count; i++ )
{
// Insert values into query

success = success && ( query.get_rpc() >
0 );
}
this->spm_db_->commit();
}
else
{
this->spm_db_->rollback();
success = false;
}

this->spm_db_->auto_commit_on();
}
catch ( otl_exception & )
{
this->spm_db_->rollback();
this->spm_db_->auto_commit_on();

throw;
}
return ( success ? 0 : -1 );
}

Does anybody have any idea of what may be triggering
this error? I still haven't been able to identify its cause.

Discussion


Log in to post a comment.