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

[YSQL] Postgres crash in 2.12.7, 2.12.8 and 2.12.9 release. #13348

Closed
sushantrmishra opened this issue Jul 19, 2022 · 0 comments
Closed

[YSQL] Postgres crash in 2.12.7, 2.12.8 and 2.12.9 release. #13348

sushantrmishra opened this issue Jul 19, 2022 · 0 comments
Assignees
Labels
area/ysql Yugabyte SQL (YSQL) kind/bug This issue is a bug priority/critical Critical issue
Projects

Comments

@sushantrmishra
Copy link

sushantrmishra commented Jul 19, 2022

Jira Link: DB-2980

Analysis

On a change to show transaction's priority to users (#12775), the backport to 2.12 introduced a bug that allows for queries to access txn_ field, which can be null.

This crash happens when the transaction has not started and yb_transaction_priority is retrieved.

The crash can be reproduced by following commands:

  • select * from pg_catalog.pg_settings;
  • show yb_transaction_priority;

2.14 and 2.15 releases are not impacted by this.

Description

We have observed crash in 2.12.7, 2.12.8 and 2.12.9 release. This is regression caused by GH #12775 .

yugabyte=# select * from pg_catalog.pg_settings;
server closed the connection unexpectedly
	This probably means the server terminated abnormally
	before or while processing the request.
The connection to the server was lost. Attempting reset: Failed.
!> 
yugabyte=# show yb_transaction_priority;
server closed the connection unexpectedly
        This probably means the server terminated abnormally
        before or while processing the request.
The connection to the server was lost. Attempting reset: Failed.
!> \q

If the transaction is started then retrieving the transaction priority does not result in the crash.

yugabyte=# begin;
BEGIN
yugabyte=# insert into t values (4);
INSERT 0 1
yugabyte=# begin;
yugabyte=# show yb_transaction_priority;
          yb_transaction_priority
-------------------------------------------
 0.179627565 (Normal priority transaction)
(1 row)

Relevant stack trace:

Call stack:
yb::client::YBTransaction::GetPriority() const (@yb::client::YBTransaction::GetPriority() const:5)
yb::pggate::PgTxnManager::GetTransactionPriorityType() const (@yb::pggate::PgTxnManager::GetTransactionPriorityType() const:7)
show_transaction_priority (@show_transaction_priority:9)
_ShowOption (@_ShowOption:101)
GetConfigOptionByNum (@GetConfigOptionByNum:41)
show_all_settings (@show_all_settings:179)
ExecMakeTableFunctionResult (@ExecMakeTableFunctionResult:123)
FunctionNext (@FunctionNext:29)
standard_ExecutorRun (@standard_ExecutorRun:90)
pgss_ExecutorRun (@pgss_ExecutorRun:44)

Resolution

We should use the equivalent of saved_priority_ as in the master to retrieve the priority.

@sushantrmishra sushantrmishra added area/ysql Yugabyte SQL (YSQL) status/awaiting-triage Issue awaiting triage labels Jul 19, 2022
@yugabyte-ci yugabyte-ci added kind/bug This issue is a bug priority/medium Medium priority issue labels Jul 19, 2022
@yugabyte-ci yugabyte-ci removed the status/awaiting-triage Issue awaiting triage label Jul 19, 2022
@sushantrmishra sushantrmishra added this to Backlog in YSQL via automation Jul 19, 2022
lnguyen-yugabyte added a commit that referenced this issue Jul 19, 2022
…e active transaction in current session"

Summary:
When `0a12cb7ff08cd0afbc29986c62c5481385510097` was backported to 2.12, bug was introduced when backporting: we try to access txn's priority using txn_->GetPriority();, even when txn_ might be null. This results in a crash when trying to access the priority of such nonexistent txn (see #13348 for details).

This reverts commit 99ffb31.

Test Plan: jenkins: rebase 2.12.9

Reviewers: smishra, pjain

Reviewed By: smishra, pjain

Differential Revision: https://phabricator.dev.yugabyte.com/D18418
@yugabyte-ci yugabyte-ci added priority/critical Critical issue and removed priority/medium Medium priority issue labels Jul 20, 2022
YSQL automation moved this from Backlog to Done Aug 11, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/ysql Yugabyte SQL (YSQL) kind/bug This issue is a bug priority/critical Critical issue
Projects
YSQL
  
Done
Development

No branches or pull requests

3 participants