Try to fix some pthread problems detected on NetBSD 4.0_STABLE
(and may be later). * When connecting a SQL server, isql crashed. isql: Error detected by libpthread: Unlocking unlocked mutex. * Setting "Threding = 0" in odbcinst.ini, isql crashed when closing connection to a SQL server. isql: Error detected by libpthread: Destroying locked mutex. I've checked mutex handling and created patches. Bump PKGREVISION.
This commit is contained in:
parent
6709dfd505
commit
c0c823f8bc
8 changed files with 154 additions and 3 deletions
|
@ -1,8 +1,8 @@
|
|||
# $NetBSD: Makefile,v 1.25 2009/10/19 08:37:39 taca Exp $
|
||||
# $NetBSD: Makefile,v 1.26 2009/10/21 04:21:27 taca Exp $
|
||||
|
||||
DISTNAME= unixODBC-2.2.14
|
||||
PKGNAME= ${DISTNAME:S/ODBC/odbc/}
|
||||
PKGREVISION= 1
|
||||
PKGREVISION= 2
|
||||
CATEGORIES= databases
|
||||
MASTER_SITES= http://www.unixodbc.org/
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
$NetBSD: distinfo,v 1.8 2009/10/19 08:37:39 taca Exp $
|
||||
$NetBSD: distinfo,v 1.9 2009/10/21 04:21:27 taca Exp $
|
||||
|
||||
SHA1 (unixODBC-2.2.14.tar.gz) = ab18464c83d30d7b38b8bb58e1dd01e3ec211488
|
||||
RMD160 (unixODBC-2.2.14.tar.gz) = e2a2d2de636a8b2ee1002cac809ba2a38d7eb4de
|
||||
|
@ -6,3 +6,9 @@ Size (unixODBC-2.2.14.tar.gz) = 2189755 bytes
|
|||
SHA1 (patch-aa) = db3b99dc6afe4263c41423ef276dba8c98a55877
|
||||
SHA1 (patch-ab) = 7a35dcbc76b7d8b6b50bb1685180874f70c51141
|
||||
SHA1 (patch-ac) = 2e754242b2a1c90fb07e4cabb0bd537fd8eeb1a2
|
||||
SHA1 (patch-ad) = b2e695d8c8c682c99af80e362369b0295070c1ab
|
||||
SHA1 (patch-ae) = 0d54c7fe9b42a5b5eb2f8c31176a30a7fb49d183
|
||||
SHA1 (patch-af) = e011c95867a10ae52a9362d0ebdf2fcdc2a92f8a
|
||||
SHA1 (patch-ag) = 1be22add8724176cf97c2e7c78fc069638c3c386
|
||||
SHA1 (patch-ah) = 56d19fa526867fe4bb7462d8a4b25cb580cdff2d
|
||||
SHA1 (patch-ai) = 9b147d7a751b10795b5685249c7d8430dcf15936
|
||||
|
|
26
databases/unixodbc/patches/patch-ad
Normal file
26
databases/unixodbc/patches/patch-ad
Normal file
|
@ -0,0 +1,26 @@
|
|||
$NetBSD: patch-ad,v 1.1 2009/10/21 04:21:27 taca Exp $
|
||||
|
||||
* Call function_return with IGNORE_THREAD to prevent calling
|
||||
thread_release() since thread_protect() isn't called this "default:"
|
||||
case .
|
||||
|
||||
--- DriverManager/SQLAllocHandle.c.orig 2007-12-17 22:13:03.000000000 +0900
|
||||
+++ DriverManager/SQLAllocHandle.c
|
||||
@@ -1244,7 +1244,7 @@ SQLRETURN __SQLAllocHandle( SQLSMALLINT
|
||||
ERROR_HY092, NULL,
|
||||
environment -> requested_version );
|
||||
|
||||
- return function_return( SQL_HANDLE_ENV, environment, SQL_ERROR );
|
||||
+ return function_return( IGNORE_THREAD, environment, SQL_ERROR );
|
||||
}
|
||||
else if ( __validate_dbc( (DMHDBC) input_handle ))
|
||||
{
|
||||
@@ -1253,7 +1253,7 @@ SQLRETURN __SQLAllocHandle( SQLSMALLINT
|
||||
ERROR_HY092, NULL,
|
||||
connection -> environment -> requested_version );
|
||||
|
||||
- return function_return( SQL_HANDLE_DBC, connection, SQL_ERROR );
|
||||
+ return function_return( IGNORE_THREAD, connection, SQL_ERROR );
|
||||
}
|
||||
else
|
||||
{
|
21
databases/unixodbc/patches/patch-ae
Normal file
21
databases/unixodbc/patches/patch-ae
Normal file
|
@ -0,0 +1,21 @@
|
|||
$NetBSD: patch-ae,v 1.1 2009/10/21 04:21:27 taca Exp $
|
||||
|
||||
* Avoid to call call __SQLGetInfo() twice since __SQLGetInfo() calls
|
||||
thread_release() internally and it cause unlocking unlocked mutex.
|
||||
|
||||
--- DriverManager/SQLConnect.c.orig 2008-09-29 23:02:43.000000000 +0900
|
||||
+++ DriverManager/SQLConnect.c
|
||||
@@ -2086,11 +2086,13 @@ int __connect_part_two( DMHDBC connectio
|
||||
char txt[ 20 ];
|
||||
SQLRETURN ret;
|
||||
|
||||
+#if 0
|
||||
ret = __SQLGetInfo( connection,
|
||||
SQL_DRIVER_ODBC_VER,
|
||||
txt,
|
||||
sizeof( txt ),
|
||||
NULL );
|
||||
+#endif
|
||||
|
||||
if ( SQL_SUCCEEDED( ret ))
|
||||
{
|
42
databases/unixodbc/patches/patch-af
Normal file
42
databases/unixodbc/patches/patch-af
Normal file
|
@ -0,0 +1,42 @@
|
|||
$NetBSD: patch-af,v 1.1 2009/10/21 04:21:27 taca Exp $
|
||||
|
||||
* Call function_return() with IGNORE_THREAD after calling thread_release().
|
||||
|
||||
--- DriverManager/SQLFreeHandle.c.orig 2007-12-17 22:13:03.000000000 +0900
|
||||
+++ DriverManager/SQLFreeHandle.c
|
||||
@@ -234,7 +234,7 @@ SQLRETURN __SQLFreeHandle( SQLSMALLINT h
|
||||
|
||||
thread_release( SQL_HANDLE_ENV, environment );
|
||||
|
||||
- return function_return( SQL_HANDLE_ENV, environment, SQL_ERROR );
|
||||
+ return function_return( IGNORE_THREAD, environment, SQL_ERROR );
|
||||
}
|
||||
|
||||
thread_release( SQL_HANDLE_ENV, environment );
|
||||
@@ -301,7 +301,7 @@ SQLRETURN __SQLFreeHandle( SQLSMALLINT h
|
||||
|
||||
thread_release( SQL_HANDLE_ENV, environment );
|
||||
|
||||
- return function_return( SQL_HANDLE_ENV, environment, SQL_ERROR );
|
||||
+ return function_return( IGNORE_THREAD, environment, SQL_ERROR );
|
||||
}
|
||||
|
||||
environment -> connection_count --;
|
||||
@@ -404,7 +404,7 @@ SQLRETURN __SQLFreeHandle( SQLSMALLINT h
|
||||
|
||||
thread_release( SQL_HANDLE_STMT, statement );
|
||||
|
||||
- return function_return( SQL_HANDLE_STMT, statement, SQL_ERROR );
|
||||
+ return function_return( IGNORE_THREAD, statement, SQL_ERROR );
|
||||
}
|
||||
|
||||
if ( !CHECK_SQLFREEHANDLE( statement -> connection ))
|
||||
@@ -551,7 +551,7 @@ SQLRETURN __SQLFreeHandle( SQLSMALLINT h
|
||||
|
||||
thread_release( SQL_HANDLE_DESC, descriptor );
|
||||
|
||||
- return function_return( SQL_HANDLE_DESC, descriptor, SQL_ERROR );
|
||||
+ return function_return( IGNORE_THREAD, descriptor, SQL_ERROR );
|
||||
}
|
||||
else
|
||||
{
|
14
databases/unixodbc/patches/patch-ag
Normal file
14
databases/unixodbc/patches/patch-ag
Normal file
|
@ -0,0 +1,14 @@
|
|||
$NetBSD: patch-ag,v 1.1 2009/10/21 04:21:27 taca Exp $
|
||||
|
||||
* Call function_return() with IGNORE_THREAD since __SQLGetInfo() is already
|
||||
called and __SQLGetInfo() calls function_return().
|
||||
|
||||
--- DriverManager/SQLGetInfo.c.orig 2008-09-29 23:02:45.000000000 +0900
|
||||
+++ DriverManager/SQLGetInfo.c
|
||||
@@ -611,5 +611,5 @@ SQLRETURN SQLGetInfo( SQLHDBC connection
|
||||
connection -> msg );
|
||||
}
|
||||
|
||||
- return function_return( SQL_HANDLE_DBC, connection, ret );
|
||||
+ return function_return( IGNORE_THREAD, connection, ret );
|
||||
}
|
24
databases/unixodbc/patches/patch-ah
Normal file
24
databases/unixodbc/patches/patch-ah
Normal file
|
@ -0,0 +1,24 @@
|
|||
$NetBSD: patch-ah,v 1.1 2009/10/21 04:21:27 taca Exp $
|
||||
|
||||
* Call function_return() with IGNORE_THREAD after calling thread_release().
|
||||
|
||||
--- DriverManager/SQLTransact.c.orig 2007-08-30 21:54:17.000000000 +0900
|
||||
+++ DriverManager/SQLTransact.c
|
||||
@@ -439,7 +439,7 @@ SQLRETURN SQLTransact( SQLHENV environme
|
||||
|
||||
thread_release( SQL_HANDLE_ENV, environment );
|
||||
|
||||
- return function_return( SQL_HANDLE_ENV, environment, SQL_ERROR );
|
||||
+ return function_return( IGNORE_THREAD, environment, SQL_ERROR );
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -474,7 +474,7 @@ SQLRETURN SQLTransact( SQLHENV environme
|
||||
|
||||
thread_release( SQL_HANDLE_ENV, environment );
|
||||
|
||||
- return function_return( SQL_HANDLE_ENV, environment, SQL_ERROR );
|
||||
+ return function_return( IGNORE_THREAD, environment, SQL_ERROR );
|
||||
}
|
||||
}
|
||||
else if ( CHECK_SQLENDTRAN( connection ))
|
18
databases/unixodbc/patches/patch-ai
Normal file
18
databases/unixodbc/patches/patch-ai
Normal file
|
@ -0,0 +1,18 @@
|
|||
$NetBSD: patch-ai,v 1.1 2009/10/21 04:21:27 taca Exp $
|
||||
|
||||
* Release connection->mutex before destroy it when
|
||||
connection->protection_level isn't TS_LEVEL3 since it causes destroying
|
||||
locked mutex when explicitly specifies "Threading" parameter in
|
||||
odbcinst.ini. I don't know the case using LIBTHREAD.
|
||||
|
||||
--- DriverManager/__handles.c.orig 2009-10-20 16:47:04.000000000 +0900
|
||||
+++ DriverManager/__handles.c
|
||||
@@ -737,6 +737,8 @@ void __release_dbc( DMHDBC connection )
|
||||
|
||||
#ifdef HAVE_LIBPTH
|
||||
#elif HAVE_LIBPTHREAD
|
||||
+ if ( connection -> protection_level != TS_LEVEL3)
|
||||
+ mutex_exit( &connection -> mutex );
|
||||
pthread_mutex_destroy( &connection -> mutex );
|
||||
#elif HAVE_LIBTHREAD
|
||||
mutex_destroy( &connection -> mutex );
|
Loading…
Reference in a new issue