X-Original-To: pgsql-odbc-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id B09F99DCC1A for ; Fri, 9 Dec 2005 03:24:06 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 13461-05 for ; Fri, 9 Dec 2005 03:24:06 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from gate.solvo.ru (gate.solvo.ru [195.201.44.254]) by postgresql.org (Postfix) with ESMTP id B03599DCC02 for ; Fri, 9 Dec 2005 03:24:03 -0400 (AST) Received: from tiger.solvo.ru (tiger.solvo.ru [195.201.44.86]) by gate.solvo.ru (8.12.8/8.12.8) with ESMTP id jB97O0pv009116 for ; Fri, 9 Dec 2005 10:24:02 +0300 Received: by tiger.solvo.ru (Postfix, from userid 504) id A09D732689C; Fri, 9 Dec 2005 10:23:54 +0300 (MSK) Received: from crown (dual.solvo.ru [195.201.44.111]) by tiger.solvo.ru (Postfix) with ESMTP id 2F70832689F for ; Fri, 9 Dec 2005 10:23:54 +0300 (MSK) From: "Eugene Fokin" To: Subject: My patch for #1000475 SEGFAULT during SQLCancel Date: Fri, 9 Dec 2005 10:24:30 +0300 Message-ID: <002501c5fc91$9883a930$dd2cc9c3@solvo.ru> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="----=_NextPart_000_0026_01C5FCAA.BDD0E130" X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook, Build 10.0.4024 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1506 Importance: Normal X-Milter: Spamilter X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.4 required=5 tests=[AWL=0.399, HTML_MESSAGE=0.001] X-Spam-Score: 0.4 X-Spam-Level: X-Archive-Number: 200512/104 X-Sequence-Number: 6583 This is a multi-part message in MIME format. ------=_NextPart_000_0026_01C5FCAA.BDD0E130 Content-Type: multipart/alternative; boundary="----=_NextPart_001_0027_01C5FCAA.BDD0E130" ------=_NextPart_001_0027_01C5FCAA.BDD0E130 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Hi. Here is patch I've used to resolve this seg.fault for 08.01.0102 version. Regards. -- Eugene Fokin SOLVO Ltd. ------=_NextPart_001_0027_01C5FCAA.BDD0E130 Content-Type: text/html; charset="us-ascii" Content-Transfer-Encoding: quoted-printable

Hi.

 

Here is patch I’ve used to resolve this = seg.fault for 08.01.0102 version.

 

Regards.

 

--

Eugene Fokin

SOLVO Ltd.

 

