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

Transactions with isc_tpb_autocommit can hang the server [CORE4840] #5136

Closed
firebird-automations opened this issue Jun 14, 2015 · 11 comments
Closed

Comments

@firebird-automations
Copy link
Collaborator

Submitted by: @mrotteveel

Attachments:
TpbAutocommitTest.java

I was testing the pull request of Maxim for Jaybird. A test that creates a stored procedure and adds a comment on that stored procedure in a transaction with isc_tpb_autocommit hangs the entire Firebird 3 server when executing the statement that adds the comment. The Firebird 3 server stops responding entirely.

The test that reproduce this is (see also attachment):

private static final String CREATE\_PROCEDURE =
        "CREATE PROCEDURE testproc1 \(IN1 INTEGER, IN2 FLOAT\)" \+
        "RETURNS \(OUT1 VARCHAR\(20\), " \+
        "  OUT2 DOUBLE PRECISION, OUT3 INTEGER\) AS " \+
        " DECLARE VARIABLE X INTEGER;" \+
        "BEGIN" \+
        " OUT1 = 'Out String';" \+
        " OUT2 = 45;" \+
        " OUT3 = IN1;" \+
        "END";

private static final String ADD\_COMMENT = "COMMENT ON PROCEDURE testproc1 IS 'Test description'";

@Test
public void iscTpbAutocommit\_hangsServer\(\) throws SQLException \{
    try \(FbDatabase db = createDatabaseConnection\(\)\) \{
        db\.attach\(\);

        TransactionParameterBuffer tpb = new TransactionParameterBufferImpl\(\);
        tpb\.addArgument\(ISCConstants\.isc\_tpb\_read\_committed\);
        tpb\.addArgument\(ISCConstants\.isc\_tpb\_rec\_version\);
        tpb\.addArgument\(ISCConstants\.isc\_tpb\_write\);
        tpb\.addArgument\(ISCConstants\.isc\_tpb\_wait\);
        tpb\.addArgument\(ISCConstants\.isc\_tpb\_autocommit\);
        FbTransaction transaction = db\.startTransaction\(tpb\);
        try \{
            FbStatement statement = db\.createStatement\(transaction\);
            statement\.prepare\(CREATE\_PROCEDURE\);
            statement\.execute\(RowValue\.EMPTY\_ROW\_VALUE\);
            statement\.prepare\(ADD\_COMMENT\);
            statement\.execute\(RowValue\.EMPTY\_ROW\_VALUE\);
        \} finally \{
            transaction\.commit\(\);
        \}
    \}
\}

The same test runs fine against Firebird 2.5.4.

The firebird.log contains:

RAMONA Sun Jun 14 10:56:16 2015
Database: D:\DEVELOPMENT\PROJECT\JAYBIRD\JAYBIRD\FBTEST.FDB
internal Firebird consistency check (Too many savepoints (287), file: tra.cpp line: 2470)

RAMONA Sun Jun 14 10:56:16 2015
Database: D:\DEVELOPMENT\PROJECT\JAYBIRD\JAYBIRD\FBTEST.FDB
internal Firebird consistency check (Too many savepoints (287), file: tra.cpp line: 2470)
internal Firebird consistency check (wrong record version (185), file: vio.cpp line: 3740)

Commits: 302cd6b FirebirdSQL/fbt-repository@cfcc21e

====== Test Details ======

Confirmed:
1. Crash on LI-V3.0.0.32173, WI-V3.0.0.32239 Rev: 62703 (nightly update)
2. Normal work on LI-V3.0.0.32239 Rev: 62705

@firebird-automations
Copy link
Collaborator Author

Modified by: @mrotteveel

Attachment: TpbAutocommitTest.java [ 12766 ]

@firebird-automations
Copy link
Collaborator Author

Modified by: @mrotteveel

description: I was testing the pull request of Maxim for Jaybird. A test that creates a stored procedure and adds a comment on that stored procedure in a transaction with isc_tpb_autocommit hangs the entire Firebird 3 server. The Firebird 3 server stops responding entirely.

The test is (see also attachment):

private static final String CREATE\_PROCEDURE =
        "CREATE PROCEDURE testproc1 \(IN1 INTEGER, IN2 FLOAT\)" \+
        "RETURNS \(OUT1 VARCHAR\(20\), " \+
        "  OUT2 DOUBLE PRECISION, OUT3 INTEGER\) AS " \+
        " DECLARE VARIABLE X INTEGER;" \+
        "BEGIN" \+
        " OUT1 = 'Out String';" \+
        " OUT2 = 45;" \+
        " OUT3 = IN1;" \+
        "END";

private static final String ADD\_COMMENT = "COMMENT ON PROCEDURE testproc1 IS 'Test description'";

@Test
public void iscTpbAutocommit\_hangsServer\(\) throws SQLException \{
    try \(FbDatabase db = createDatabaseConnection\(\)\) \{
        db\.attach\(\);

        TransactionParameterBuffer tpb = new TransactionParameterBufferImpl\(\);
        tpb\.addArgument\(ISCConstants\.isc\_tpb\_read\_committed\);
        tpb\.addArgument\(ISCConstants\.isc\_tpb\_rec\_version\);
        tpb\.addArgument\(ISCConstants\.isc\_tpb\_write\);
        tpb\.addArgument\(ISCConstants\.isc\_tpb\_wait\);
        tpb\.addArgument\(ISCConstants\.isc\_tpb\_autocommit\);
        FbTransaction transaction = db\.startTransaction\(tpb\);
        try \{
            FbStatement statement = db\.createStatement\(transaction\);
            statement\.prepare\(CREATE\_PROCEDURE\);
            statement\.execute\(RowValue\.EMPTY\_ROW\_VALUE\);
            statement\.prepare\(ADD\_COMMENT\);
            statement\.execute\(RowValue\.EMPTY\_ROW\_VALUE\);
        \} finally \{
            transaction\.commit\(\);
        \}
    \}
\}

The same test runs fine against Firebird 2.5.4.

The firebird.log contains:

RAMONA Sun Jun 14 10:56:16 2015
Database: D:\DEVELOPMENT\PROJECT\JAYBIRD\JAYBIRD\FBTEST.FDB
internal Firebird consistency check (Too many savepoints (287), file: tra.cpp line: 2470)

RAMONA Sun Jun 14 10:56:16 2015
Database: D:\DEVELOPMENT\PROJECT\JAYBIRD\JAYBIRD\FBTEST.FDB
internal Firebird consistency check (Too many savepoints (287), file: tra.cpp line: 2470)
internal Firebird consistency check (wrong record version (185), file: vio.cpp line: 3740)

=>

I was testing the pull request of Maxim for Jaybird. A test that creates a stored procedure and adds a comment on that stored procedure in a transaction with isc_tpb_autocommit hangs the entire Firebird 3 server. The Firebird 3 server stops responding entirely.

The test that reproduce this is (see also attachment):

private static final String CREATE\_PROCEDURE =
        "CREATE PROCEDURE testproc1 \(IN1 INTEGER, IN2 FLOAT\)" \+
        "RETURNS \(OUT1 VARCHAR\(20\), " \+
        "  OUT2 DOUBLE PRECISION, OUT3 INTEGER\) AS " \+
        " DECLARE VARIABLE X INTEGER;" \+
        "BEGIN" \+
        " OUT1 = 'Out String';" \+
        " OUT2 = 45;" \+
        " OUT3 = IN1;" \+
        "END";

private static final String ADD\_COMMENT = "COMMENT ON PROCEDURE testproc1 IS 'Test description'";

@Test
public void iscTpbAutocommit\_hangsServer\(\) throws SQLException \{
    try \(FbDatabase db = createDatabaseConnection\(\)\) \{
        db\.attach\(\);

        TransactionParameterBuffer tpb = new TransactionParameterBufferImpl\(\);
        tpb\.addArgument\(ISCConstants\.isc\_tpb\_read\_committed\);
        tpb\.addArgument\(ISCConstants\.isc\_tpb\_rec\_version\);
        tpb\.addArgument\(ISCConstants\.isc\_tpb\_write\);
        tpb\.addArgument\(ISCConstants\.isc\_tpb\_wait\);
        tpb\.addArgument\(ISCConstants\.isc\_tpb\_autocommit\);
        FbTransaction transaction = db\.startTransaction\(tpb\);
        try \{
            FbStatement statement = db\.createStatement\(transaction\);
            statement\.prepare\(CREATE\_PROCEDURE\);
            statement\.execute\(RowValue\.EMPTY\_ROW\_VALUE\);
            statement\.prepare\(ADD\_COMMENT\);
            statement\.execute\(RowValue\.EMPTY\_ROW\_VALUE\);
        \} finally \{
            transaction\.commit\(\);
        \}
    \}
\}

