Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Invalid statement handle [CORE4972] #5263

Closed
firebird-automations opened this issue Oct 22, 2015 · 14 comments
Closed

Invalid statement handle [CORE4972] #5263

firebird-automations opened this issue Oct 22, 2015 · 14 comments

Comments

@firebird-automations
Copy link
Collaborator

Submitted by: Tim Kelly (m00bh000)

Attachments:
TESTCORE4972.zip
TESTCORE4972.zip

Error: "invalid statement handle"

I have recently updated to a recent snapshot (2015-10-21). Since then I keep getting apparently random error messages when executing SQL statements.

I am using snapshot of 21/10/15. (server x64 win, client x32 win), Delphi IBX components.

[09:12:02] (Error)-> Error executing SQL: <INSERT INTO SOS_BASE_PERSISTENT_OBJEC
T (OID, DELETED, CREATED, UPDATED, SMART_CLASS_OID, IMPORT_KEY) VALUES (:OID, :D
ELETED, :CREATED, :UPDATED, :SMART_CLASS_OID, :IMPORT_KEY)>invalid statement handle

Not quite sure when this problem was introduced but it wasn't present about 6 months ago in version 3.

I think this statement would have been executed previously during a different transaction. It would have been executed a second time with different parameters following a transaction->commit, transaction->begin. My software has been stable for about 10 years so i am pretty sure it's not something I have introduced.

I also have started receiving:

SQL error code = -502
Invalid cursor declaration
Statement already has a cursor {612A1D09-A255-4781-8DF1-54B24A9C4B3E} assigned
[09:18:51] (Error)-> Request generated error: Dynamic SQL Error

I suspect this is a secondary error as I always get the invalid statement handle first.

Commits: 31ff3b0 FirebirdSQL/fbt-repository@a771a1b

@firebird-automations
Copy link
Collaborator Author

Commented by: Tim Kelly (m00bh000)

WI-V3.0.0.32076 Does not contain this bug

Not sure about versions in-between, don't have them.

@firebird-automations
Copy link
Collaborator Author

Commented by: Tim Kelly (m00bh000)

Ensure you rename fbclient.dll to gds32.dll and place is correct folder
If run in debugger be sure to make sure current path only contains one possible gds32.dll. (32bit version) or you will have trouble getting it to use the right file!

@firebird-automations
Copy link
Collaborator Author

Modified by: Tim Kelly (m00bh000)

Attachment: TESTCORE4972.zip [ 12825 ]

@firebird-automations
Copy link
Collaborator Author

Commented by: Tim Kelly (m00bh000)

I have now included a simple test case so this bug can hopefully be fixed. It appears to be a threading issue.

@firebird-automations
Copy link
Collaborator Author

Modified by: Tim Kelly (m00bh000)

priority: Major [ 3 ] => Blocker [ 1 ]

@firebird-automations
Copy link
Collaborator Author

Commented by: @dyemanov

Please attach (or send via email) the compiled binary for the test. I have no Delphi to compile it.

@firebird-automations
Copy link
Collaborator Author

Commented by: @dyemanov

Also, do you use local (hostless) or remote (including host name) connection string?

@firebird-automations
Copy link
Collaborator Author

Modified by: Tim Kelly (m00bh000)

Attachment: TESTCORE4972.zip [ 12830 ]

@firebird-automations
Copy link
Collaborator Author

Commented by: Tim Kelly (m00bh000)

I use a remote connection string (you can set it in the test app).

It seems that the problem is in the client as I just ran the newer fbclient.dll against the older server and it has the problem.

Binaries attached.

@firebird-automations
Copy link
Collaborator Author

Commented by: Tim Kelly (m00bh000)

You may be able to reproduce this problem in C. The test thread is very simple, once you get to about 20 con-current threads you start hitting the problem:

THREAD FUNCTION:

for I := 0 to 10000 do
begin
transaction.StartTransaction;
query.SQL.Text := 'SELECT X FROM A';

try
query\.Open;
query\.Close;
except
  on E: Exception
  do
  begin
    Application\.ShowException\(E\);
  end;
end;
transaction\.Commit;

end;

@firebird-automations
Copy link
Collaborator Author

Modified by: @dyemanov

assignee: Dmitry Yemanov [ dimitr ]

@firebird-automations
Copy link
Collaborator Author

Modified by: @dyemanov

status: Open [ 1 ] => Resolved [ 5 ]

resolution: Fixed [ 1 ]

Fix Version: 3.0 RC 1 [ 10584 ]

@firebird-automations
Copy link
Collaborator Author

Modified by: @pavel-zotov

status: Resolved [ 5 ] => Resolved [ 5 ]

QA Status: No test => Cannot be tested

@firebird-automations
Copy link
Collaborator Author

Commented by: Evelyne Girard (evelyne)

I experiment the same error "Invalid statement handle" with Firebird 2.5.4 (server x64, client x32) ... in similar circumstances (a secondary thread). Could it be the same problem, and if so, is there a fix ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants