-
-
Notifications
You must be signed in to change notification settings - Fork 240
Improve diagnostics and stability during BUGCHECK #7270
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
Open
ilya071294
wants to merge
5
commits into
FirebirdSQL:master
Choose a base branch
from
red-soft-ru:5_0_bugcheck_fixes
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 4 commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
62c900f
Print a function name in error messages in cases when a file descript…
ilya071294 556c3fd
Put the error message into firebird.log before BUGCHECK actions becau…
ilya071294 e4c084f
Do not print errno in error messages in cases when a file descriptor …
ilya071294 d42db21
Do not reset buffer flags in CCH_shutdown when it's called from ERR_b…
ilya071294 a75d1fa
Merge branch 'master' into 5_0_bugcheck_fixes
ilya071294 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It also avoids flush, is it intended ? If yes, is it really good thought out ?
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
CCH_flush
wouldn't be called anyway becauseDBB_bugcheck
flag is already set at the moment, andLongJump::raise()
is called in this case.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok.
In this case - is
bugcheck
agrument really necessary ?Does
DBB_bugcheck
flag might be used instead ?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, it is not clear what happens with backup lock if
clear_dirty_flag_and_nbak_state()
not calledThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess no because later
CCH_shutdown
will be called again inJRD_shutdown_database
. This time withbugcheck == false
, andclear_dirty_flag_and_nbak_state()
will be finally called.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
BDB_db_dirty
andBDB_dirty
are cleared but pages are not flushed. In concurrent environment other threads may want to write some pages according to the precedence and they may assume that these pages are written but actually they are not.I did and
clear_dirty_flag_and_nbak_state()
is certainly called duringJRD_shutdown_database
(both CS and SS). Is there any case where we can get better results from callingclear_dirty_flag_and_nbak_state()
earlier? The old code seems good for CS but for SS I don't see how it can be safely called before other attachments/threads are stopped.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, this made me to look at the issue from another side.
AFAIU, the goal of the immediate call of CCH_shutdown() when database is bug-checked is to stop all database IO ASAP and not allow to write anything. Note, page cache is not flushed and database file is closed. Thus, even in concurrent environment, no other thread should be able to write any page. So, the real problem is - how to effectively disable IO after bugcheck (and don't spam firebird.log with messages about invalid file handle), IMHO.
On Windows, I would try to use
jrd_file::fil_ext_lock
to block all database IO. Of course, PIO should add check forDBB_bugcheck
flag after acquiringjrd_file::fil_ext_lock
.POSIX implementation have no this lock, but I see no problem to add it there.
Probably, PIO_read() should be allowed after bugcheck and database file should not be closed immediately (as we already prohibit any writes).
Looks like this is out of scope of this ticket, btw. But it is always better to fix root issue, IMO
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about
abort()
? Core dump will be a bonus.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
abort()
is called whenBugcheckAbort
is set totrue
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PIO_write
at the moment.If we really need this lock then changes from #8146 may help with it.