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

Fix crash due to txns in emit_log_hook_callback #2987

Merged
merged 1 commit into from
Mar 3, 2021

Commits on Mar 3, 2021

  1. Fix crash due to txns in emit_log_hook_callback

    A weird crash was coming up while running the bgw_db_scheduler test
    while using log_min_messages with DEBUG3 setting. So what's happening
    here is that we register a RegisterXactCallback callback which gets
    called at post-commit time. This remote_connection_xact_end callback
    was issuing a debug3 level message. As part of its processing, the
    emit_log_hook_callback function was trying to write this message
    to a catalog table via a transaction. Obviously trying to start a
    transaction at this post-commit stage will error out and leads to
    weird behavior and crashes. In general it's not a good idea to have
    emit_log_hook_callback functions start transactions because messages
    can be emitted at any point of a transaction cycle, but we have to live
    with the current code for now.
    
    The fix is to reset the emit_log_hook in these xact_end callback
    functions. Additionally the emit_log_hook_callback function is only
    interested in elog/ereport messages with elevel LOG or above. So add
    that check in the emit_log_hook_callback as well.
    nikkhils committed Mar 3, 2021
    Configuration menu
    Copy the full SHA
    10e5799 View commit details
    Browse the repository at this point in the history