문제

IBM Informix 드라이버를 사용하는 응용 프로그램이 있습니다. 우리가 연결을 병렬로 열려고 할 때마다, 우리는 정말 이상한 오류를 얻기 시작합니다.

이것은 내가 생각할 수있는 가장 작은 재생산 코드입니다.

const int Count = 10;
const string ConnectionString = "Host=the_host;Service=the_service;Server=the_server;Database=the_database;User ID=the_user_id;Password=the_password";

static void Main()
{
    var threads = new Thread[Count];
    for (var i = 0; i < threads.Length; i++)
    {
        threads[i] = new Thread(
            number =>
            {
                using (var conn = new IfxConnection(ConnectionString))
                {
                    Console.WriteLine("Opening connection {0}... ", number);
                    try
                    {
                        conn.Open();
                        Console.WriteLine("Opened connection {0}", number);
                        var setLockCommand = conn.CreateCommand();
                        setLockCommand.CommandText = "set lock mode to wait 10;";
                        setLockCommand.ExecuteNonQuery();
                        Console.WriteLine("Releasing connection {0}", number);
                    }
                    catch (IfxException ex)
                    {
                        Console.WriteLine("Failed opening connection {0}: {1}", number, ex);
                    }
                }
            });
        threads[i].Start(i);
    }
    foreach (var thread in threads)
        thread.Join();
}

우리가 실행하는 기계에 따라 우리는 Count 실패로 만드는 값이지만 10은 일관되게 오류를 재현하는 것 같습니다.

물론 이것은 생산 코드도 아니고 스레딩을 처리하는 방법이 아니지만 다른 변수를 도입하지 않고 문제를 강조합니다.

이것은 예외 스택 추적입니다.

IBM.Data.Informix.IfxException: ERROR [HY000] [Informix .NET provider]General error.
   at IBM.Data.Informix.IfxConnection.GetConnectAttr(SQL_ATTR attribute, HANDLER handler)
   at IBM.Data.Informix.IfxConnection.ConnectionIsAlive()
   at IBM.Data.Informix.IfxConnectionPool.BindNodeToConnection(IfxConnPoolNode poolNode, IfxConnection connection, ConnectionPoolType ConnPoolType)
   at IBM.Data.Informix.IfxConnectionPool.Open(IfxConnection connection)
   at IBM.Data.Informix.IfxConnPoolManager.Open(IfxConnection connection)
   at IBM.Data.Informix.IfxConnection.Open()

ibm.data.informix.dll 버전은 3.00.06000.2입니다.

이것은 Windows 7 (32 및 64 비트) 및 2008 (64 비트)에서 테스트되었습니다.

도움이 되었습니까?

해결책

연결 문자열에 "풀링 = 거짓"을 추가 하여이 문제를 해결했습니다.

const string ConnectionString = "Host=the_host;Service=the_service;Server=the_server;Database=the_database;User ID=the_user_id;Password=the_password;Pooling=false";

다른 팁

나는 이것에 대해 내부적으로 물었고 IBM Informix ClientsDK .NET 제공 업체에 대한 다음 피드백을 받았습니다.

  1. Windows XP 32 비트 개발 기계 에서이 문제는 재현 할 수 없습니다.
  2. 사용자/고객은 Windows 7에서 애플리케이션을 실행하려고합니다. CSDK 3.00은 Windows 7에서 인증되지 않았습니다.
  3. 고객은 최신 버전 인 CSDK 3.50.TC6 (32 비트) 또는 3.50.FC6 (64 비트)로 업그레이드해야합니다. 그건 지원. CSDK 3.50.xc5 및 이전 수정 팩은 Windows 7을 지원하지 않습니다.

Informix.net 제공 업체는 CSDK .NET 제공 업체라고도합니다. 여전히 대부분의 IDS 고객이 사용하는 선호 .NET 제공 업체입니다. CSDK .NET 제공 업체가 사용하는 SQLI 프로토콜 대신 DB2와 DRDA 프로토콜을 사용하는 ID뿐만 아니라 DB2와 함께 작동하는 '최신'IBM Common.net 제공자 (DB2와 함께 작동)는 미래 전략이지만 실제로는 Common을 사용하는 고객은 거의 없습니다. IDS 애플리케이션 개발에 대한 NET.


답을 개발하지 않았기 때문에 커뮤니티 위키를 만들었습니다.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top