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-5277] Passing encoder to super class causes EXC_BAD_ACCESS #47852
Comments
cc @itaiferber |
Backtrace from the failure: fatal error: Attempt to encode with new container when already encoded with keyed container.: file /Users/itai/Development/swift-oss/swift/stdlib/public/SDK/Foundation/JSONEncoder.swift, line 216
Current stack trace:
0 libswiftCore.dylib 0x0000000116d67930 reportNow(unsigned int, char const*) + 151
1 libswiftCore.dylib 0x0000000116d67900 swift_reportError + 27
2 libswiftCore.dylib 0x0000000116e467e0 _swift_stdlib_reportFatalErrorInFile + 168
3 libswiftCore.dylib 0x0000000116843020 closure #​1 in closure #​1 in closure #​1 in _assertionFailure(_:_:file:line:flags:) + 1658
4 libswiftCore.dylib 0x0000000116d4fcc0 partial apply for closure #​1 in closure #​1 in closure #​1 in _assertionFailure(_:_:file:line:flags:) + 119
5 libswiftCore.dylib 0x0000000116842710 thunk for @callee_owned (@unowned UnsafeBufferPointer<UInt8>) -> () + 12
6 libswiftCore.dylib 0x0000000116d4fd80 _T0SRys5UInt8VGIxy_ACytIxyr_TRTA.1410 + 82
7 libswiftCore.dylib 0x0000000116840d90 StaticString.withUTF8Buffer<A>(_:) + 1130
8 libswiftCore.dylib 0x0000000116842e90 closure #​1 in closure #​1 in _assertionFailure(_:_:file:line:flags:) + 371
9 libswiftCore.dylib 0x0000000116d4fb60 partial apply for closure #​1 in closure #​1 in _assertionFailure(_:_:file:line:flags:) + 135
10 libswiftCore.dylib 0x00000001168436b0 thunk for @callee_owned (@unowned UnsafeBufferPointer<UInt8>) -> (@error @owned Error) + 22
11 libswiftCore.dylib 0x0000000116d4fc30 partial apply for thunk for @callee_owned (@unowned UnsafeBufferPointer<UInt8>) -> (@error @owned Error) + 99
12 libswiftCore.dylib 0x0000000116842910 String._withUnsafeBufferPointerToUTF8<A>(_:) + 493
13 libswiftCore.dylib 0x0000000116842730 closure #​1 in _assertionFailure(_:_:file:line:flags:) + 422
14 libswiftCore.dylib 0x0000000116c706d0 partial apply for closure #​1 in _assertionFailure(_:_:file:line:flags:) + 167
15 libswiftCore.dylib 0x0000000116842710 thunk for @callee_owned (@unowned UnsafeBufferPointer<UInt8>) -> () + 12
16 libswiftCore.dylib 0x0000000116c707c0 partial apply for thunk for @callee_owned (@unowned UnsafeBufferPointer<UInt8>) -> () + 82
17 libswiftCore.dylib 0x0000000116840d90 StaticString.withUTF8Buffer<A>(_:) + 1130
18 libswiftCore.dylib 0x000000011683f9a0 _assertionFailure(_:_:file:line:flags:) + 420
19 libswiftFoundation.dylib 0x00000001175e7a40 _JSONEncoder.assertCanRequestNewContainer() + 1674
20 libswiftFoundation.dylib 0x00000001175e80d0 _JSONEncoder.container<A>(keyedBy:) + 51
21 libswiftFoundation.dylib 0x00000001175e8870 protocol witness for Encoder.container<A>(keyedBy:) in conformance _JSONEncoder + 85
25 libswiftFoundation.dylib 0x00000001175e54a0 JSONEncoder.encode<A>(_:) + 667
27 swift 0x0000000102e6b930 llvm::MCJIT::runFunction(llvm::Function*, llvm::ArrayRef<llvm::GenericValue>) + 1358
28 swift 0x0000000102e771e0 llvm::ExecutionEngine::runFunctionAsMain(llvm::Function*, std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > > const&, char const* const*) + 3650
29 swift 0x00000001018f9740 swift::RunImmediately(swift::CompilerInstance&, std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > > const&, swift::IRGenOptions&, swift::SILOptions const&) + 8630
30 swift 0x00000001018750f0 performCompile(swift::CompilerInstance&, swift::CompilerInvocation&, llvm::ArrayRef<char const*>, int&, swift::FrontendObserver*, swift::UnifiedStatsReporter*) + 23454
31 swift 0x0000000101870b30 swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 9274
32 swift 0x00000001017a12a0 main + 4809
33 libdyld.dylib 0x00007fffbde55ff8 start + 1
0 swift 0x0000000108a5254c llvm::sys::PrintStackTrace(llvm::raw_ostream&) + 60
1 swift 0x0000000108a52b49 PrintStackTraceSignalHandler(void*) + 25
2 swift 0x0000000108a4e329 llvm::sys::RunSignalHandlers() + 425
3 swift 0x0000000108a52fe2 SignalHandler(int) + 354
4 libsystem_platform.dylib 0x00007fffbe0d4f5a _sigtramp + 26
5 libsystem_platform.dylib 0x0000000100000002 _sigtramp + 1106424002
6 libswiftFoundation.dylib 0x00000001175e80ca _T010Foundation12_JSONEncoder33_12768CA107A31EF2DCE034FD75B541C9LLC28assertCanRequestNewContaineryyF + 1674
7 libswiftFoundation.dylib 0x00000001175e8103 _T010Foundation12_JSONEncoder33_12768CA107A31EF2DCE034FD75B541C9LLC9containers22KeyedEncodingContainerVyxGxm7keyedBy_ts9CodingKeyRzlF + 51
8 libswiftFoundation.dylib 0x00000001175e88c5 _T010Foundation12_JSONEncoder33_12768CA107A31EF2DCE034FD75B541C9LLCs7EncoderAAsAEP9containers22KeyedEncodingContainerVyqd__Gqd__m7keyedBy_ts9CodingKeyRd__lFTW + 85
9 libswiftFoundation.dylib 0x00000001146ad989 _T010Foundation12_JSONEncoder33_12768CA107A31EF2DCE034FD75B541C9LLCs7EncoderAAsAEP9containers22KeyedEncodingContainerVyqd__Gqd__m7keyedBy_ts9CodingKeyRd__lFTW + 4245442841
10 libswiftFoundation.dylib 0x00000001146ae628 _T010Foundation12_JSONEncoder33_12768CA107A31EF2DCE034FD75B541C9LLCs7EncoderAAsAEP9containers22KeyedEncodingContainerVyqd__Gqd__m7keyedBy_ts9CodingKeyRd__lFTW + 4245446072
11 libswiftFoundation.dylib 0x00000001146ade53 _T010Foundation12_JSONEncoder33_12768CA107A31EF2DCE034FD75B541C9LLCs7EncoderAAsAEP9containers22KeyedEncodingContainerVyqd__Gqd__m7keyedBy_ts9CodingKeyRd__lFTW + 4245444067
12 libswiftFoundation.dylib 0x00000001175e573b _T010Foundation11JSONEncoderC6encodeAA4DataVxKs9EncodableRzlF + 667
13 libswiftFoundation.dylib 0x00000001146ad283 _T010Foundation11JSONEncoderC6encodeAA4DataVxKs9EncodableRzlF + 4245454307
14 swift 0x0000000102e6be7e llvm::MCJIT::runFunction(llvm::Function*, llvm::ArrayRef<llvm::GenericValue>) + 1358
15 swift 0x0000000102e78022 llvm::ExecutionEngine::runFunctionAsMain(llvm::Function*, std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > > const&, char const* const*) + 3650
16 swift 0x00000001018fb8f6 swift::RunImmediately(swift::CompilerInstance&, std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > > const&, swift::IRGenOptions&, swift::SILOptions const&) + 8630
17 swift 0x000000010187ac8e performCompile(swift::CompilerInstance&, swift::CompilerInvocation&, llvm::ArrayRef<char const*>, int&, swift::FrontendObserver*, swift::UnifiedStatsReporter*) + 23454
18 swift 0x0000000101872f6a swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 9274
19 swift 0x00000001017a2569 main + 4809
20 libdyld.dylib 0x00007fffbde55ff9 start + 1
Stack dump:
0. Program arguments: /Users/itai/Development/swift-oss/build/Ninja-DebugAssert/swift-macosx-x86_64/bin/swift -frontend -interpret /Users/itai/Downloads/Swift 4 JSON - Inheritance.playground/Contents.swift -enable-objc-interop -sdk /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk -color-diagnostics -module-name Contents
fish: './bin/swift ~/Downloads/Swift\…' terminated by signal SIGILL (Illegal instruction) |
This happens because asking for a container from |
@swift-ci create |
@belkadan Thanks for passing all of these along to me, by the way! Appreciate the help. 🙂 |
Up against master at PR-10520 |
Up against |
Comment by Garric Nahapetian (JIRA) Is this still in progress? |
This is now complete. |
Attachment: Download
Environment
macOS Sierra 10.12.5 (16F73)
Xcode 9.0 beta (9M136h)
Additional Detail from JIRA
md5: 3a67f62125ed2fc58af4c8316e432344
Issue Description:
Reading the proposal for encoding w/ inheritance I see this comment:
However, this seems to cause EXC_BAD_ACCESS when attempting to do so.
I've attached a playground that exhibits this issue with a contrived example.
Not sure if this is Foundation or Standard Library related.
The text was updated successfully, but these errors were encountered: