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

Freeing a statement using DSQL_drop or DSQL_unprepare should send free packet immediately [CORE6519] #6748

Closed
firebird-automations opened this issue Mar 20, 2021 · 3 comments

Comments

@firebird-automations
Copy link
Collaborator

Submitted by: @mrotteveel

Relate to JDBC638

Since the v11 protocol, fbclient will defer sending the free packet for op_free_statement until other activity on the connection. This approach can lead to issues when there is no further activity on the connection for a while, because the statement is not unprepared or dropped server-side, leading to Firebird holding on the metadata object locks for longer than necessary, which for example can prevent subsequent DDL on another connection to succeed. This can cause either transactions waiting for the lock to be released or errors like "unsuccessful metadata update; object TABLE "TEST" is in use [SQLState:42000, ISC error code:335544351]"

I propose that for DSQL_drop and DSQL_unprepare, the free packet is sent immediately, but processing of the response is deferred until later. For DSQL_close the current behaviour is not very problematic, so could remain as is. On firebird-devel, Vlad suggested an alternative approach to use a timer to send deferred packets with a delay so that multiple subsequent closes can be sent together.

See also JDBC638 and https://groups.google.com/g/firebird-java/c/DuIRTYJru7U/m/cxxv49RGAgAJ and the discussion on firebird-devel titled "Does deferred processing of DSQL_drop and DSQL_unprepare make sense?"

@firebird-automations
Copy link
Collaborator Author

Modified by: @mrotteveel

Link: This issue relate to JDBC638 [ JDBC638 ]

@hvlad
Copy link
Member

hvlad commented May 4, 2021

@mrotteveel Mark, would you like to test the patch ? With fb3 client at first.

@mrotteveel
Copy link
Member

@hvlad I can do that somewhere this week.

@hvlad hvlad self-assigned this May 4, 2021
hvlad added a commit that referenced this issue May 4, 2021
…repare should send free packet immediately [CORE6519]
hvlad added a commit that referenced this issue May 4, 2021
…repare should send free packet immediately [CORE6519]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment