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-9203] SuperChars benchmark crash #51693

Closed
palimondo mannequin opened this issue Nov 7, 2018 · 9 comments
Closed

[SR-9203] SuperChars benchmark crash #51693

palimondo mannequin opened this issue Nov 7, 2018 · 9 comments
Assignees
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 run-time crash Bug → crash: Swift code crashed during execution standard library Area: Standard library umbrella

Comments

@palimondo
Copy link
Mannequin

palimondo mannequin commented Nov 7, 2018

Previous ID SR-9203
Radar rdar://problem/47158241
Original Reporter @palimondo
Type Bug
Status Resolved
Resolution Done
Environment

Swift on master: commit f2c4250
macOS High Sierra: 10.13.6 (17G65)

Additional Detail from JIRA
Votes 0
Component/s Compiler, Standard Library
Labels Bug, RunTimeCrash
Assignee @milseman
Priority Medium

md5: 70c4e538f4ef695575e02df69d59b9f8

Issue Description:

The SuperChars benchmark from the Swift Benchmarking Suite is crashing on latest master.

It seems that after landing PR #20315,
the multi-flag emojis are failing the sanity check in Character initialization:

$ ./Benchmark_O SuperChars
#,TEST,SAMPLES,MIN(μs),MAX(μs),MEAN(μs),SD(μs),MEDIAN(μs)
Fatal error: file /Users/mondo/Developer/swift-source/swift/stdlib/public/core/Character.swift, line 82
Current stack trace:
0    libswiftCore.dylib                 0x0000000108489cb0 _swift_stdlib_reportFatalErrorInFile + 116
1    libswiftCore.dylib                 0x00000001083a9130 specialized closure #​1 in closure #​1 in closure #​1 in _fatalErrorMessage(_:_:file:line:flags:) + 306
2    libswiftCore.dylib                 0x000000010833dcd0 specialized closure #​1 in closure #​1 in _fatalErrorMessage(_:_:file:line:flags:) + 113
3    libswiftCore.dylib                 0x000000010833e090 specialized closure #​1 in _fatalErrorMessage(_:_:file:line:flags:) + 99
4    libswiftCore.dylib                 0x000000010833e430 specialized _fatalErrorMessage(_:_:file:line:flags:) + 561
5    libswiftCore.dylib                 0x000000010834ed40 specialized Character._invariantCheck() + 179
6    libswiftCore.dylib                 0x0000000108166760 Character._invariantCheck() + 9
7    Benchmark_O                        0x0000000107f9a560 globalinit_33_BF26B45B13997F01E53CA304BE2C1E8C_func1 + 2830
8    libdispatch.dylib                  0x00007fff5829ddb0 _dispatch_client_callout + 8
9    libdispatch.dylib                  0x00007fff5829dd42 dispatch_once_f + 41
10   libswiftCore.dylib                 0x0000000108448460 swift_once + 25
11   Benchmark_O                        0x0000000107f9a4a0 closure #​1 in variable initialization expression of SuperChars + 40
12   Benchmark_O                        0x0000000107cedcc0 TestRunner.run(_:) + 1577
13   Benchmark_O                        0x0000000107cf1ad0 TestRunner.runBenchmarks() + 898
14   Benchmark_O                        0x0000000107cf3430 main() + 2580
15   Benchmark_O                        0x0000000107fc9000 main + 11345
16   libdyld.dylib                      0x00007fff582d7014 start + 1
Illegal instruction: 4
@palimondo
Copy link
Mannequin Author

palimondo mannequin commented Nov 7, 2018

CC @milseman

@milseman
Copy link
Mannequin

milseman mannequin commented Nov 7, 2018

Umm, those aren't single-grapheme. They should fail with a hard precondition failure, not just an internal assertion

@palimondo
Copy link
Mannequin Author

palimondo mannequin commented Nov 7, 2018

Are you saying the multi-flags in SuperChars should have never worked (there was a bug before, and the benchmark is written incorrectly)? (Do we have a gap in test coverage?)

How come it all worked when you ran it on swift-ci in the PR?

I thought it was just problem on my machine and have expected the issue was some kind of a difference between High Sierra and Mojave...

@milseman
Copy link
Mannequin

milseman mannequin commented Nov 7, 2018

The crash as an internal invariant check (that there's only one grapheme present) upon creation of the Character. If you have stdlib asserts enabled, then it will crash. The PR didn't trigger it because benchmark numbers are kinda meaningless if the stdlib has assertions turned on.

Good for extra testing, though. We'll have to figure out if a full precondition is the right thing here...

@milseman
Copy link
Mannequin

milseman mannequin commented Nov 7, 2018

@palimondo
Copy link
Mannequin Author

palimondo mannequin commented Nov 7, 2018

I'm pretty sure I was running this without stdlib asserts enabled:
./swift/utils/build-script -R -B

and same results for

ninja -C ${SWIFT_BUILD_DIR} swift-benchmark-macosx-x86_64

Can you reproduce the crash? I really don't understand how it passed through swift-ci. // cc @eeckstein

@milseman
Copy link
Mannequin

milseman mannequin commented Nov 7, 2018

That builds with assertions. You need --no-assertions or --no-swift-stdlib-assertions.

@palimondo
Copy link
Mannequin Author

palimondo mannequin commented Nov 7, 2018

<mind blown![](> Thanks, gonna try that)

/build/Ninja-Release*Assert*/swift-macosx-x86_64/ – so that's what the Assert meant!

@milseman
Copy link
Mannequin

milseman mannequin commented Jan 10, 2019

#21761

@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
This issue was closed.
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 run-time crash Bug → crash: Swift code crashed during execution standard library Area: Standard library umbrella
Projects
None yet
Development

No branches or pull requests

1 participant