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-2476] Swift process crashes when printing out error #45081
Comments
The following backtrace can be seen: Welcome to Swift version 3.0-dev (LLVM 17c4c6cf7a, Clang 4ca9e01a7c, Swift 390016683e). Type :help for assistance.
1> import Foundation
2> do { try JSONSerialization.jsonObject(with: "HTTP".data(using: .utf8)!, options:.allowFragments) } catch let error { print("\(error)") }
Execution interrupted. Enter code to recover and continue.
Enter LLDB commands to investigate (type :help for assistance.)
3> :bt
* thread #​1: tid = 15106, 0x00007ffff7d0a467 libswiftCore.so`swift::TargetExistentialTypeMetadata<swift::InProcess>::projectValue(swift::OpaqueValue const*) const + 71, name = 'repl_swift', stop reason = signal SIGSEGV: invalid address (fault address: 0x90)
* frame #​0: 0x00007ffff7d0a467 libswiftCore.so`swift::TargetExistentialTypeMetadata<swift::InProcess>::projectValue(swift::OpaqueValue const*) const + 71
frame #​1: 0x00007ffff7cd50d8 libswiftCore.so`findDynamicValueAndType(swift::OpaqueValue*, swift::TargetMetadata<swift::InProcess> const*, swift::OpaqueValue*&, swift::TargetMetadata<swift::InProcess> const*&, bool&, bool) + 56
frame #​2: 0x00007ffff7cd5090 libswiftCore.so`swift_getDynamicType + 32
frame #​3: 0x00007ffff7b92507 libswiftCore.so`Swift._print_unlocked <A, B where B: Swift.TextOutputStream> (A, inout B) -> () + 55
frame #​4: 0x00007ffff7b2d1b7 libswiftCore.so`Swift.String.init <A> (stringInterpolationSegment : A) -> Swift.String + 55
frame #​5: 0x00007ffff7f6a1d6 $__lldb_expr4`main + 470
frame #​6: 0x00000000004009d0 repl_swift`swift_once + 16
frame #​7: 0x00007fffffffe3d0
frame #​8: 0x00007ffff6daa830 libc.so.6`__libc_start_main(main=(repl_swift`main), argc=1, argv=0x00007fffffffe548, init=<unavailable>, fini=<unavailable>, rtld_fini=<unavailable>, stack_end=0x00007fffffffe538) + 240 at libc-start.c:291
frame #​9: 0x00000000004009f9 repl_swift`_start + 41 |
@DougGregor, who's responsible for runtime-level error handling? |
@jckarter knows this code best |
Looks like a problem with printing and error existentials, not necessarily the error handling itself. |
Comment by Vlad Gorlov (JIRA) Hello.) Seems I got the same issue on iOS: #​0. Crashed: com.apple.main-thread
0 libswiftCore.dylib 0x1012045e4 swift::_swift_getClass(void const*) + 24
1 libswiftCore.dylib 0x1011ddc58 findDynamicValueAndType(swift::OpaqueValue*, swift::Metadata const*, swift::OpaqueValue*&, swift::Metadata const*&, bool&) + 192
2 libswiftCore.dylib 0x1011ddb88 swift_getDynamicType + 32
3 libswiftCore.dylib 0x101108d24 _TFs15_print_unlockedu0_R_s16OutputStreamTyperFTxRq__T_ + 60
4 DreamApp 0x100363d60 AppDelegate.(handleRequestIfNeeded(UIApplication, launchOptions : [NSObject : AnyObject]?) -> Bool).(closure #​1).(closure #​1) (AppDelegate.swift)
5 DreamApp 0x1000ed044 -[OAuthSignInManager completeWithError:shouldLogOut:] (OAuthSignInManager.m:79)
6 DreamApp 0x1000ece6c __42-[OAuthSignInManager tryToSignIn:failure:]_block_invoke.1394 (OAuthSignInManager.m:60)
7 DreamApp 0x1000de668 +[AccountAPI autoLoginWithCompletion:failure:] (AccountAPI.m:85)
8 DreamApp 0x1000eccdc -[OAuthSignInManager tryToSignIn:failure:] (OAuthSignInManager.m:62)
9 DreamApp 0x100363bc0 AppDelegate.(handleRequestIfNeeded(UIApplication, launchOptions : [NSObject : AnyObject]?) -> Bool).(closure #​1) (AppDelegate.swift:283)
10 DreamApp 0x10036cedc partial apply for AppDelegate.(handleRequestIfNeeded(UIApplication, launchOptions : [NSObject : AnyObject]?) -> Bool).(closure #​1) (AppDelegate.swift)
11 libdispatch.dylib 0x18e2e1200 _dispatch_call_block_and_release + 24
12 libdispatch.dylib 0x18e2e11c0 _dispatch_client_callout + 16
13 libdispatch.dylib 0x18e2e5d6c _dispatch_main_queue_callback_4CF + 1000
14 CoreFoundation 0x18f403f2c __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 12
15 CoreFoundation 0x18f401b18 __CFRunLoopRun + 1660
16 CoreFoundation 0x18f330048 CFRunLoopRunSpecific + 444
17 GraphicsServices 0x190db6198 GSEventRunModal + 180
18 UIKit 0x19531c2fc -[UIApplication _run] + 684
19 UIKit 0x195317034 UIApplicationMain + 208
20 Carmudi 0x1000abcf4 main (main.m:14)
21 libdispatch.dylib 0x18e3145b8 (Missing) System info:
Line of code where issues is happen: Now i am trying to use this line of code: |
Seeing what appears to be same issue: iOS 9, iPad 3 Xcode 8.3.3 w/ Swift 3.1 Stack trace from Crashlytics: Crashed: com.apple.main-thread 0 libswiftCore.dylib 0x130f000 swift::_swift_getClass(void const*)
1 libswiftCore.dylib 0x1307583 swift_getObjectType + 8
2 libswiftCore.dylib 0x12ecc91 findDynamicValueAndType(swift::OpaqueValue*, swift::TargetMetadata<swift::InProcess> const*, swift::OpaqueValue*&, swift::TargetMetadata<swift::InProcess> const*&, bool&, bool, bool) + 432
3 libswiftCore.dylib 0x12ecad9 swift_getDynamicType + 30
4 libswiftCore.dylib 0x112d6dc TFs15_print_unlockedu0_R_s16TextOutputStreamrFTxRqT + 120
5 ItsDeductible 0x1646fc DonationItem.receiptText.getter (DonationItemExtension.swift)
6 ItsDeductible 0x165ee8 @objc DonationItem.auditEntryDetails.getter + 1380072
7 ItsDeductible 0x17ddf8 DonationActivityItemSource.activityViewController(_:itemForActivityType (DonationActivityItemSource.swift:57)
8 ItsDeductible 0x17de84 @objc DonationActivityItemSource.activityViewController(_:itemForActivityType (DonationActivityItemSource.swift)
9 UIKit 0x250752e9 -[UIActivityViewController _activityItemValues] + 1672
10 UIKit 0x256f6cdd __88-[UIActivityViewController _availableActivitiesForItems:applicationExtensionActivities:]_block_invoke + 68
11 UIKit 0x2580b71d __91-[_UIActivityApplicationExtensionDiscovery activitiesMatchingInputItems:error:updateBlock:]_block_invoke_2 + 52
12 libdispatch.dylib 0x2046d823 _dispatch_call_block_and_release + 10
13 libdispatch.dylib 0x2046d80f _dispatch_client_callout + 22
14 libdispatch.dylib 0x2047bba9 _dispatch_main_queue_callback_4CF$VARIANT$mp + 1524
15 CoreFoundation 0x208c1b6d _CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE_ + 8
16 CoreFoundation 0x208c0067 __CFRunLoopRun + 1574
17 CoreFoundation 0x2080f229 CFRunLoopRunSpecific + 520
18 CoreFoundation 0x2080f015 CFRunLoopRunInMode + 108
19 GraphicsServices 0x21dffac9 GSEventRunModal + 160
20 UIKit 0x24ee3189 UIApplicationMain + 144
21 ItsDeductible 0x6e260 main (AppDelegate.swift:10)
22 libdispatch.dylib 0x204b7873 (Missing) |
Environment
Ubuntu 16.04.1 LTS running built (on 25 Aug. 2016) from source swift:
Swift version 3.0-dev (LLVM 17c4c6cf7a, Clang 4ca9e01a7c, Swift 3900166)
Target: x86_64-unknown-linux-gnu
Additional Detail from JIRA
md5: 885dcf5c262f6999c619fafcdbb702aa
Issue Description:
From REPL, the following code causes the process to die:
Removing the print statement produces the expected error:
Not catching the error also works:
Note that this does not occur on Darwin (Xcode 8 beta 6)
The text was updated successfully, but these errors were encountered: