View Issue Details

IDProjectCategoryView StatusLast Update
0014610FPCDatabasepublic2018-05-17 12:52
ReporterOzz Nixon Assigned ToLacaK  
PrioritynormalSeverityblockReproducibilityalways
Status resolvedResolutionunable to reproduce 
PlatformMAC and LINUXOSLeopard 10.5.7 and Ubuntu 8.04 
Product Version2.2.4 
Summary0014610: ODBC - Freeze (doing open, close, open, <freeze>...)
Description[$] ./test8 sandbox db2inst1 testing
1) Connecting, Connected, Closing, Closed.
2) Connecting, Connected, Closing, <cursor sits here blinking>

-- We are developing a middleware solution for FPC, and originally I though this was an OpenLink issue, however, the problem happens on my Linux boxes too. In this example the problem is happening when calling "Close". In my middleware solution the problem is when calling "TODBCConnection.Open()". If I have a session connect, send credentials to the DB layer and connect, but for error handling I drop the connection before issuing SQL commands, and do it over and over - it dies within 2 or 3 tries. (the code I submit with this fails on second try EVERYTIME - iODBC and unixODBC, to DB2 8.2 and 9.7).
Steps To ReproduceTEST8.PP SOURCE:
Program Test18;

{$IFNDEF LINUX}
   {$IFDEF POWERPC}
      {$DEFINE MAC}
   {$ELSE}
      {$IFDEF DARWIN}
         {$DEFINE MAC}
      {$ELSE}
         {$DEFINE WIN32}
      {$ENDIF}
   {$ENDIF}
{$ENDIF}
{$IFNDEF FPC}
   {$DEFINE DELPHI}
{$ELSE}
   {$MODE DELPHI}{$H+}
{$ENDIF}

{$ASMMODE INTEL}

{$IFDEF FPC}
   {$IFDEF UNIX}
      {$DEFINE FPC_LINUX}
      {$DEFINE FPC_MAC}
      {$DEFINE FPC_UNIX}
   {$ENDIF}
{$ENDIF}

{$DEFINE ODBC}

uses
{$IFDEF ODBC}
   ODBCConn, // ODBC descendant of TSQLConnection {TODBCConnection}
   SQLdb,
{$ENDIF}
   sysutils;

var
{$IFDEF ODBC}
   conn:TODBCConnection; {ODBCConn}
   tmgr:TSQLTransaction; {SQLdb}
   quer:TSQLQuery; {SQLdb}
{$ENDIF}
   Loop:Longint;

begin
   Randomize;
   For Loop:=1 to 10 do begin
      System.Write(Loop,') Connecting, ');
{$IFDEF ODBC}
   conn:=TODBCConnection.Create(Nil);
   conn.LoginPrompt:=False;
   tmgr:=TSQLTransaction.Create(Nil);
   tmgr.Database:=conn;
   quer:=TSQLQuery.Create(Nil);
   quer.Transaction:=tmgr;
   quer.Database:=conn;
   conn.DatabaseName:=paramstr(1);
   conn.UserName:=paramstr(2);
   conn.Password:=paramstr(3);
   conn.Open;
{$ENDIF ODBC}
      System.Write('Connected, Closing, ');
{$IFDEF ODBC}
   conn.Close;
   quer.Free;
   tmgr.Free;
   conn.Free;
{$ENDIF}
      System.Writeln('Closed.');
   end;
end.
Additional InformationODBC TRACE:
[ODBC][14316][__handles.c][444]
        Exit:[SQL_SUCCESS]
            Environment = 0x8118b28
[ODBC][14316][SQLSetEnvAttr.c][182]
        Entry:
            Environment = 0x8118b28
            Attribute = SQL_ATTR_ODBC_VERSION
            Value = 0x3
            StrLen = 0
[ODBC][14316][SQLSetEnvAttr.c][349]
        Exit:[SQL_SUCCESS]
[ODBC][14316][SQLAllocHandle.c][345]
        Entry:
            Handle Type = 2
            Input Handle = 0x8118b28
[ODBC][14316][SQLAllocHandle.c][463]
        Exit:[SQL_SUCCESS]
            Output Handle = 0x8119100
[ODBC][14316][SQLDriverConnect.c][678]
        Entry:
            Connection = 0x8119100
            Window Hdl = (nil)
            Str In = [DSN=sandbox;UID=db2inst1;PWD=********;][length = 38]
            Str Out = 0xb7daab28
            Str Out Max = 1024
            Str Out Ptr = 0xbfb0a89c
            Completion = 0
        UNICODE Using encoding ASCII 'ISO8859-1' and UNICODE 'UCS-2LE'

[ODBC][14316][SQLDriverConnect.c][1487]
        Exit:[SQL_SUCCESS]
            Connection Out [DSN=SANDBOX;UID=db2inst1;PWD=testing;AUTOCOMMIT=1;LOBMAXCOLUMNS...]
[ODBC][14316][SQLDisconnect.c][204]
        Entry:
            Connection = 0x8119100
[ODBC][14316][SQLDisconnect.c][285]
        Exit:[SQL_SUCCESS]
[ODBC][14316][SQLFreeHandle.c][268]
        Entry:
            Handle Type = 2
            Input Handle = 0x8119100
[ODBC][14316][SQLFreeHandle.c][317]
        Exit:[SQL_SUCCESS]
[ODBC][14316][SQLAllocHandle.c][345]
        Entry:
            Handle Type = 2
            Input Handle = 0x8118b28
[ODBC][14316][SQLAllocHandle.c][463]
        Exit:[SQL_SUCCESS]
            Output Handle = 0x8119100
[ODBC][14316][SQLDriverConnect.c][678]
        Entry:
            Connection = 0x8119100
            Window Hdl = (nil)
            Str In = [DSN=sandbox;UID=db2inst1;PWD=********;][length = 38]
            Str Out = 0xb7daa9f8
            Str Out Max = 1024
            Str Out Ptr = 0xbfb0a89c
            Completion = 0
[ODBC][14316][SQLDriverConnect.c][826]
        Exit:[SQL_SUCCESS]
[ODBC][14316][SQLDisconnect.c][204]
        Entry:
            Connection = 0x8119100
[ODBC][14316][SQLDisconnect.c][263]
        Exit:[SQL_SUCCESS]
[ODBC][14316][SQLFreeHandle.c][268]
        Entry:
            Handle Type = 2
            Input Handle = 0x8119100
TagsNo tags attached.
Fixed in Revision
FPCOldBugId0
FPCTarget
Attached Files

Activities

Ozz Nixon

2009-09-16 15:48

reporter   ~0030775

More experimenting finds this only fails if the odbcinst.ini:

[odbc]
Pooling = Yes

when
[odbc]
Pooling = No

The problem does not happen, so the implementation is not calling something that treading is expecting/needing.

Felipe Monteiro de Carvalho

2010-07-21 09:55

developer   ~0039542

Please provide a minimal compilable example with database (if necessary).

Marco van de Voort

2011-10-01 14:30

manager   ~0052324

Last edited: 2011-10-01 14:30

Seems there is a minimal program in additional notes. All you need is a Windows system with odbc I guess.

Could sb try to reproduce this please ?

LacaK

2015-06-24 10:32

developer   ~0084696

Can't reproduce with ODBC driver 11 for SQL Server under Windows 8

LacaK

2015-06-24 10:34

developer  

test14610.pas (1,390 bytes)

LacaK

2018-05-17 12:52

developer   ~0108368

Please retest and reopen if issue persists.

Issue History

Date Modified Username Field Change
2009-09-16 15:19 Ozz Nixon New Issue
2009-09-16 15:48 Ozz Nixon Note Added: 0030775
2009-09-16 16:02 Jonas Maebe FPCOldBugId => 0
2009-09-16 16:02 Jonas Maebe Category RTL => Database Components
2009-09-16 16:02 Jonas Maebe Additional Information Updated
2009-09-16 16:02 Jonas Maebe Status new => assigned
2009-09-16 16:02 Jonas Maebe Assigned To => Joost van der Sluis
2010-07-21 09:55 Felipe Monteiro de Carvalho Note Added: 0039542
2010-07-21 09:55 Felipe Monteiro de Carvalho Status assigned => feedback
2011-10-01 14:30 Marco van de Voort Note Added: 0052324
2011-10-01 14:30 Marco van de Voort Note Edited: 0052324
2015-06-24 10:32 LacaK Note Added: 0084696
2015-06-24 10:34 LacaK File Added: test14610.pas
2018-05-17 12:52 LacaK Note Added: 0108368
2018-05-17 12:52 LacaK Status feedback => resolved
2018-05-17 12:52 LacaK Resolution open => unable to reproduce
2018-05-17 12:52 LacaK Assigned To Joost van der Sluis => LacaK