diff --git a/src/backend/tcop/postgres.c b/src/backend/tcop/postgres.c index 585db1a..2e04231 100644 --- a/src/backend/tcop/postgres.c +++ b/src/backend/tcop/postgres.c @@ -2918,6 +2918,20 @@ ProcessInterrupts(void) DisableNotifyInterrupt(); DisableCatchupInterrupt(); pgstat_report_recovery_conflict(RecoveryConflictReason); + + /* + * If we are in DoingCommandRead state, we can't really use + * ereport(ERROR) because long jumps are not recommended in this + * state. By throwing longjmps in this state, we not only risks of + * breaking protocol at our level, but also risks leaving openssl + * in an inconsistent state, either violating the ssl protocol or + * simply with internal state trashed because it got interrupted + * in the middle of changing it. + * + * Our best possible remedy for now is to promote ERROR to FATAL + * until we figure out a way to handle errors more effectively in + * this state. + */ if (DoingCommandRead) ereport(FATAL, (errcode(ERRCODE_T_R_SERIALIZATION_FAILURE),