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

[SR-10230] Test crash only when release build #52630

Open
t-ae opened this issue Mar 29, 2019 · 3 comments
Open

[SR-10230] Test crash only when release build #52630

t-ae opened this issue Mar 29, 2019 · 3 comments
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler in itself crash Bug: A crash, i.e., an abnormal termination of software optimized only Flag: An issue whose reproduction requires optimized compilation run-time crash Bug → crash: Swift code crashed during execution

Comments

@t-ae
Copy link
Contributor

t-ae commented Mar 29, 2019

Previous ID SR-10230
Radar None
Original Reporter @t-ae
Type Bug
Environment

macOS 10.14.4
Apple Swift version 5.0 (swiftlang-1001.0.69.5 clang-1001.0.46.3)
Apple Swift Package Manager - Swift 5.0.0 (swiftpm-14490.60.2)

Additional Detail from JIRA
Votes 0
Component/s Compiler
Labels Bug, OptimizedOnly, RunTimeCrash
Assignee None
Priority Medium

md5: 845ace8db0c7d9fa8e2d39f10d260e2e

Issue Description:

Reproduction
https://github.com/t-ae/memory-crash-test

Clone and run `swift test -c release`, then crash.
If it's `swift test`, it works well.

$ swift test -c release
 [3/3] Linking ./.build/x86_64-apple-macosx/release/memory-crash-testPackageTeTest Suite 'All tests' started at 2019-03-29 18:38:34.556
 Test Suite 'memory-crash-testPackageTests.xctest' started at 2019-03-29 18:38:34.556
 Test Suite 'memory_crash_testTests' started at 2019-03-29 18:38:34.556
 Test Case '-[memory_crash_testTests.memory_crash_testTests testExample]' started.
 broadcast: start
 broadcast: end
 will exit testExample
 Exited with signal code 11

Crash happens before `defer` block.
https://github.com/t-ae/memory-crash-test/blob/dd94ef4f76d546033cb41e2e84fad9484362f375/Tests/memory-crash-testTests/memory_crash_testTests.swift#L6

And if this meaningless line is commented in, crash doesn't happen.
https://github.com/t-ae/memory-crash-test/blob/dd94ef4f76d546033cb41e2e84fad9484362f375/Sources/memory-crash-test/Broadcast.swift#L22

@belkadan
Copy link
Contributor

aschwaighofer@apple.com (JIRA User), is it possible this is the same as the enum thing you just fixed?

@aschwaighofer
Copy link
Member

No I don't think so because I don't see any single payload enum where the payload has no extra inhabitants and with at least two non payload cases involved.

But the test succeeds on a recent trunk build:

$ git clone https://github.com/t-ae/memory-crash-test.git
Cloning into 'memory-crash-test'...
remote: Enumerating objects: 19, done.
remote: Counting objects: 100% (19/19), done.
remote: Compressing objects: 100% (13/13), done.
remote: Total 19 (delta 4), reused 19 (delta 4), pack-reused 0
Unpacking objects: 100% (19/19), done.
$ cd memory-crash-test/
$ /Library/Developer/Toolchains/swift-DEVELOPMENT-SNAPSHOT-2019-03-25-a.xctoolchain/usr/bin/swift test -c release
[2/2] Linking ./.build/x86_64-apple-macosx/release/memory-crash-testPackageTests.xctest/Contents/MacOS/memory-crash-testPackageTests
Test Suite 'All tests' started at 2019-03-29 09:08:59.929
Test Suite 'memory-crash-testPackageTests.xctest' started at 2019-03-29 09:08:59.930
Test Suite 'memory_crash_testTests' started at 2019-03-29 09:08:59.930
Test Case '-[memory_crash_testTests.memory_crash_testTests testExample]' started.
broadcast: start
broadcast: end
will exit testExample
end testExample
Test Case '-[memory_crash_testTests.memory_crash_testTests testExample]' passed (0.083 seconds).
Test Suite 'memory_crash_testTests' passed at 2019-03-29 09:09:00.013.
         Executed 1 test, with 0 failures (0 unexpected) in 0.083 (0.083) seconds
Test Suite 'memory-crash-testPackageTests.xctest' passed at 2019-03-29 09:09:00.014.
         Executed 1 test, with 0 failures (0 unexpected) in 0.083 (0.084) seconds
Test Suite 'All tests' passed at 2019-03-29 09:09:00.014.
         Executed 1 test, with 0 failures (0 unexpected) in 0.083 (0.084) seconds

@aschwaighofer
Copy link
Member

Also succeeded with a recent swift-5.1-branch build.

$ /Library/Developer/Toolchains/swift-5.1-DEVELOPMENT-SNAPSHOT-2019-03-29.xctoolchain/usr/bin/swift test -c release                  
[3/3] Linking memory-crash-testPackageTests                                                                                                                                                                                                                 Test Suite 'All tests' started at 2019-03-29 09:22:48.179                                                                                                                                                                            
Test Suite 'memory-crash-testPackageTests.xctest' started at 2019-03-29 09:22:48.179                                                                                                                                                                        Test Suite 'memory_crash_testTests' started at 2019-03-29 09:22:48.179                                                                                                                                                                                      Test Case '-[memory_crash_testTests.memory_crash_testTests testExample]' started.                                                                                                                                                                           broadcast: start                                                                                                                                                                                                                     
broadcast: end                                                                                                                                                                                                                                              will exit testExample                                                                                                                                                                                                                        
end testExample                                                                                                                                                                                                                                             Test Case '-[memory_crash_testTests.memory_crash_testTests testExample]' passed (0.057 seconds).                                                                                                                                                            Test Suite 'memory_crash_testTests' passed at 2019-03-29 09:22:48.236.                                                                                                                                               
         Executed 1 test, with 0 failures (0 unexpected) in 0.057 (0.057) seconds                                                                      
Test Suite 'memory-crash-testPackageTests.xctest' passed at 2019-03-29 09:22:48.236.                         
         Executed 1 test, with 0 failures (0 unexpected) in 0.057 (0.057) seconds                                                                                                                                                    
Test Suite 'All tests' passed at 2019-03-29 09:22:48.236.                                                                      
         Executed 1 test, with 0 failures (0 unexpected) in 0.057 (0.057) seconds

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
@AnthonyLatsis AnthonyLatsis added the crash Bug: A crash, i.e., an abnormal termination of software label Dec 12, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler in itself crash Bug: A crash, i.e., an abnormal termination of software optimized only Flag: An issue whose reproduction requires optimized compilation run-time crash Bug → crash: Swift code crashed during execution
Projects
None yet
Development

No branches or pull requests

4 participants