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

Forced database shutdown does not work if non-zero delay was specified [CORE3817] #4159

Closed
firebird-automations opened this issue Apr 15, 2012 · 9 comments

Comments

@firebird-automations
Copy link
Collaborator

Submitted by: @dyemanov

There are two visible issues:

1) Any kind of shutdown attempt does not shut the active connections down
2) While they're connected nobody else (including SYSDBA) can connect even if the multi-user shutdown was requested

Everything works as expected with zero timeout interval (-force 0).

Commits: 47c71f3

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

QA status was changed for moving this ticket to smaller group. Test can be implemented using Python.

@firebird-automations
Copy link
Collaborator Author

Modified by: @dyemanov

assignee: Dmitry Yemanov [ dimitr ]

@firebird-automations
Copy link
Collaborator Author

Commented by: @dyemanov

Additional comments:

In summary, shutdown -force does not shut down existing connections. It does put the database into a shutdown mode. However, in multi mode, privileged users cannot log in until the "trapped" user sessions are terminated.

(There's another bug apparent here, I think, in that a user created with global admin privileges - WOMBAT - can't put the database online.)

DEMO
This demo displays output to 3 command shells.
cs1 is used for various command-line calls
cs2 and cs3 are two isql sessions
Alias empdb is the employee database, FW=ON

Firebird 2.5.1 Superclassic running on a netbook under WinXP XP3

gsec display:
SYSDBA 0 0 Sql Server Administrator
WOMBAT 0 0 admin Cute Little Marsupial
ALFRED 0 0
REPL 0 0
NOBODY 0 0

cs1:

c:\Programs\Firebird\Firebird_2_5\bin>gstat -h empdb

Database "c:\programs\firebird\firebird_2_5\examples\empbuild\employee.fdb"
Database header page information:
Flags 0
Checksum 12345
Generation 321
Page size 4096
ODS version 11.2
Oldest transaction 243
Oldest active 264
Oldest snapshot 264
Next transaction 265
Bumped transaction 1
Sequence number 0
Next attachment ID 45
Implementation ID 26
Shadow count 0
Page buffers 0
Next header page 0
Database dialect 3
Creation date Oct 3, 2011 8:36:00
Attributes force write

Variable header data:
    \*END\*

c:\Programs\Firebird\Firebird_2_5\bin>

cs2:

c:\Programs\Firebird\Firebird_2_5\bin>isql empdb -user nobody -password badsushi

Database: empdb, User: nobody
SQL> show tables; -- (non-privileged user NOBODY)
COUNTRY CUSTOMER
DEPARTMENT EMPLOYEE
EMPLOYEE_PROJECT JOB
PROJECT PROJ_DEPT_BUDGET
SALARY_HISTORY SALES

SQL>

cs3:

c:\Programs\Firebird\Firebird_2_5\bin>isql -user wombat -password badsushi
Use CONNECT or CREATE DATABASE to specify a database
SQL>connect empdb -- (privileged user WOMBAT)
CON>

cs1:

c:\Programs\Firebird\Firebird_2_5\bin>gfix -shut multi -force 5 empdb -user sysd
ba -password masterkey

c:\Programs\Firebird\Firebird_2_5\bin>gstat -h empdb

Database "c:\programs\firebird\firebird_2_5\examples\empbuild\employee.fdb"
Database header page information:
Flags 0
Checksum 12345
Generation 327
Page size 4096
ODS version 11.2
Oldest transaction 243
Oldest active 266
Oldest snapshot 266
Next transaction 268
Bumped transaction 1
Sequence number 0
Next attachment ID 47
Implementation ID 26
Shadow count 0
Page buffers 0
Next header page 0
Database dialect 3
Creation date Oct 3, 2011 8:36:00
Attributes force write, multi-user maintenance

Variable header data:
    \*END\*

c:\Programs\Firebird\Firebird_2_5\bin>

cs2: (after shutdown):

SQL> select * from country; -- (non-privileged user NOBODY)

COUNTRY CURRENCY
=============== ==========
USA Dollar
England Pound
Canada CdnDlr
Switzerland SFranc
Japan Yen
Italy Lira
France FFranc
Germany D-Mark
Australia ADollar
Hong Kong HKDollar
Netherlands Guilder
Belgium BFranc
Austria Schilling
Fiji FDollar

SQL>

cs3:

SQL> connect empdb -- (privileged user WOMBAT)
CON>;
Statement failed, SQLSTATE = 08006
connection lost to database
SQL> connect empdb user 'sysdba' password 'masterkey';
Statement failed, SQLSTATE = 08006
connection lost to database
SQL>

cs2:

SQL> commit;
SQL> quit;

c:\Programs\Firebird\Firebird_2_5\bin>

cs3:

SQL> connect empdb; -- (privileged user WOMBAT)
Statement failed, SQLSTATE = 08006
connection lost to database
SQL> connect empdb user 'sysdba' password 'masterkey';
Database: empdb, User: sysdba
SQL> show tables;
COUNTRY CUSTOMER
DEPARTMENT EMPLOYEE
EMPLOYEE_PROJECT JOB
PROJECT PROJ_DEPT_BUDGET
SALARY_HISTORY SALES

SQL> connect empdb user 'wombat' password 'badsushi';
Commit current transaction (y/n)?y
Committing.
Statement failed, SQLSTATE = 08006
connection lost to database
SQL> connect empdb user 'sysdba' password 'masterkey';
Database: empdb, User: sysdba

SQL>

cs1:

c:\Programs\Firebird\Firebird_2_5\bin>gfix -online empdb -user wombat -password
badsushi
no permission for bring online access to database C:\PROGRAMS\FIREBIRD\FIREBIRD_
2_5\EXAMPLES\EMPBUILD\EMPLOYEE.FDB

c:\Programs\Firebird\Firebird_2_5\bin>gfix -online empdb -user sysdba -password
masterkey

c:\Programs\Firebird\Firebird_2_5\bin>

@firebird-automations
Copy link
Collaborator Author

Commented by: @dyemanov

Confirmation by Helen:

I confirm similar (although not exactly the same) behaviour w. v.2.0.7 and 2.1.5. Don't have a v.1.5 Windows box available.

The difference: with 2.0.7 and 2.1.5 the message to client when connection is refused is "Statement failed, SQLCODE -903 database {file-path} shutdown

With 2.5.1 it is nasty "Statement failed, SQLSTATE = 08006
connection lost to database" with no useful information.

@firebird-automations
Copy link
Collaborator Author

Modified by: @dyemanov

status: Open [ 1 ] => In Progress [ 3 ]

@firebird-automations
Copy link
Collaborator Author

Modified by: @dyemanov

status: In Progress [ 3 ] => Open [ 1 ]

@firebird-automations
Copy link
Collaborator Author

Modified by: @dyemanov

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

resolution: Fixed [ 1 ]

Fix Version: 3.0 Alpha 1 [ 10331 ]

Fix Version: 2.5.3 [ 10461 ]

@firebird-automations
Copy link
Collaborator Author

Modified by: @pcisar

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

@firebird-automations
Copy link
Collaborator Author

Modified by: @pavel-zotov

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

QA Status: No test

@firebird-automations
Copy link
Collaborator Author

Modified by: @pavel-zotov

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

QA Status: No test => Deferred

Test Details: QA status was changed for moving this ticket to smaller group. Test can be implemented using Python.

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