------=_NextPart_001_0027_01C5FCAA.BDD0E130-- ------=_NextPart_000_0026_01C5FCAA.BDD0E130 Content-Type: application/octet-stream; name="cancel.seg.patch" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="cancel.seg.patch" diff -uNr psqlodbc-08.01.0102/execute.c psqlodbc-08.01.0102-1/execute.c=0A= --- psqlodbc-08.01.0102/execute.c 2005-12-01 12:03:54.000000000 +0300=0A= +++ psqlodbc-08.01.0102-1/execute.c 2005-12-09 10:06:15.000000000 +0300=0A= @@ -720,6 +720,7 @@=0A= * the application.=0A= */=0A= =0A= + ENTER_STMT_CS_CANCEL(stmt);=0A= #ifdef WIN32=0A= if (ci->drivers.cancel_as_freestmt)=0A= {=0A= @@ -732,6 +733,7 @@=0A= #else=0A= result =3D PGAPI_FreeStmt(hstmt, SQL_CLOSE);=0A= #endif=0A= + LEAVE_STMT_CS_CANCEL(stmt);=0A= =0A= mylog("PGAPI_Cancel: PGAPI_FreeStmt returned %d\n", result);=0A= =0A= diff -uNr psqlodbc-08.01.0102/odbcapi30.c = psqlodbc-08.01.0102-1/odbcapi30.c=0A= --- psqlodbc-08.01.0102/odbcapi30.c 2005-10-20 17:06:10.000000000 +0400=0A= +++ psqlodbc-08.01.0102-1/odbcapi30.c 2005-12-09 10:06:58.000000000 +0300=0A= @@ -173,6 +173,7 @@=0A= =0A= mylog("[[%s]] %d,%d\n", func, FetchOrientation, FetchOffset);=0A= ENTER_STMT_CS(stmt);=0A= + ENTER_STMT_CS_CANCEL(stmt);=0A= SC_clear_error(stmt);=0A= if (FetchOrientation =3D=3D SQL_FETCH_BOOKMARK)=0A= {=0A= @@ -197,6 +198,7 @@=0A= pcRow, rowStatusArray, bkmarkoff, opts->size_of_rowset);=0A= stmt->transition_status =3D 6;=0A= }=0A= + LEAVE_STMT_CS_CANCEL(stmt);=0A= LEAVE_STMT_CS(stmt);=0A= if (ret !=3D SQL_SUCCESS)=0A= mylog("%s return =3D %d\n", func, ret);=0A= diff -uNr psqlodbc-08.01.0102/odbcapi.c psqlodbc-08.01.0102-1/odbcapi.c=0A= --- psqlodbc-08.01.0102/odbcapi.c 2005-10-20 17:06:10.000000000 +0400=0A= +++ psqlodbc-08.01.0102-1/odbcapi.c 2005-12-09 10:07:52.000000000 +0300=0A= @@ -328,6 +328,7 @@=0A= StatementClass *stmt =3D (StatementClass *) StatementHandle;=0A= =0A= ENTER_STMT_CS(stmt);=0A= + ENTER_STMT_CS_CANCEL(stmt);=0A= SC_clear_error(stmt);=0A= if (SC_get_conn(stmt)->driver_version >=3D 0x0300)=0A= {=0A= @@ -346,6 +347,7 @@=0A= mylog("[%s]", func);=0A= ret =3D PGAPI_Fetch(StatementHandle);=0A= }=0A= + LEAVE_STMT_CS_CANCEL(stmt);=0A= LEAVE_STMT_CS(stmt);=0A= return ret;=0A= }=0A= @@ -864,9 +866,11 @@=0A= =0A= mylog("[SQLExtendedFetch]");=0A= ENTER_STMT_CS(stmt);=0A= + ENTER_STMT_CS_CANCEL(stmt);=0A= SC_clear_error(stmt);=0A= ret =3D PGAPI_ExtendedFetch(hstmt, fFetchType, irow, pcrow, = rgfRowStatus, 0, SC_get_ARDF(stmt)->size_of_rowset_odbc2);=0A= stmt->transition_status =3D 7;=0A= + LEAVE_STMT_CS_CANCEL(stmt);=0A= LEAVE_STMT_CS(stmt);=0A= return ret;=0A= }=0A= diff -uNr psqlodbc-08.01.0102/statement.c = psqlodbc-08.01.0102-1/statement.c=0A= --- psqlodbc-08.01.0102/statement.c 2005-12-01 12:03:55.000000000 +0300=0A= +++ psqlodbc-08.01.0102-1/statement.c 2005-12-09 10:08:19.000000000 +0300=0A= @@ -316,6 +316,7 @@=0A= GetDataInfoInitialize(SC_get_GDTI(rv));=0A= PutDataInfoInitialize(SC_get_PDTI(rv));=0A= INIT_STMT_CS(rv);=0A= + INIT_STMT_CS_CANCEL(rv);=0A= }=0A= return rv;=0A= }=0A= @@ -373,6 +374,7 @@=0A= GDATA_unbind_cols(SC_get_GDTI(self), TRUE);=0A= =0A= DELETE_STMT_CS(self);=0A= + DELETE_STMT_CS_CANCEL(self);=0A= if (self->pdata_info.pdata !=3D 0)=0A= free(self->pdata_info.pdata);=0A= free(self);=0A= diff -uNr psqlodbc-08.01.0102/statement.h = psqlodbc-08.01.0102-1/statement.h=0A= --- psqlodbc-08.01.0102/statement.h 2005-10-31 22:57:06.000000000 +0300=0A= +++ psqlodbc-08.01.0102-1/statement.h 2005-12-09 10:12:19.000000000 +0300=0A= @@ -224,8 +224,10 @@=0A= NeedDataCallback *callbacks;=0A= #if defined(WIN_MULTITHREAD_SUPPORT)=0A= CRITICAL_SECTION cs;=0A= + CRITICAL_SECTION csc; /* CS for CANCEL */=0A= #elif defined(POSIX_THREADMUTEX_SUPPORT)=0A= pthread_mutex_t cs;=0A= + pthread_mutex_t csc; /* CS for CANCEL */=0A= #endif /* WIN_MULTITHREAD_SUPPORT */=0A= =0A= };=0A= @@ -293,16 +295,28 @@=0A= #define ENTER_STMT_CS(x) EnterCriticalSection(&((x)->cs))=0A= #define LEAVE_STMT_CS(x) LeaveCriticalSection(&((x)->cs))=0A= #define DELETE_STMT_CS(x) DeleteCriticalSection(&((x)->cs))=0A= +#define INIT_STMT_CS_CANCEL(x) InitializeCriticalSection(&((x)->csc))=0A= +#define ENTER_STMT_CS_CANCEL(x) EnterCriticalSection(&((x)->csc))=0A= +#define LEAVE_STMT_CS_CANCEL(x) LeaveCriticalSection(&((x)->csc))=0A= +#define DELETE_STMT_CS_CANCEL(x) DeleteCriticalSection(&((x)->csc))=0A= #elif defined(POSIX_THREADMUTEX_SUPPORT)=0A= #define INIT_STMT_CS(x) pthread_mutex_init(&((x)->cs),0)=0A= #define ENTER_STMT_CS(x) pthread_mutex_lock(&((x)->cs))=0A= #define LEAVE_STMT_CS(x) pthread_mutex_unlock(&((x)->cs))=0A= #define DELETE_STMT_CS(x) pthread_mutex_destroy(&((x)->cs))=0A= +#define INIT_STMT_CS_CANCEL(x) pthread_mutex_init(&((x)->csc),0)=0A= +#define ENTER_STMT_CS_CANCEL(x) pthread_mutex_lock(&((x)->csc))=0A= +#define LEAVE_STMT_CS_CANCEL(x) pthread_mutex_unlock(&((x)->csc))=0A= +#define DELETE_STMT_CS_CANCEL(x) pthread_mutex_destroy(&((x)->csc))=0A= #else=0A= #define INIT_STMT_CS(x)=0A= #define ENTER_STMT_CS(x) ((void)(0))=0A= #define LEAVE_STMT_CS(x) ((void)(0))=0A= #define DELETE_STMT_CS(x)=0A= +#define INIT_STMT_CS_CANCEL(x)=0A= +#define ENTER_STMT_CS_CANCEL(x)=0A= +#define LEAVE_STMT_CS_CANCEL(x)=0A= +#define DELETE_STMT_CS_CANCEL(x)=0A= #endif /* WIN_MULTITHREAD_SUPPORT */=0A= /* Statement prototypes */=0A= StatementClass *SC_Constructor(void);=0A= ------=_NextPart_000_0026_01C5FCAA.BDD0E130--