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-10949] Sourcekitd crashed making a CursorInfo request #53340

Open
ChristopherRogers opened this issue Jun 17, 2019 · 6 comments
Open

[SR-10949] Sourcekitd crashed making a CursorInfo request #53340

ChristopherRogers opened this issue Jun 17, 2019 · 6 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 found by stress tester Flag: An issue found by the SourceKit stress tester

Comments

@ChristopherRogers
Copy link
Contributor

Previous ID SR-10949
Radar None
Original Reporter @ChristopherRogers
Type Bug

Attachment: Download

Environment

swift-DEVELOPMENT-SNAPSHOT-2019-06-06-a or swift-5.1-DEVELOPMENT-SNAPSHOT-2019-06-15-a
Xcode 11 beta 1 (11M336w)

sk-stress-test --rewrite-mode=concurrent /path/to/Foo.swift swiftc -sdk /Applications/Xcode-beta.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.0.sdk -target x86_64-apple-ios10.0-simulator /path/to/Foo.swift

Additional Detail from JIRA
Votes 0
Component/s Source Tooling
Labels Bug, CompilerCrash, FoundByStressTester
Assignee None
Priority Medium

md5: 64085663e3c2e65713d51c345b5a5a94

Issue Description:

Assertion failed: (!baseName.isSpecial() && "Can't retrieve the identifier of a special base name"), function getBaseIdentifier, file /Users/buildnode/jenkins/workspace/oss-swift-package-osx/swift/include/swift/AST/Identifier.h, line 449.

sourcekit: [1:connection-event-handler:8515: 0.0000] Connection interruptFailure detected: SourceKit crashed
  request: CursorInfo in /Users/JP61036/Code/line-ios/Logger.swift (modified: insideOut) at offset 51 with args: -sdk /Applications/Xcode-beta.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.0.sdk -target x86_64-apple-ios10.0-simulator swift-5.1-DEVELOPMENT-SNAPSHOT-2019-06-15-a /Users/JP61036/Code/line-ios/Logger.swift
-- begin file content --------
extension Foo {
    init(_ bar: Bar) 
        self.<cursor-offset>init
-- end file content ----------
sourcekit: [1:updateSemanticEditorDelay:8515: 0.0009] disabling semantic editor for 10 secondssourcekit: [1:pingService:8515: 0.0010] pinging servicesourcekit: [1:ping-event-handler:9475: 0.0011] connection invalid error
@belkadan
Copy link
Contributor

davidungar (JIRA User), the backtrace looks like some of your refactorings? Not sure, though.

@swift-ci
Copy link
Collaborator

Comment by David Ungar (JIRA)

Thanks, @belkadan. I'll take a look.

@swift-ci
Copy link
Collaborator

Comment by David Ungar (JIRA)

The portion that passes through my refactoring was also there before the refactoring.

(See line 1220-1224 in NameLookup.cpp, commit 18f4bcb.)

I'm happy to look at it; @belkadan, can you tell me how to reproduce this kind of crash?

@belkadan
Copy link
Contributor

I haven't ever actually had to myself. @nathawes, @nkcsgexi?

@nathawes
Copy link
Collaborator

You can reproduce it using the sourcekit-test utility, which should be in bin next to swiftc if you're building locally:

1. Add the content between the 'begin/end file content' markers to a new file e.g. /tmp/test.swift:

extension Foo {
    init(_ bar: Bar) 
        self.<cursor-offset>init

2. work out the character offset of and remove the '<cursor-offset>' part from the file (51 in this case) and save.
3. in your local build directory run 'sourcekitd-test' as below to reproduce the crash:

<build-dir>/bin/sourcekitd-test -req=cursor -offset=51 /tmp/test.swift -- /tmp/test.swift

The bit after the -- is the swift compiler args to use for the file you're interested in. In this case it's a self-contained invalid file, so we don't need anything other than the file itself.

@swift-ci
Copy link
Collaborator

Comment by David Ungar (JIRA)

Thanks a bunch, @belkadan and @nathawes . I've got a putative fix: #25584 . If it passes review, I'll land it.

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
@AnthonyLatsis AnthonyLatsis added crash Bug: A crash, i.e., an abnormal termination of software compiler The Swift compiler in itself labels 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 found by stress tester Flag: An issue found by the SourceKit stress tester
Projects
None yet
Development

No branches or pull requests

5 participants