-
-
Notifications
You must be signed in to change notification settings - Fork 221
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
gbak deletes backup file even if error happens when it's already successfully closed [CORE3649] #4000
Comments
Commented by: @AlexPeshkoff Javier, on the on hand tracker is not good place for asking support questions about released versions. On teh other hand, you've got a crash, which is definitely a bug. If you still have damaged copy of the database, please follow this |
Modified by: @AlexPeshkoffassignee: Alexander Peshkov [ alexpeshkoff ] |
Commented by: Javier Sanchez (thejavo) Sorry for reporting this as support question. It wasn't my idea. After several hours of trying to generate a gbk, I think I've found the bug. This was the situation: -In one table I had a Computed Field like this: K_FORMATNUM came from an external UDF file, that may have a problem, (I can't see the code). I've changed the declaration to this:
and everything started to work. The problem here is that gbak did the entirely backup process up the the "closing file, committing, and finishing" and after this got a connection error and drop the backed up file with no clue on what could have happened. Once again, thank you form your time and excuse me for posting this incorrectly. |
Modified by: Javier Sanchez (thejavo)summary: gbak: ERROR:Error reading data from the connection. => gbak fail to backup database with buggy UDF |
Modified by: Javier Sanchez (thejavo)summary: gbak fail to backup database with buggy UDF => gbak fail to backup database with buggy UDF in computed field |
Commented by: Javier Sanchez (thejavo) I could create an example of a gdb that could not make backup. I've also attached the .so UDF file (it's a 64 bit one). I hope you'll find this useful. |
Modified by: Javier Sanchez (thejavo)Attachment: problem.tar.gz [ 12040 ] |
Commented by: @kattunga Confirmed here, I can reproduce the error. I think that this should be considered as a gbak bug. |
Commented by: @AlexPeshkoff This is not gbak bug. Something wrong happens inside engine, when deleting database object. BTW, this is a place where UDF libs are unloaded from memory. But I agree that error report is bad and certainly should be fixed. |
Commented by: @kattunga Sorry Alex, you are right is not a gbak bug. |
Commented by: @AlexPeshkoff The bug happens when isc_detach_database() is executed. At this moment database is already completely backed up, backup file is closed, i.e. the issue is really minor. But when isc_detach_database() returns an error code gbak just reports it and exits. What else can it do? |
Commented by: Javier Sanchez (thejavo) Hello again, the problem that remains still is that after gbak raises the error, inmediately erase the gbk file from disk. |
Commented by: @AlexPeshkoff Ho-ops, this really makes it not minor. |
Commented by: Sean Leyne (seanleyne) Personally, I was going to suggest that any error which occurs during or after the detach could be ignored. But then my brain kicked in... the error/problem being raised could be significant and relate an issue which does is fact mean that the restore truly failed. So, gbak is doing exactly what is expected. My suggestion would be to use clearer error text: - Errors which occur before the detach read as: - Errors which occur during/after the detach read as: |
Commented by: Sean Leyne (seanleyne) Javier, Are you sure that it is *gbak* which is deleting the gbk and not your own restore script? I am not aware of any gbak options which would delete the backup file. |
Commented by: @asfernandes "Error reading data from the connection" from client was always server crash, no? This is not something to hide. |
Commented by: Javier Sanchez (thejavo) "Exiting early due to errors, restore is suspect" would be ok. But, and sorry to bother you, Could it be possible to give a little bit of information?. |
Commented by: Javier Sanchez (thejavo) No script, I'm runing gbak directly and try it from different servers and with different firebird versions. (2.5.0,2.5.1, 2.5.2) always the same result, I've also attached an example of the gdb and the UDF file that created te problem |
Commented by: @kattunga By the way, why is gbak deleting the backup after the error?, also if the crash is before finishing it should not delete the partial backup, may be I can use it to restore some data. |
Commented by: @AlexPeshkoff Javier, looks like sonething is wrong with yourr UDF. Process exits with 0 code (i.e. normal exit) when firebird does dlclose() for your UDF. The most strange thing is that I can reproduce it not on all machines. On my relatively old (1.5 years) gentoo bug takes place, on the other box (Ubuntu 11.04) everything works just fine. I.e. this can even be glibc problem. We can't fix all problematic UDFs that arrive around. I suggest to make gbak rename output file from file.fbk to something like file.fbk.BROKEN instead of deleting it and do nothing more re this issue. |
Commented by: @kattunga Hi Alex, I think that there are several situations in this issue. In my opinion: a) gbak should not delete the residual backup file if the the backup process fail, renaming to something like file.fbk.BROKEN is fine. |
Commented by: @AlexPeshkoff Christian, agreed about a & b, c is impossible - UDF just do not return control to firebird engine, it simply exits. |
Commented by: @asfernandes I think a renamed file should not be created. Just change the code and puts a message saying "error when closing the database" instead of the "closing and going home" one and leave the file. |
Commented by: @AlexPeshkoff If backup is complete (file is already closed) - yes, we should leave it as is, just give another message. |
Modified by: @AlexPeshkoff |
Commented by: @AlexPeshkoff Definitely yes. |
Modified by: @AlexPeshkoffsummary: gbak fail to backup database with buggy UDF in computed field => gbak deletes backup file even if error happens when it's already successfully closed |
Commented by: @AlexPeshkoff Certainly, I can't fix fpc issues - but at least your backup file will stay with you |
Modified by: @AlexPeshkoffstatus: Open [ 1 ] => Resolved [ 5 ] resolution: Fixed [ 1 ] Fix Version: 3.0 Alpha 1 [ 10331 ] Fix Version: 2.5.2 [ 10450 ] |
Modified by: @pcisarstatus: Resolved [ 5 ] => Closed [ 6 ] |
Modified by: @pavel-zotovQA Status: No test |
Modified by: @pavel-zotovstatus: Closed [ 6 ] => Closed [ 6 ] QA Status: No test => Cannot be tested Test Details: Could not reproduce on Windows host, checked on FB 2.5.0 and 2.5.1; backup file was created both using services and without them. GBAK report ends always with:gbak:writing constraint INTEG_13
|
Submitted by: Javier Sanchez (thejavo)
Relate to CORE3651
Attachments:
problem.tar.gz
Votes: 1
When I try to backup a database with gbak I get the following lines:
gbak:writing constraint PK_UBI_MOVI_TMP
gbak:writing referential constraints
gbak:writing check constraints
gbak:writing SQL roles
gbak:writing names mapping
gbak:closing file, committing, and finishing. 2897449984 bytes written
gbak: ERROR:Error reading data from the connection.
gbak:Exiting before completion due to errors
gbak: ERROR:Error reading data from the connection.
this occurs when I write gbak -b -g -user sysdba -pas masterkey localhost:/data/base.gdb /data/base.gbk
the only solution that I've found is to backup the gdb via filesystem so I've wrote:
gbak -b -g -user sysdba -pas masterkey /data/base.gdb /data/base.gbk
that worked fine... I've tried Firebird CS 2.5.0, 2.5.1, 2.5.2 64 bits in serveral servers, in all cases the same result.
the gdb was broken, but after doing a gfix, and backedup and restored (via filesystem) I've assumed that all errors are gone... Am I wrong?, thanks in advance.
Commits: cf0128b 0afd11b 950f499 aa64bc7
====== Test Details ======
Could not reproduce on Windows host, checked on FB 2.5.0 and 2.5.1; backup file was created both using services and without them.
GBAK report ends always with:
gbak:writing constraint INTEG_13
gbak:writing constraint INTEG_14
gbak:writing constraint CLI_ARCH_PK
gbak:writing referential constraints
gbak:writing check constraints
gbak:writing SQL roles
gbak:writing names mapping
gbak:closing file, committing, and finishing. 9728 bytes written
No text with 'Error reading data from the connection'.
Also - no text 'writing constraint PK_UBI_MOVI_TMP' ==> attached file differs from that where problem raised.
The text was updated successfully, but these errors were encountered: