mirror of https://github.com/citusdata/citus.git
Copy errmsg for distributed deadlock error into heap (#5641)
multi_log_hook() hook is called by EmitErrorReport() when emitting the ereport either to frontend or to the server logs. And some callers of EmitErrorReport() (e.g.: errfinish()) seems to assume that string fields of given ErrorData object needs to be freed. For this reason, we copy the message into heap here. I don't think we have faced with such a problem before but it seems worth fixing as it is theoretically possible due to the reasoning above.pull/5652/head^2
parent
152e512aa9
commit
ff3913ad99
|
@ -446,8 +446,16 @@ multi_log_hook(ErrorData *edata)
|
|||
MyBackendGotCancelledDueToDeadlock(clearState))
|
||||
{
|
||||
edata->sqlerrcode = ERRCODE_T_R_DEADLOCK_DETECTED;
|
||||
edata->message = "canceling the transaction since it was "
|
||||
"involved in a distributed deadlock";
|
||||
|
||||
/*
|
||||
* This hook is called by EmitErrorReport() when emitting the ereport
|
||||
* either to frontend or to the server logs. And some callers of
|
||||
* EmitErrorReport() (e.g.: errfinish()) seems to assume that string
|
||||
* fields of given ErrorData object needs to be freed. For this reason,
|
||||
* we copy the message into heap here.
|
||||
*/
|
||||
edata->message = pstrdup("canceling the transaction since it was "
|
||||
"involved in a distributed deadlock");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue