Skip to content

Fixes double-release of a connection.#295

Merged
artemredkin merged 2 commits into
swift-server:masterfrom
artemredkin:fix_handler_error_after_error
Aug 20, 2020
Merged

Fixes double-release of a connection.#295
artemredkin merged 2 commits into
swift-server:masterfrom
artemredkin:fix_handler_error_after_error

Conversation

@artemredkin

Copy link
Copy Markdown
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

@Lukasa Lukasa left a comment

Copy link
Copy Markdown
Collaborator

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