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

Full shutdown doesn't unlock database file when Classic Server is running a query modifying data [CORE1611] #2032

Closed
firebird-automations opened this issue Nov 22, 2007 · 16 comments

Comments

@firebird-automations
Copy link
Collaborator

Submitted by: Sergei Rubanik (sergeir)

Duplicates CORE97

Votes: 1

When classic server executes a query, and we do

gfix -shut full -force 0

a query connection doesn't close (and seems to be hanging forever) and the database file is still locked.

Then if we do

gfix -online

it's still locked.

The only method to unlock the file we found is to close the server process (using Task Manager).
But in this case we have a lot of page error after the database validation with

gfix -f -v.

How to reproduce it:

Use the same scripts as in issue CORE1610.

1. Edit database file name in both scripts.

2. Create test database by CORE1610_create_db.sql.

3. Run CORE1610_test_db.sql and shut down the database while the script is running with

gfix -shut full -force 0.

@firebird-automations
Copy link
Collaborator Author

Commented by: Sergei Rubanik (sergeir)

On some our production databases this happens even with select queries which don't modify data, but infortunately I cannot reproduce it on a sample database.

@firebird-automations
Copy link
Collaborator Author

Modified by: @dyemanov

Link: This issue duplicates CORE97 [ CORE97 ]

@firebird-automations
Copy link
Collaborator Author

Commented by: @dyemanov

Duplicated ticket.

@firebird-automations
Copy link
Collaborator Author

Modified by: @pcisar

Workflow: jira [ 13493 ] => Firebird [ 14080 ]

@firebird-automations
Copy link
Collaborator Author

Commented by: Sergei Rubanik (sergeir)

Hi Dmitry,

Can I ask you to look at this issue once more to make sure that this wasn't recognized mistakenly as a duplicate of CORE97:

1) In contrast to CORE97 dealing with Firebir 1.5, my case is related to new full/exclusive shutdown mode, which is available in 2.0 (2.0.3 was tested), but was not available in 1.5.

2) Another difference is that we have problem with Classic, not with SuperServer.

3) The third difference is that Firebird not only doesn't release a database file, but doesn't seem to close a connection either, because when we bring it online and try to verify it with gfix, gfix reports: "secondary server attachments cannot validate databases".

I would say that this is more similar CORE1249.

4) An actual trouble for us is that after an attempt to shut down, the database seems to be locked "forever" (at least several hours - we never tested longer) and we cannot find any way to unlock it without manual stopping the Firebird Classic server process (or server computer), which in turn causes database page errors like:

Number of record level errors	: 1 
Number of index page errors	: 87 
Number of database page errors	: 163 

After that Firebird.log contains errors like:

SERVER Mon Mar 31 12:53:43 2008
Database: C:\TEMP\FBBUG\BUG.FDB
Index 1 is corrupt on page 3486 level 1. File: \fb2\dev\fb2R2_0_3\firebird2\src\jrd\validation.cpp, line: 1646
in table T1 (128)

SERVER Mon Mar 31 12:53:43 2008
Database: C:\TEMP\FBBUG\BUG.FDB
Index 2 has orphan child page at page 14364 in table T1 (128)

SERVERI Mon Mar 31 12:53:43 2008
Database: C:\TEMP\FBBUG\BUG.FDB
Page 14893 is an orphan

We would consider this as a major issue as this can destroy database files and we've got a lot of complaints about corrupted databases from our customers since we moved to Firebird 2.0.3 and started to use full/exclusive shutdown.

Please don't hesitate to contact me if you need more details.

@firebird-automations
Copy link
Collaborator Author

Modified by: @dyemanov

assignee: Dmitry Yemanov [ dimitr ]

@firebird-automations
Copy link
Collaborator Author

Commented by: @dyemanov

It doesn't make any difference whether the requested shutdown mode is multi-user (v1.5 compatible) or exclusive. Neither it differs between SS and CS. By design, the database shutdown is not expected to disconnect users, neither it's expected to release the database file. It just puts active connections to the "frozen" state where they cannot perform any activity.

@firebird-automations
Copy link
Collaborator Author

Commented by: Sergei Rubanik (sergeir)

Dmitry,

This is confusing as the information on http://ibphonix.com seems to be at variance with your words, and we would appreciate to hear your comments on this:

1) "By design, the database shutdown is not expected to disconnect users".

According to the Interbase Operations Guide (http://www.ibphoenix.com/downloads/60OpGuide.zip), option -force: "if there are still active connections, it rolls back any uncommitted transactions, disconnects (!) any users, and shuts down the database".

Commandline Utilities guide (http://www.firebirdsql.org/pdfmanual/Firebird-Utils-WIP.pdf) says:

"-f[orce] : shuts down with no regard for the connection or transaction status of the database. No new connections
or transactions are permitted and any active sessions are terminated along with any active transactions."

But I just found that it contains warning:

"There is a bug in Classic Server which still exists at version 2.0. The bug is such that the -f[orce] option behaves in exactly the same way as the -at[tach] option".

I wonder if this is what we are observing...

2) "neither it's expected to release the database file":

Cralos H. Cantu on FB Conf 2006 mentioned the full shutdown as a way to get a correct physical copy of a database file:

" FULL MODE (totally off-line):
...
- Interesting to make physical copies of the database file with no risk to get a corrupted DB.
- Use third party tools (zip, rar, ace, etc.) to generate compressed copies of the database."

Source: http://www.ibphoenix.com/downloads/FirebirdConf2006/HOWTO-QTZ201-R/HOWTO-QTZ201-R.zip

In reality zip, rar reports that they cannot work (or can work correctly) as the file is used by other process.

Moreover according to our experience Firebird in SuperServer mode (in contrast to Classic mode) does close connections and does release databases (unfortunately with bugs: CORE1610).

@firebird-automations
Copy link
Collaborator Author

Commented by: @dyemanov

Do you have a test case showing that SS closes the active connections?

@firebird-automations
Copy link
Collaborator Author

Modified by: @dyemanov

Fix Version: 2.5 Beta 1 [ 10251 ]

@firebird-automations
Copy link
Collaborator Author

Modified by: @dyemanov

Fix Version: 3.0 Initial [ 10301 ]

Fix Version: 2.5 Beta 1 [ 10251 ] =>

@firebird-automations
Copy link
Collaborator Author

Modified by: @dyemanov

Fix Version: 3.0 Alpha 1 [ 10331 ]

Fix Version: 3.0 Initial [ 10301 ] =>

@firebird-automations
Copy link
Collaborator Author

Commented by: @dyemanov

I'm closing it as a duplicate as it partially mirrors CORE97. The unique part of this ticket has not been confirmed.

Regardless, everything mentioned here is expected to be fixed in v2.5 RC1, but I don't want to have duplicated information in the release notes, thus I bypass the "resolved" state.

@firebird-automations
Copy link
Collaborator Author

Modified by: @dyemanov

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

resolution: Duplicate [ 3 ]

Fix Version: 3.0 Alpha 1 [ 10331 ] =>

@firebird-automations
Copy link
Collaborator Author

Modified by: @pcisar

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

@firebird-automations
Copy link
Collaborator Author

Modified by: @pavel-zotov

QA Status: No test

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