The same test runs fine against Firebird 2.5.4.

The firebird.log contains:

RAMONA Sun Jun 14 10:56:16 2015
Database: D:\DEVELOPMENT\PROJECT\JAYBIRD\JAYBIRD\FBTEST.FDB
internal Firebird consistency check (Too many savepoints (287), file: tra.cpp line: 2470)

RAMONA Sun Jun 14 10:56:16 2015
Database: D:\DEVELOPMENT\PROJECT\JAYBIRD\JAYBIRD\FBTEST.FDB
internal Firebird consistency check (Too many savepoints (287), file: tra.cpp line: 2470)
internal Firebird consistency check (wrong record version (185), file: vio.cpp line: 3740)

@firebird-automations
Copy link
Collaborator Author

Modified by: @mrotteveel

description: I was testing the pull request of Maxim for Jaybird. A test that creates a stored procedure and adds a comment on that stored procedure in a transaction with isc_tpb_autocommit hangs the entire Firebird 3 server. The Firebird 3 server stops responding entirely.

The test that reproduce this is (see also attachment):

private static final String CREATE\_PROCEDURE =
        "CREATE PROCEDURE testproc1 \(IN1 INTEGER, IN2 FLOAT\)" \+
        "RETURNS \(OUT1 VARCHAR\(20\), " \+
        "  OUT2 DOUBLE PRECISION, OUT3 INTEGER\) AS " \+
        " DECLARE VARIABLE X INTEGER;" \+
        "BEGIN" \+
        " OUT1 = 'Out String';" \+
        " OUT2 = 45;" \+
        " OUT3 = IN1;" \+
        "END";

private static final String ADD\_COMMENT = "COMMENT ON PROCEDURE testproc1 IS 'Test description'";

@Test
public void iscTpbAutocommit\_hangsServer\(\) throws SQLException \{
    try \(FbDatabase db = createDatabaseConnection\(\)\) \{
        db\.attach\(\);

        TransactionParameterBuffer tpb = new TransactionParameterBufferImpl\(\);
        tpb\.addArgument\(ISCConstants\.isc\_tpb\_read\_committed\);
        tpb\.addArgument\(ISCConstants\.isc\_tpb\_rec\_version\);
        tpb\.addArgument\(ISCConstants\.isc\_tpb\_write\);
        tpb\.addArgument\(ISCConstants\.isc\_tpb\_wait\);
        tpb\.addArgument\(ISCConstants\.isc\_tpb\_autocommit\);
        FbTransaction transaction = db\.startTransaction\(tpb\);
        try \{
            FbStatement statement = db\.createStatement\(transaction\);
            statement\.prepare\(CREATE\_PROCEDURE\);
            statement\.execute\(RowValue\.EMPTY\_ROW\_VALUE\);
            statement\.prepare\(ADD\_COMMENT\);
            statement\.execute\(RowValue\.EMPTY\_ROW\_VALUE\);
        \} finally \{
            transaction\.commit\(\);
        \}
    \}
\}

The same test runs fine against Firebird 2.5.4.

The firebird.log contains:

RAMONA Sun Jun 14 10:56:16 2015
Database: D:\DEVELOPMENT\PROJECT\JAYBIRD\JAYBIRD\FBTEST.FDB
internal Firebird consistency check (Too many savepoints (287), file: tra.cpp line: 2470)

RAMONA Sun Jun 14 10:56:16 2015
Database: D:\DEVELOPMENT\PROJECT\JAYBIRD\JAYBIRD\FBTEST.FDB
internal Firebird consistency check (Too many savepoints (287), file: tra.cpp line: 2470)
internal Firebird consistency check (wrong record version (185), file: vio.cpp line: 3740)

=>

I was testing the pull request of Maxim for Jaybird. A test that creates a stored procedure and adds a comment on that stored procedure in a transaction with isc_tpb_autocommit hangs the entire Firebird 3 server when executing the statement that adds the comment. The Firebird 3 server stops responding entirely.

The test that reproduce this is (see also attachment):

private static final String CREATE\_PROCEDURE =
        "CREATE PROCEDURE testproc1 \(IN1 INTEGER, IN2 FLOAT\)" \+
        "RETURNS \(OUT1 VARCHAR\(20\), " \+
        "  OUT2 DOUBLE PRECISION, OUT3 INTEGER\) AS " \+
        " DECLARE VARIABLE X INTEGER;" \+
        "BEGIN" \+
        " OUT1 = 'Out String';" \+
        " OUT2 = 45;" \+
        " OUT3 = IN1;" \+
        "END";

private static final String ADD\_COMMENT = "COMMENT ON PROCEDURE testproc1 IS 'Test description'";

@Test
public void iscTpbAutocommit\_hangsServer\(\) throws SQLException \{
    try \(FbDatabase db = createDatabaseConnection\(\)\) \{
        db\.attach\(\);

        TransactionParameterBuffer tpb = new TransactionParameterBufferImpl\(\);
        tpb\.addArgument\(ISCConstants\.isc\_tpb\_read\_committed\);
        tpb\.addArgument\(ISCConstants\.isc\_tpb\_rec\_version\);
        tpb\.addArgument\(ISCConstants\.isc\_tpb\_write\);
        tpb\.addArgument\(ISCConstants\.isc\_tpb\_wait\);
        tpb\.addArgument\(ISCConstants\.isc\_tpb\_autocommit\);
        FbTransaction transaction = db\.startTransaction\(tpb\);
        try \{
            FbStatement statement = db\.createStatement\(transaction\);
            statement\.prepare\(CREATE\_PROCEDURE\);
            statement\.execute\(RowValue\.EMPTY\_ROW\_VALUE\);
            statement\.prepare\(ADD\_COMMENT\);
            statement\.execute\(RowValue\.EMPTY\_ROW\_VALUE\);
        \} finally \{
            transaction\.commit\(\);
        \}
    \}
\}

The same test runs fine against Firebird 2.5.4.

The firebird.log contains:

RAMONA Sun Jun 14 10:56:16 2015
Database: D:\DEVELOPMENT\PROJECT\JAYBIRD\JAYBIRD\FBTEST.FDB
internal Firebird consistency check (Too many savepoints (287), file: tra.cpp line: 2470)

RAMONA Sun Jun 14 10:56:16 2015
Database: D:\DEVELOPMENT\PROJECT\JAYBIRD\JAYBIRD\FBTEST.FDB
internal Firebird consistency check (Too many savepoints (287), file: tra.cpp line: 2470)
internal Firebird consistency check (wrong record version (185), file: vio.cpp line: 3740)

@firebird-automations
Copy link
Collaborator Author

Modified by: @dyemanov

Fix Version: 3.0 RC 1 [ 10584 ]

@firebird-automations
Copy link
Collaborator Author

Modified by: @dyemanov

Fix Version: 3.0.0 [ 10048 ]

Fix Version: 3.0 RC 1 [ 10584 ] =>

@firebird-automations
Copy link
Collaborator Author

Commented by: @mrotteveel

BTW: This looks a lot like CORE3825

@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 ]

@firebird-automations
Copy link
Collaborator Author

Modified by: @pavel-zotov

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

QA Status: No test => Done successfully

Test Details: Confirmed:
1. Crash on LI-V3.0.0.32173, WI-V3.0.0.32239
2. Normal work on LI-V3.0.0.32239 Rev: 62705

@firebird-automations
Copy link
Collaborator Author

Modified by: @pavel-zotov

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

@firebird-automations
Copy link
Collaborator Author

Modified by: @pavel-zotov

status: Closed [ 6 ] => Closed [ 6 ]

Test Details: Confirmed:
1. Crash on LI-V3.0.0.32173, WI-V3.0.0.32239
2. Normal work on LI-V3.0.0.32239 Rev: 62705

=>

Confirmed:
1. Crash on LI-V3.0.0.32173, WI-V3.0.0.32239 Rev: 62703 (nightly update)
2. Normal work on LI-V3.0.0.32239 Rev: 62705

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