Skip to content

Fixes double-release of a connection. #295

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

artemredkin
Copy link
Collaborator

Motivation:
TaskHandler unconditionally releases it's connection on error,
this can lead to double release. This issue actually indicates
a more general issue where handler continues to handle errors
even after its state is .endOrError. We need to fix this by
ignoring all subsequent errors.

Modifications:

  1. Check state before calling out delegate and pool
  2. Replace all error callouts with call to errorCaught

Result:
Fixes #294

Motivation:
TaskHandler unconditionally releases it's connection on error,
this can lead to double release. This issue actually indicates
a more general issue where handler continues to handle errors
even after its state is `.endOrError`. We need to fix this by
ignoring all subsequent errors.

Modifications:
1. Check state before calling out delegate and pool
2. Replace all error callouts with call to `errorCaught`

Result:
Fixes swift-server#294
@artemredkin artemredkin added the kind/bug Feature doesn't work as expected. label Aug 20, 2020
@artemredkin artemredkin added this to the 1.2.1 milestone Aug 20, 2020
@artemredkin artemredkin requested a review from Lukasa August 20, 2020 14:05
@artemredkin artemredkin force-pushed the fix_handler_error_after_error branch from bb87dc8 to 4a5cc57 Compare August 20, 2020 14:11
Copy link
Collaborator

@Lukasa Lukasa left a comment

Choose a reason for hiding this comment

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

Looks like a solid fix to me.

@artemredkin artemredkin merged commit ffcd1e1 into swift-server:master Aug 20, 2020
@artemredkin artemredkin deleted the fix_handler_error_after_error branch August 20, 2020 14:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Feature doesn't work as expected.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Task Handler handles events even after channel.close
2 participants