Skip to content

fix: prevent pmap from getting stuck forever - #112

Merged
zhongwencool merged 1 commit into
masterfrom
0609-fix-pmap-error-handling
Jun 10, 2023
Merged

zhongwencool merged 1 commit into
masterfrom
0609-fix-pmap-error-handling

Conversation

@savonarola

Copy link
Copy Markdown
Contributor

No description provided.

Comment thread src/minirest_util.erl
receive
{result, Pid, {normal, Result}} -> Result;
{result, Pid, {crash, {C, E, ST}}} -> erlang:raise(C, E, ST);
{result, Pid, {crash, {C, E, ST}}} -> {error, {El, {C, E, ST}}};

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

If pmap caller traps exits, then in case of crash it was stuck forever because:

  • the caller pid receives EXIT as a message
  • but it never handles it, because pmap_exec process crashes and timeout message is not sent, so pmap_gather waits forever.

@savonarola
savonarola requested a review from zhongwencool June 9, 2023 10:56
@zhongwencool
zhongwencool merged commit d5d978b into master Jun 10, 2023
@zhongwencool
zhongwencool deleted the 0609-fix-pmap-error-handling branch June 10, 2023 11:19
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.

2 participants