Skip to content

Handle abnormal MySQL structure_load death gracefully#723

Merged
greg-rychlewski merged 7 commits intoelixir-ecto:masterfrom
greg-rychlewski:mysql_migration_fix
Mar 29, 2026
Merged

Handle abnormal MySQL structure_load death gracefully#723
greg-rychlewski merged 7 commits intoelixir-ecto:masterfrom
greg-rychlewski:mysql_migration_fix

Conversation

@greg-rychlewski
Copy link
Copy Markdown
Member

Closes #721

@greg-rychlewski greg-rychlewski marked this pull request as draft March 29, 2026 05:05
@greg-rychlewski greg-rychlewski marked this pull request as ready for review March 29, 2026 05:10
@greg-rychlewski greg-rychlewski changed the title Handle MySQL Structure Load Process Death Gracefully Handle abnormal MySQL structure_load death gracefully Mar 29, 2026
]

# Trap exits in case mysql dies in the middle of execution so that we can surface the error
Process.flag(:trap_exit, true)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need to trap exits? I am not sure if ports in Erlang are linked to the current process. But if we do have, we should probably revert the trap_exit flag to its original value once we are done!

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe so but definitely not an expert. I originally got it from the erlang docs example here: https://www.erlang.org/doc/system/c_port.html.

I also did a test here where I ignore the "normal" exist message and also don't trap exits and I didn't receive the abnormal exit message.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we should probably revert the trap_exit flag to its original value once we are done!

done!

@greg-rychlewski greg-rychlewski merged commit 9fbb80d into elixir-ecto:master Mar 29, 2026
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Error in middle of structure load can cause :epipe error and takes process down

2 participants