mirror of
https://github.com/apache/superset.git
synced 2026-05-12 19:35:17 +00:00
fix(mcp): prevent PendingRollbackError from poisoned sessions after SSL drops (#38934)
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
(cherry picked from commit d331a043a3)
This commit is contained in:
committed by
Michael S. Molina
parent
f1f757b5c5
commit
bda02a3fdc
@@ -742,7 +742,13 @@ async def generate_chart( # noqa: C901
|
||||
chart.id,
|
||||
exc_info=True,
|
||||
)
|
||||
db.session.rollback()
|
||||
try:
|
||||
db.session.rollback() # pylint: disable=consider-using-transaction
|
||||
except SQLAlchemyError:
|
||||
logger.warning(
|
||||
"Database rollback failed during chart re-fetch error handling",
|
||||
exc_info=True,
|
||||
)
|
||||
chart_data = {
|
||||
"id": chart.id,
|
||||
"slice_name": chart.slice_name,
|
||||
@@ -805,6 +811,14 @@ async def generate_chart( # noqa: C901
|
||||
return GenerateChartResponse.model_validate(result)
|
||||
|
||||
except (CommandException, SQLAlchemyError, KeyError, ValueError) as e:
|
||||
from superset import db
|
||||
|
||||
try:
|
||||
db.session.rollback() # pylint: disable=consider-using-transaction
|
||||
except SQLAlchemyError:
|
||||
logger.warning(
|
||||
"Database rollback failed during error handling", exc_info=True
|
||||
)
|
||||
await ctx.error(
|
||||
"Chart generation failed: error=%s, execution_time_ms=%s"
|
||||
% (
|
||||
|
||||
Reference in New Issue
Block a user