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-5330] Swift 4 Segmentation Faults Constantly on Realm #47904

Closed
swift-ci opened this issue Jun 28, 2017 · 6 comments
Closed

[SR-5330] Swift 4 Segmentation Faults Constantly on Realm #47904

swift-ci opened this issue Jun 28, 2017 · 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 regression serialization Area → compiler: Serialization & deserialization swift 4.0

Comments

@swift-ci
Copy link
Collaborator

Previous ID SR-5330
Radar rdar://problem/32677610
Original Reporter JeSuisLuis (JIRA User)
Type Bug
Status Resolved
Resolution Done
Environment
  Model Name:   iMac
  Model Identifier: iMac17,1
  Processor Name:   Intel Core i5
  Processor Speed:  3.2 GHz
  Number of Processors: 1
  Total Number of Cores:    4
  L2 Cache (per Core):  256 KB
  L3 Cache: 6 MB
  Memory:   24 GB
  Boot ROM Version: IM171.0105.B20
  SMC Version (system): 2.33f10

  Realm version 2.8.3
  Xcode 9 Beta 2
  Cocoapods 1.3.0.beta.2
  
  Podfile: 

platform :ios, '9.0'
use_frameworks!
inhibit_all_warnings!

def all_pods
  pod 'RealmSwift'
  pod 'UICircularProgressRing'
  pod 'UIEmptyState'
  pod 'LPIntegratedRating'
end

target 'GradePoint' do
  all_pods
end

target 'GradePointTests' do 
  all_pods
end

target 'GradePointUITests' do 
  all_pods
end

post_install do |installer|
  installer.pods_project.targets.each do |target|
    
    puts target.name

    target.build_configurations.each do |config|
      config.build_settings['SWIFT_VERSION'] = ‘4.0’

    end
  end
end


Additional Detail from JIRA
Votes 0
Component/s Compiler
Labels Bug, 4.0Regression, CompilerCrash, Serialization
Assignee None
Priority Medium

md5: cbfd64381e21f6216f34f44c12e8c9b2

Issue Description:

Since upgrading to Swift 4 and Xcode 9 Beta 2. The amount of segfaults I have received have increased tenfold. At this point the compiler is segfaulting for simple spelling mistakes. There are no actual errors given just the basic
Command failed due to signal: Segmentation fault: 11 error.

Not exactly sure what is causing all these segfaults but I have noticed that Realm seems be involved in causing these. Removing my import for RealmSwift when the compiler has segfaulted and rebuilding seems to generate actual error messages and such.

Here is a log of a segfault where spelling statu as status inside a switch caused a segfault:

CompileSwift normal x86_64 

1.  While type-checking 'ratingViewDidFinish' at /Users/luis/Programming/iOS/GradePoint/GradePoint/ClassesTableViewController.swift:865:5
2.  While type-checking expression at [/Users/luis/Programming/iOS/GradePoint/GradePoint/ClassesTableViewController.swift:866:16 - line:866:16] RangeText="s"
3.  While reading from /Users/luis/Library/Developer/Xcode/DerivedData/GradePoint-bcqivkdwawhfzphbxypksxkvsblz/Build/Products/Debug-iphonesimulator/RealmSwift/RealmSwift.framework/Modules/RealmSwift.swiftmodule/x86_64.swiftmodule
4.  While deserializing 'SyncPermissionResults' (TypeAliasDecl #​529) in 'RealmSwift'
5.  While deserializing 'RLMSyncPermissionResults' (ClassDecl #​531) in 'RealmSwift'
6.  Cross-reference to module 'Realm'
    ... RLMSyncPermissionResults
7.  /Users/luis/Library/Developer/Xcode/DerivedData/GradePoint-bcqivkdwawhfzphbxypksxkvsblz/Build/Products/Debug-iphonesimulator/Realm/Realm.framework/Headers/RLMSyncPermissionResults.h:49:12: importing 'RLMSyncPermissionResults'
8.  While type-checking 'deinit' in module 'Realm'
9.  While loading conformances for extension of RLMSyncPermissionResults in module 'RealmSwift'
10. While reading conformance for type 'RLMSyncPermissionResults'
11. While ... to 'BidirectionalCollection' in module 'Swift'
12. While reading conformance for type 'RLMSyncPermissionResults'
13. While ... to 'Collection' in module 'Swift'
14. While reading conformance for type 'RLMSyncPermissionResults'
15. While ... to 'Sequence' in module 'Swift'
16. While deserializing 'Iterator' (TypeAliasDecl #​536) in 'RealmSwift'

A full project can be found here using the ios11 branch while running on Xcode 9 Beta 1 - 2. Just writing basic code causes issues on my setup, and im guessing it will happen for anyone else too.

@belkadan
Copy link
Contributor

As a workaround, you can add "-Xfrontend -disable-typo-correction" to your "Other Swift Flags" build setting for now.

@swift-ci
Copy link
Collaborator Author

Comment by Luis Padron (JIRA)

@belkadan This has definitely helped with the segfaults, however syntax highlighting and auto completion is basically broken. As soon as I begin typing they get removed. Not sure what could be causing that issue.

@belkadan
Copy link
Contributor

Hm, maybe SourceKit isn't picking up the Other Swift Flags.

@belkadan
Copy link
Contributor

belkadan commented Jul 5, 2017

Fixed in #10715

4.0 PR: #10765

@swift-ci
Copy link
Collaborator Author

Comment by Luis Padron (JIRA)

@belkadan Thanks for fixing this! Is there anyway to test this currently with Xcode 9 beta 2? Or will this be released in a new beta?

@belkadan
Copy link
Contributor

You can grab a "development snapshot" from https://swift.org/download/#swift-40-development, as long as it was built after the day the fix went in.

@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 regression serialization Area → compiler: Serialization & deserialization swift 4.0
Projects
None yet
Development

No branches or pull requests

3 participants