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

Shutdown immediately followed by validate results in exception [JDBC600] #631

Closed
firebird-automations opened this issue Nov 25, 2019 · 7 comments

Comments

@firebird-automations
Copy link

Submitted by: @mrotteveel

As reported on Firebird-support (2019-11-25, thread "Why I cannot use firebird services to validate a remote database"):

I was trying to shutdown a Firebird 2.1 using the Jaybird 3.x to validate the database.

I wasn't abble to shutdown it like "gfix -shut multi -force 0 remote_server_host:database"

So, when I perform the validate using the jaybird service I got this:

java.sql.SQLException: bad parameters on attach or create database; secondary server attachments cannot validate databases [SQLState:HY000, ISC error code:335544325]
at org.firebirdsql.gds.ng.FbExceptionBuilder$Type$1.createSQLException(FbExceptionBuilder.java:498)
at org.firebirdsql.gds.ng.FbExceptionBuilder.toFlatSQLException(FbExceptionBuilder.java:299)
at org.firebirdsql.gds.ng.wire.AbstractWireOperations.readStatusVector(AbstractWireOperations.java:135)
at org.firebirdsql.gds.ng.wire.AbstractWireOperations.processOperation(AbstractWireOperations.java:199)
at org.firebirdsql.gds..ng.wire.AbstractWireOperations.readSingleResponse(AbstractWireOperations.java:166)
at org.firebirdsql.gds.ng.wire.AbstractWireOperations.readResponse(AbstractWireOperations.java:150)
at org.firebirdsql.gds.ng.wire.AbstractWireOperations.readGenericResponse(AbstractWireOperations.java:252)
at org.firebirdsql.gds.ng.wire.AbstractFbWireService.readGenericResponse(AbstractFbWireService.java:138)
at org.firebirdsql.gds.ng.wire.version10.V10Service.startServiceAction(V10Service.java:212)
at org.firebirdsql.management.FBServiceManager.executeServicesOperation(FBServiceManager.java:280)
at org.firebirdsql.management.FBMaintenanceManager.validateDatabase(FBMaintenanceManager.java:239)
at br.com.jjw.besser.atualizador.client.utils.firebird.FirebirdMaintenanceHelper.validate(FirebirdMaintenanceHelper.java:209)
at br.com.jjw.besser.atualizador.client.utils.firebird.FirebirdMaintenanceHelper.main(FirebirdMaintenanceHelper.java:261)
Caused by: org.firebirdsql.jdbc.FBSQLExceptionInfo: bad parameters on attach or create database

But, if I use the gfix command: gfix -shut multi -force 0 remote:database the validation performs!

Workaround/solution is to add a 1 second sleep between shutdown and validate:

The problem was the "time" between perform the SHUTDOWN and the VALIDATION.

I just add a 1 second "sleep" between the shutdown and validate, and it works!

FBMaintenanceManager mgr = ...... ;
mgr.shutdownDatabase(FBMaintenanceManager.SHUTDOWN_FORCE, 0);
Thread.sleep(1000); // holy sleep
mgr.validateDatabase(FBMaintenanceManager.VALIDATE_READ_ONLY);

@firebird-automations
Copy link
Author

Commented by: @mrotteveel

I'm not sure if this is a Jaybird problem, or just a result of how Firebird handles a shutdown. I'll need to investigate if this is something that Jaybird can fix or not.

@firebird-automations
Copy link
Author

Modified by: @mrotteveel

Fix Version: Jaybird 3.0.9 [ 10917 ]

@firebird-automations
Copy link
Author

Commented by: @mrotteveel

Unfortunately, I have not been able to reproduce this problem. My guess is that the shutdown takes some time to complete, even after the shutdown returns, or possibly it is advisable to specify a non-zero timeout (although AFAIK, that shouldn't matter with SHUTDOWN_FORCE).

If you can consistently reproduce it, it would be helpful for me to get more information:
* What is the exact Firebird version?
* What platform (Windows, Linux, ...)?
* Do you use SuperServer, SuperClassic or Classic?
* How many connections are attached to the database when issuing the shutdown, and what are they doing?

@firebird-automations
Copy link
Author

Commented by: @mrotteveel

Deferring to later version

@firebird-automations
Copy link
Author

Modified by: @mrotteveel

Fix Version: Jaybird 4.0.1 [ 10921 ]

Fix Version: Jaybird 3.0.10 [ 10932 ]

Fix Version: Jaybird 5 [ 10871 ]

Fix Version: Jaybird 3.0.9 [ 10917 ] =>

@firebird-automations
Copy link
Author

Commented by: @mrotteveel

As I cannot reproduce the problem, I can't fix it.

@firebird-automations
Copy link
Author

Modified by: @mrotteveel

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

resolution: Cannot Reproduce [ 5 ]

Fix Version: Jaybird 4.0.1 [ 10921 ] =>

Fix Version: Jaybird 3.0.10 [ 10932 ] =>

Fix Version: Jaybird 5 [ 10871 ] =>

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