Open
Description
Previous ID | SR-3199 |
Radar | None |
Original Reporter | tylercloutier (JIRA User) |
Type | Bug |
Additional Detail from JIRA
Votes | 0 |
Component/s | Foundation, libdispatch |
Labels | Bug |
Assignee | mww (JIRA) |
Priority | Medium |
md5: 1641e42bfc66b37d5426aff6370cf49c
Issue Description:
It appears that the cancel handler is never invoked after calling cancel on a DispatchSource in Swift 3 on macOS.
This issue can be replicated by following steps with Swift 3.0.1.
- Clone https://github.com/SwiftOnEdge/Edge.git
- Check out the commit 1bc2552c3f7cb0d33080d65b1290008ac5342cdf
- Comment out line 125 of /Sources/TCP/Server.swift and insert print statement there.
- Insert a print statement in the cancelHandler on line 47 of the same file
- Run the test RouterTests.testMiddleware
You should see that although the cancel in invoked, the test completes without ever invoking the cancel handler configured on line 47.
Shouldn't the listeningSource maintain a strong reference to the handler and submit it to the main queue (in this case) to be run when cancel is invoked or am I misunderstanding something about the contract of cancel?
Note: This is on macOS. I have not tested this for Linux.