Skip to content
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

Document an expected crash #158

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

glessard
Copy link

@glessard glessard commented Jun 5, 2020

Follow-up to #157.

Adds the test with an assertCrashes block, to monitor if and when the official Combine stops crashing in this situation (FB7722681).

Note that Just and Optional.Publisher exhibit the same behaviour.

@codecov
Copy link

codecov bot commented Jun 5, 2020

Codecov Report

Merging #158 into master will decrease coverage by 0.02%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #158      +/-   ##
==========================================
- Coverage   98.40%   98.37%   -0.03%     
==========================================
  Files          84       84              
  Lines        4758     4744      -14     
==========================================
- Hits         4682     4667      -15     
- Misses         76       77       +1     
Impacted Files Coverage Δ
.../OpenCombineDispatch/DispatchQueue+Scheduler.swift 99.31% <0.00%> (-0.69%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update d680f09...a2376c8. Read the comment docs.

@OpenCombineBot
Copy link

OpenCombineBot commented Jun 5, 2020

LGTM

Generated by 🚫 Danger Swift against a2376c8

@glessard
Copy link
Author

glessard commented Jun 5, 2020

The proposed new test trips TSAN on Linux with:
ERROR: ThreadSanitizer: SEGV on unknown address 0x000000000000
This is not useful information, as we are expecting it to crash.

@broadwaylamb broadwaylamb self-requested a review June 5, 2020 20:10
@broadwaylamb
Copy link
Member

Honestly, I don't think this is the right direction. This is a data race, which is undefined behavior, meaning that anything could happen and, strictly speaking, a crash is not guaranteed to occur, for example, if GCD decides to map the global queue to a single CPU core.

@broadwaylamb
Copy link
Member

@glessard I'm curious though, how did you encounter this crash?

@glessard
Copy link
Author

There should not be a data race because cancel() is required to be thread-safe. This is in the contract for Subscription.
What got me down this road was trying to delay the request from a subscriber, but it may not have been this crash in particular. I found this one in particular by trying to reproduce/understand my original crash.

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.

None yet

3 participants