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-9481] Swift 5: Memory mismanagement on Linux #51943

Open
Lukasa opened this issue Dec 12, 2018 · 9 comments
Open

[SR-9481] Swift 5: Memory mismanagement on Linux #51943

Lukasa opened this issue Dec 12, 2018 · 9 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 run-time crash Bug → crash: Swift code crashed during execution swift 5.0

Comments

@Lukasa
Copy link
Contributor

Lukasa commented Dec 12, 2018

Previous ID SR-9481
Radar rdar://47020961
Original Reporter @Lukasa
Type Bug

Attachment: Download

Environment

Swift version 5.0-dev (LLVM 9a8bf9ce12, Clang eba26b8d1c, Swift b74d54a)
Target: x86_64-unknown-linux-gnu

Additional Detail from JIRA
Votes 1
Component/s Compiler
Labels Bug, 5.0Regression, Miscompile, RunTimeCrash
Assignee None
Priority Medium

md5: 65641d9eaf1880afa480ebf91c9c2308

Issue Description:

When running the unit tests for swift-nio-http2 (https://github.com/apple/swift-nio-http2)'s master branch on Linux under the latest Swift 5 snapshot, the tests reliably segmentation fault partway through their execution.

When the tests are run under valgrind, we get substantial output. The full output is attached, but here is a sample:

==412== Invalid read of size 8
==412==    at 0x51D4EB3: _swift_release_(swift::HeapObject*) (in /root/.swift/usr/lib/swift/linux/libswiftCore.so)
==412==    by 0x1AF36B: outlined consume of NIO.IOData (Bootstrap.swift:0)
==412==    by 0x3D5A3C: outlined consume of NIOHTTP2.HTTP2Frame.FramePayload (<compiler-generated>:0)
==412==    by 0x3D6F7C: outlined destroy of NIOHTTP2.HTTP2Frame (<compiler-generated>:0)
==412==    by 0x4AE6A3: NIOHTTP2Tests.SimpleClientServerTests.testBasicRequestResponse() throws -> () (SimpleClientServerTests.swift:216)
==412==    by 0x4A82A5: partial apply forwarder with unmangled suffix ".270" (<compiler-generated>:0)
==412==    by 0x18C2E5: reabstraction thunk helper from @escaping @callee_guaranteed () -> (@error @owned Swift.Error) to @escaping @callee_guaranteed () -> (@out (), @error @owned Swift.Error) (<compiler-generated>:0)
==412==    by 0x4A822A: partial apply forwarder for reabstraction thunk helper from @escaping @callee_guaranteed () -> (@error @owned Swift.Error) to @escaping @callee_guaranteed () -> (@out (), @error @owned Swift.Error) (<compiler-generated>:0)
==412==    by 0x4146600: partial apply forwarder for reabstraction thunk helper from @escaping @callee_guaranteed () -> (@out (), @error @owned Swift.Error) to @escaping @callee_guaranteed () -> (@error @owned Swift.Error) (in /root/.swift/usr/lib/swift/linux/libXCTest.so)
==412==    by 0x414642B: partial apply forwarder for closure #&#8203;1 (XCTest.XCTestCase) throws -> () in XCTest.(test in _3BE257A46ADB477C7BF2D39968B39F9D)<A where A: XCTest.XCTestCase>((A) -> () throws -> ()) -> (XCTest.XCTestCase) throws -> () (in /root/.swift/usr/lib/swift/linux/libXCTest.so)
==412==    by 0x4146393: partial apply forwarder for reabstraction thunk helper from @escaping @callee_guaranteed (@guaranteed XCTest.XCTestCase) -> (@error @owned Swift.Error) to @escaping @callee_guaranteed (@in_guaranteed XCTest.XCTestCase) -> (@out (), @error @owned Swift.Error) (in /root/.swift/usr/lib/swift/linux/libXCTest.so)
==412==    by 0x4146668: reabstraction thunk helper from @escaping @callee_guaranteed (@guaranteed XCTest.XCTestCase) -> (@error @owned Swift.Error) to @escaping @callee_guaranteed (@in_guaranteed XCTest.XCTestCase) -> (@out (), @error @owned Swift.Error)partial apply forwarder with unmangled suffix ".37" (in /root/.swift/usr/lib/swift/linux/libXCTest.so)
==412==  Address 0x12567d48 is 8 bytes inside a block of size 72 free'd
==412==    at 0x4C30D3B: free (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==412==    by 0x1B7E9E: NIO.ByteBuffer._Storage.__deallocating_deinit (ByteBuffer-core.swift:0)
==412==    by 0x51D5AAA: _swift_release_dealloc (in /root/.swift/usr/lib/swift/linux/libswiftCore.so)
==412==    by 0x1AF36B: outlined consume of NIO.IOData (Bootstrap.swift:0)
==412==    by 0x3D5A3C: outlined consume of NIOHTTP2.HTTP2Frame.FramePayload (<compiler-generated>:0)
==412==    by 0x3D77BC: destroy value witness for NIOHTTP2.HTTP2Frame (<compiler-generated>:0)
==412==    by 0x51CD63A: swift_arrayDestroy (in /root/.swift/usr/lib/swift/linux/libswiftCore.so)
==412==    by 0x4FB7F36: Swift._ContiguousArrayStorage.__deallocating_deinit (in /root/.swift/usr/lib/swift/linux/libswiftCore.so)
==412==    by 0x51D5AAA: _swift_release_dealloc (in /root/.swift/usr/lib/swift/linux/libswiftCore.so)
==412==    by 0x4ADA6C: NIOHTTP2Tests.SimpleClientServerTests.testBasicRequestResponse() throws -> () (SimpleClientServerTests.swift:207)
==412==    by 0x4A82A5: partial apply forwarder with unmangled suffix ".270" (<compiler-generated>:0)
==412==    by 0x18C2E5: reabstraction thunk helper from @escaping @callee_guaranteed () -> (@error @owned Swift.Error) to @escaping @callee_guaranteed () -> (@out (), @error @owned Swift.Error) (<compiler-generated>:0)
==412==  Block was alloc'd at
==412==    at 0x4C2FB0F: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==412==    by 0x51D4931: swift_slowAlloc (in /root/.swift/usr/lib/swift/linux/libswiftCore.so)
==412==    by 0x51D499E: _swift_allocObject_(swift::TargetHeapMetadata<swift::InProcess> const*, unsigned long, unsigned long) (in /root/.swift/usr/lib/swift/linux/libswiftCore.so)
==412==    by 0x1B79FA: NIO.ByteBuffer._Storage.__allocating_init(bytesNoCopy: Swift.UnsafeMutableRawPointer, capacity: Swift.UInt32, allocator: NIO.ByteBufferAllocator) -> NIO.ByteBuffer._Storage (ByteBuffer-core.swift:0)
==412==    by 0x1B8F07: static NIO.ByteBuffer._Storage.reallocated(minimumCapacity: Swift.UInt32, allocator: NIO.ByteBufferAllocator) -> NIO.ByteBuffer._Storage (ByteBuffer-core.swift:280)
==412==    by 0x1B74EA: NIO.ByteBuffer.init(allocator: NIO.ByteBufferAllocator, startingCapacity: Swift.Int) -> NIO.ByteBuffer (ByteBuffer-core.swift:419)
==412==    by 0x1B73CA: NIO.ByteBufferAllocator.buffer(capacity: Swift.Int) -> NIO.ByteBuffer (ByteBuffer-core.swift:104)
==412==    by 0x4AD3E0: NIOHTTP2Tests.SimpleClientServerTests.testBasicRequestResponse() throws -> () (SimpleClientServerTests.swift:199)
==412==    by 0x4A82A5: partial apply forwarder with unmangled suffix ".270" (<compiler-generated>:0)
==412==    by 0x18C2E5: reabstraction thunk helper from @escaping @callee_guaranteed () -> (@error @owned Swift.Error) to @escaping @callee_guaranteed () -> (@out (), @error @owned Swift.Error) (<compiler-generated>:0)
==412==    by 0x4A822A: partial apply forwarder for reabstraction thunk helper from @escaping @callee_guaranteed () -> (@error @owned Swift.Error) to @escaping @callee_guaranteed () -> (@out (), @error @owned Swift.Error) (<compiler-generated>:0)
==412==    by 0x4146600: partial apply forwarder for reabstraction thunk helper from @escaping @callee_guaranteed () -> (@out (), @error @owned Swift.Error) to @escaping @callee_guaranteed () -> (@error @owned Swift.Error) (in /root/.swift/usr/lib/swift/linux/libXCTest.so)

This output seems to suggest that we are double-freeing HTTP2Frame objects that are stored in an array of some kind.

So far I have not been able to produce a smaller reproducer, though I'll work on doing this. I also have so far failed to reproduce on macOS, though I'll also pursue doing that.

@belkadan
Copy link
Contributor

@gottesmm, @slavapestov, look familiar?

@gottesmm
Copy link
Member

@belkadan nope.

@Lukasa can you provide a full reproducer using ASAN instead of valgrind?

@Lukasa
Copy link
Contributor Author

Lukasa commented Dec 13, 2018

Yup, but it's not very helpful. The full output is below (basically identical in release and debug modes):

AddressSanitizer:DEADLYSIGNAL
=================================================================
==207==ERROR: AddressSanitizer: SEGV on unknown address 0x56325e00003d (pc 0x7f3b0e664aa8 bp 0x7fffaa997110 sp 0x7fffaa995cf0 T0)
==207==The signal is caused by a READ memory access.
    #&#8203;0 0x7f3b0e664aa7  (/root/.swift/usr/lib/swift/linux/libswiftCore.so+0x399aa7)
    #&#8203;1 0x5632f0b7c7fe  (/code/.build/x86_64-unknown-linux/release/swift-nio-http2PackageTests.xctest+0x5fd7fe)
    #&#8203;2 0x5632f0b6b9b0  (/code/.build/x86_64-unknown-linux/release/swift-nio-http2PackageTests.xctest+0x5ec9b0)
    #&#8203;3 0x5632f0b6be18  (/code/.build/x86_64-unknown-linux/release/swift-nio-http2PackageTests.xctest+0x5ece18)
    #&#8203;4 0x5632f06b881b  (/code/.build/x86_64-unknown-linux/release/swift-nio-http2PackageTests.xctest+0x13981b)
    #&#8203;5 0x5632f0b6b9d0  (/code/.build/x86_64-unknown-linux/release/swift-nio-http2PackageTests.xctest+0x5ec9d0)
    #&#8203;6 0x5632f0b6bc08  (/code/.build/x86_64-unknown-linux/release/swift-nio-http2PackageTests.xctest+0x5ecc08)
    #&#8203;7 0x7f3b0e909600  (/root/.swift/usr/lib/swift/linux/libXCTest.so+0x30600)
    #&#8203;8 0x7f3b0e90942b  (/root/.swift/usr/lib/swift/linux/libXCTest.so+0x3042b)
    #&#8203;9 0x7f3b0e909393  (/root/.swift/usr/lib/swift/linux/libXCTest.so+0x30393)
    #&#8203;10 0x7f3b0e909668  (/root/.swift/usr/lib/swift/linux/libXCTest.so+0x30668)
    #&#8203;11 0x7f3b0e8fb4c6  (/root/.swift/usr/lib/swift/linux/libXCTest.so+0x224c6)
    #&#8203;12 0x7f3b0e907ddc  (/root/.swift/usr/lib/swift/linux/libXCTest.so+0x2eddc)
    #&#8203;13 0x7f3b0e9076dc  (/root/.swift/usr/lib/swift/linux/libXCTest.so+0x2e6dc)
    #&#8203;14 0x7f3b0e90bde1  (/root/.swift/usr/lib/swift/linux/libXCTest.so+0x32de1)
    #&#8203;15 0x7f3b0e9099d7  (/root/.swift/usr/lib/swift/linux/libXCTest.so+0x309d7)
    #&#8203;16 0x7f3b0e90bde1  (/root/.swift/usr/lib/swift/linux/libXCTest.so+0x32de1)
    #&#8203;17 0x7f3b0e9099d7  (/root/.swift/usr/lib/swift/linux/libXCTest.so+0x309d7)
    #&#8203;18 0x7f3b0e90bde1  (/root/.swift/usr/lib/swift/linux/libXCTest.so+0x32de1)
    #&#8203;19 0x7f3b0e9099ef  (/root/.swift/usr/lib/swift/linux/libXCTest.so+0x309ef)
    #&#8203;20 0x7f3b0e90bde1  (/root/.swift/usr/lib/swift/linux/libXCTest.so+0x32de1)
    #&#8203;21 0x7f3b0e906452  (/root/.swift/usr/lib/swift/linux/libXCTest.so+0x2d452)
    #&#8203;22 0x5632f0d0413f  (/code/.build/x86_64-unknown-linux/release/swift-nio-http2PackageTests.xctest+0x78513f)
    #&#8203;23 0x7f3b0bc7cb96  (/lib/x86_64-linux-gnu/libc.so.6+0x21b96)
    #&#8203;24 0x5632f068f479  (/code/.build/x86_64-unknown-linux/release/swift-nio-http2PackageTests.xctest+0x110479)

AddressSanitizer can not provide additional info.
SUMMARY: AddressSanitizer: SEGV (/root/.swift/usr/lib/swift/linux/libswiftCore.so+0x399aa7) 
==207==ABORTING

(The reproducer is the same: swift-nio-http2's test suite. I have still not been able to reproduce this on macOS, or in a different repo, but I suspect that's because I don't know what specific situation is triggering this.

@Lukasa
Copy link
Contributor Author

Lukasa commented Jan 3, 2019

This continues to manifest with the most recent Swift 5 snapshot (from the 28th of December).

@Lukasa
Copy link
Contributor Author

Lukasa commented Jan 3, 2019

Obtaining a reproducer is simple enough if you have Docker for Mac installed:

git clone https://github.com/apple/swift-nio-http2.git && cd swift-nio-http2 && docker-compose -f docker/docker-compose.yaml -f docker/docker-compose.1804.50.yaml run test

In the absence of Docker for Mac, obtaining a machine with Ubuntu 18.04 and a recent Swift 5 snapshot can be used to hit the issue as well:

git clone https://github.com/apple/swift-nio-http2.git && cd swift-nio-http2 && swift test

@Lukasa
Copy link
Contributor Author

Lukasa commented Jan 3, 2019

Created tracking radar: rdar://47020961

@Lukasa
Copy link
Contributor Author

Lukasa commented Jan 3, 2019

Incidentally, this reproduces in both release and debug mode, so I don't think there's any concern around the behaviour of the optimiser here.

@weissi
Copy link
Member

weissi commented Jan 21, 2019

still happening with the toolchain from the 20th Jan:

(lldb) bt
* thread #&#8203;1, name = 'swift-nio-http2', stop reason = signal SIGSEGV: invalid address (fault address: 0x0)
  * frame #&#8203;0: 0x0000000000000000
    frame #&#8203;1: 0x00007ffff764caab libswiftCore.so`_swift_release_dealloc + 11
    frame #&#8203;2: 0x00005555555fe7ac swift-nio-http2PackageTests.xctest`outlined consume of NIO.IOData at <compiler-generated>:0
    frame #&#8203;3: 0x000055555583147d swift-nio-http2PackageTests.xctest`outlined consume of NIOHTTP2.HTTP2Frame.FramePayload at <compiler-generated>:0
    frame #&#8203;4: 0x00005555558329bd swift-nio-http2PackageTests.xctest`outlined destroy of HTTP2Frame at <compiler-generated>:0
    frame #&#8203;5: 0x000055555590bc84 swift-nio-http2PackageTests.xctest`SimpleClientServerTests.testBasicRequestResponse(self=<unavailable>) at SimpleClientServerTests.swift:216:9
    frame #&#8203;6: 0x0000555555905826 swift-nio-http2PackageTests.xctest`partial apply at <compiler-generated>:0
    frame #&#8203;7: 0x00005555555da8c6 swift-nio-http2PackageTests.xctest`thunk for @escaping @callee_guaranteed () -> (@error @owned Error) at <compiler-generated>:0
    frame #&#8203;8: 0x00005555559057ab swift-nio-http2PackageTests.xctest`partial apply for thunk for @escaping @callee_guaranteed () -> (@error @owned Error) at <compiler-generated>:0
    frame #&#8203;9: 0x00007ffff7ed3601 libXCTest.so`partial apply forwarder for reabstraction thunk helper from @escaping @callee_guaranteed () -> (@out (), @error @owned Swift.Error) to @escaping @callee_guaranteed () -> (@error @owned Swift.Error) + 17
    frame #&#8203;10: 0x00007ffff7ed342c libXCTest.so`partial apply forwarder for closure #&#8203;1 (XCTest.XCTestCase) throws -> () in XCTest.(test in _3BE257A46ADB477C7BF2D39968B39F9D)<A where A: XCTest.XCTestCase>((A) -> () throws -> ()) -> (XCTest.XCTestCase) throws -> () + 92
    frame #&#8203;11: 0x00007ffff7ed3394 libXCTest.so`partial apply forwarder for reabstraction thunk helper from @escaping @callee_guaranteed (@guaranteed XCTest.XCTestCase) -> (@error @owned Swift.Error) to @escaping @callee_guaranteed (@in_guaranteed XCTest.XCTestCase) -> (@out (), @error @owned Swift.Error) + 20
    frame #&#8203;12: 0x00007ffff7ed3669 libXCTest.so`reabstraction thunk helper from @escaping @callee_guaranteed (@guaranteed XCTest.XCTestCase) -> (@error @owned Swift.Error) to @escaping @callee_guaranteed (@in_guaranteed XCTest.XCTestCase) -> (@out (), @error @owned Swift.Error)partial apply forwarder with unmangled suffix ".37" + 9
    frame #&#8203;13: 0x00007ffff7ec54c7 libXCTest.so`partial apply forwarder for reabstraction thunk helper from @escaping @callee_guaranteed (@in_guaranteed XCTest.XCTestCase) -> (@out (), @error @owned Swift.Error) to @escaping @callee_guaranteed (@guaranteed XCTest.XCTestCase) -> (@error @owned Swift.Error) + 39
    frame #&#8203;14: 0x00007ffff7ed1ddd libXCTest.so`XCTest.XCTestCase.invokeTest() -> () + 77
    frame #&#8203;15: 0x00007ffff7ed16dd libXCTest.so`XCTest.XCTestCase.perform(XCTest.XCTestRun) -> () + 173
    frame #&#8203;16: 0x00007ffff7ed5de2 libXCTest.so`XCTest.XCTest.run() -> () + 194
    frame #&#8203;17: 0x00007ffff7ed39d8 libXCTest.so`XCTest.XCTestSuite.perform(XCTest.XCTestRun) -> () + 232
    frame #&#8203;18: 0x00007ffff7ed5de2 libXCTest.so`XCTest.XCTest.run() -> () + 194
    frame #&#8203;19: 0x00007ffff7ed39d8 libXCTest.so`XCTest.XCTestSuite.perform(XCTest.XCTestRun) -> () + 232
    frame #&#8203;20: 0x00007ffff7ed5de2 libXCTest.so`XCTest.XCTest.run() -> () + 194
    frame #&#8203;21: 0x00007ffff7ed0453 libXCTest.so`XCTest.XCTMain(Swift.Array<(testCaseClass: XCTest.XCTestCase.Type, allTests: Swift.Array<(Swift.String, (XCTest.XCTestCase) throws -> ())>)>) -> Swift.Never + 1091
    frame #&#8203;22: 0x000055555598f110 swift-nio-http2PackageTests.xctest`main at LinuxMain.swift:29:4
    frame #&#8203;23: 0x00007ffff548db97 libc.so.6`__libc_start_main + 231
    frame #&#8203;24: 0x00005555555b96ca swift-nio-http2PackageTests.xctest`_start + 42

@weissi
Copy link
Member

weissi commented Jan 21, 2019

and because @gottesmm requested the ASan (symbolication is at the end):

(lldb) run
Process 410 launched: '/code/.build/x86_64-unknown-linux/debug/swift-nio-http2PackageTests.xctest' (x86_64)
Test Suite 'Selected tests' started at 2019-01-21 12:08:50.001
Test Suite 'SimpleClientServerTests' started at 2019-01-21 12:08:50.004
Test Case 'SimpleClientServerTests.testBasicRequestResponse' started at 2019-01-21 12:08:50.004
Process 410 stopped
* thread #&#8203;1, name = 'swift-nio-http2', stop reason = signal SIGSEGV: invalid address (fault address: 0x55551cfffff4)
    frame #&#8203;0: 0x00007ffff764caa8 libswiftCore.so`_swift_release_dealloc + 8
libswiftCore.so`_swift_release_dealloc:
->  0x7ffff764caa8 <+8>:  callq  *-0x10(%rax)
    0x7ffff764caab <+11>: popq   %r13
    0x7ffff764caad <+13>: retq   
    0x7ffff764caae:       nop    
Target 0: (swift-nio-http2PackageTests.xctest) stopped.
(lldb) bt
* thread #&#8203;1, name = 'swift-nio-http2', stop reason = signal SIGSEGV: invalid address (fault address: 0x55551cfffff4)
  * frame #&#8203;0: 0x00007ffff764caa8 libswiftCore.so`_swift_release_dealloc + 8
    frame #&#8203;1: 0x000055555572be1c swift-nio-http2PackageTests.xctest`outlined consume of NIO.IOData at <compiler-generated>:0
    frame #&#8203;2: 0x0000555555c9e57d swift-nio-http2PackageTests.xctest`outlined consume of NIOHTTP2.HTTP2Frame.FramePayload at <compiler-generated>:0
    frame #&#8203;3: 0x0000555555ca28ed swift-nio-http2PackageTests.xctest`outlined destroy of HTTP2Frame at <compiler-generated>:0
    frame #&#8203;4: 0x0000555555e77de6 swift-nio-http2PackageTests.xctest`SimpleClientServerTests.testBasicRequestResponse(self=<unavailable>) at SimpleClientServerTests.swift:216:9
    frame #&#8203;5: 0x0000555555e68606 swift-nio-http2PackageTests.xctest`partial apply at <compiler-generated>:0
    frame #&#8203;6: 0x00005555556d05a6 swift-nio-http2PackageTests.xctest`thunk for @escaping @callee_guaranteed () -> (@error @owned Error) at <compiler-generated>:0
    frame #&#8203;7: 0x0000555555e6858b swift-nio-http2PackageTests.xctest`partial apply for thunk for @escaping @callee_guaranteed () -> (@error @owned Error) at <compiler-generated>:0
    frame #&#8203;8: 0x00007ffff7ed3601 libXCTest.so`partial apply forwarder for reabstraction thunk helper from @escaping @callee_guaranteed () -> (@out (), @error @owned Swift.Error) to @escaping @callee_guaranteed () -> (@error @owned Swift.Error) + 17
    frame #&#8203;9: 0x00007ffff7ed342c libXCTest.so`partial apply forwarder for closure #&#8203;1 (XCTest.XCTestCase) throws -> () in XCTest.(test in _3BE257A46ADB477C7BF2D39968B39F9D)<A where A: XCTest.XCTestCase>((A) -> () throws -> ()) -> (XCTest.XCTestCase) throws -> () + 92
    frame #&#8203;10: 0x00007ffff7ed3394 libXCTest.so`partial apply forwarder for reabstraction thunk helper from @escaping @callee_guaranteed (@guaranteed XCTest.XCTestCase) -> (@error @owned Swift.Error) to @escaping @callee_guaranteed (@in_guaranteed XCTest.XCTestCase) -> (@out (), @error @owned Swift.Error) + 20
    frame #&#8203;11: 0x00007ffff7ed3669 libXCTest.so`reabstraction thunk helper from @escaping @callee_guaranteed (@guaranteed XCTest.XCTestCase) -> (@error @owned Swift.Error) to @escaping @callee_guaranteed (@in_guaranteed XCTest.XCTestCase) -> (@out (), @error @owned Swift.Error)partial apply forwarder with unmangled suffix ".37" + 9
    frame #&#8203;12: 0x00007ffff7ec54c7 libXCTest.so`partial apply forwarder for reabstraction thunk helper from @escaping @callee_guaranteed (@in_guaranteed XCTest.XCTestCase) -> (@out (), @error @owned Swift.Error) to @escaping @callee_guaranteed (@guaranteed XCTest.XCTestCase) -> (@error @owned Swift.Error) + 39
    frame #&#8203;13: 0x00007ffff7ed1ddd libXCTest.so`XCTest.XCTestCase.invokeTest() -> () + 77
    frame #&#8203;14: 0x00007ffff7ed16dd libXCTest.so`XCTest.XCTestCase.perform(XCTest.XCTestRun) -> () + 173
    frame #&#8203;15: 0x00007ffff7ed5de2 libXCTest.so`XCTest.XCTest.run() -> () + 194
    frame #&#8203;16: 0x00007ffff7ed39d8 libXCTest.so`XCTest.XCTestSuite.perform(XCTest.XCTestRun) -> () + 232
    frame #&#8203;17: 0x00007ffff7ed5de2 libXCTest.so`XCTest.XCTest.run() -> () + 194
    frame #&#8203;18: 0x00007ffff7ed39d8 libXCTest.so`XCTest.XCTestSuite.perform(XCTest.XCTestRun) -> () + 232
    frame #&#8203;19: 0x00007ffff7ed5de2 libXCTest.so`XCTest.XCTest.run() -> () + 194
    frame #&#8203;20: 0x00007ffff7ed0453 libXCTest.so`XCTest.XCTMain(Swift.Array<(testCaseClass: XCTest.XCTestCase.Type, allTests: Swift.Array<(Swift.String, (XCTest.XCTestCase) throws -> ())>)>) -> Swift.Never + 1091
    frame #&#8203;21: 0x0000555555f9c24e swift-nio-http2PackageTests.xctest`main at LinuxMain.swift:29:4
    frame #&#8203;22: 0x00007ffff5285b97 libc.so.6`__libc_start_main + 231
    frame #&#8203;23: 0x000055555566160a swift-nio-http2PackageTests.xctest`_start + 42
(lldb) cont
Process 410 resuming
AddressSanitizer:DEADLYSIGNAL
=================================================================
==410==ERROR: AddressSanitizer: SEGV on unknown address 0x55551cfffff4 (pc 0x7ffff764caa8 bp 0x7fffffffce20 sp 0x7fffffffcdf0 T0)
==410==The signal is caused by a READ memory access.
    #&#8203;0 0x7ffff764caa7  (/root/.swift/usr/lib/swift/linux/libswiftCore.so+0x399aa7)
    #&#8203;1 0x55555572be1b  (/code/.build/x86_64-unknown-linux/debug/swift-nio-http2PackageTests.xctest+0x1d7e1b)
    #&#8203;2 0x555555c9e57c  (/code/.build/x86_64-unknown-linux/debug/swift-nio-http2PackageTests.xctest+0x74a57c)
    #&#8203;3 0x555555ca28ec  (/code/.build/x86_64-unknown-linux/debug/swift-nio-http2PackageTests.xctest+0x74e8ec)
    #&#8203;4 0x555555e77de5  (/code/.build/x86_64-unknown-linux/debug/swift-nio-http2PackageTests.xctest+0x923de5)
    #&#8203;5 0x555555e68605  (/code/.build/x86_64-unknown-linux/debug/swift-nio-http2PackageTests.xctest+0x914605)
    #&#8203;6 0x5555556d05a5  (/code/.build/x86_64-unknown-linux/debug/swift-nio-http2PackageTests.xctest+0x17c5a5)
    #&#8203;7 0x555555e6858a  (/code/.build/x86_64-unknown-linux/debug/swift-nio-http2PackageTests.xctest+0x91458a)
    #&#8203;8 0x7ffff7ed3600  (/root/.swift/usr/lib/swift/linux/libXCTest.so+0x30600)
    #&#8203;9 0x7ffff7ed342b  (/root/.swift/usr/lib/swift/linux/libXCTest.so+0x3042b)
    #&#8203;10 0x7ffff7ed3393  (/root/.swift/usr/lib/swift/linux/libXCTest.so+0x30393)
    #&#8203;11 0x7ffff7ed3668  (/root/.swift/usr/lib/swift/linux/libXCTest.so+0x30668)
    #&#8203;12 0x7ffff7ec54c6  (/root/.swift/usr/lib/swift/linux/libXCTest.so+0x224c6)
    #&#8203;13 0x7ffff7ed1ddc  (/root/.swift/usr/lib/swift/linux/libXCTest.so+0x2eddc)
    #&#8203;14 0x7ffff7ed16dc  (/root/.swift/usr/lib/swift/linux/libXCTest.so+0x2e6dc)
    #&#8203;15 0x7ffff7ed5de1  (/root/.swift/usr/lib/swift/linux/libXCTest.so+0x32de1)
    #&#8203;16 0x7ffff7ed39d7  (/root/.swift/usr/lib/swift/linux/libXCTest.so+0x309d7)
    #&#8203;17 0x7ffff7ed5de1  (/root/.swift/usr/lib/swift/linux/libXCTest.so+0x32de1)
    #&#8203;18 0x7ffff7ed39d7  (/root/.swift/usr/lib/swift/linux/libXCTest.so+0x309d7)
    #&#8203;19 0x7ffff7ed5de1  (/root/.swift/usr/lib/swift/linux/libXCTest.so+0x32de1)
    #&#8203;20 0x7ffff7ed0452  (/root/.swift/usr/lib/swift/linux/libXCTest.so+0x2d452)
    #&#8203;21 0x555555f9c24d  (/code/.build/x86_64-unknown-linux/debug/swift-nio-http2PackageTests.xctest+0xa4824d)
    #&#8203;22 0x7ffff5285b96  (/lib/x86_64-linux-gnu/libc.so.6+0x21b96)
    #&#8203;23 0x555555661609  (/code/.build/x86_64-unknown-linux/debug/swift-nio-http2PackageTests.xctest+0x10d609)

AddressSanitizer can not provide additional info.
SUMMARY: AddressSanitizer: SEGV (/root/.swift/usr/lib/swift/linux/libswiftCore.so+0x399aa7) 
==410==ABORTING
Process 410 exited with status = 1 (0x00000001) 
(lldb) image lookup --address 0x7ffff764caa7
      Address: libswiftCore.so[0x0000000000399aa7] (libswiftCore.so..text + 2556039)
      Summary: libswiftCore.so`_swift_release_dealloc + 7
(lldb) image lookup --address 0x55555572be1b
      Address: swift-nio-http2PackageTests.xctest[0x00000000001d7e1b] (swift-nio-http2PackageTests.xctest..text + 829499)
      Summary: swift-nio-http2PackageTests.xctest`outlined consume of NIO.IOData + 43
(lldb) image lookup --address 0x555555c9e57c
      Address: swift-nio-http2PackageTests.xctest[0x000000000074a57c] (swift-nio-http2PackageTests.xctest..text + 6541212)
      Summary: swift-nio-http2PackageTests.xctest`outlined consume of NIOHTTP2.HTTP2Frame.FramePayload + 92
(lldb) image lookup --address 0x555555ca28ec
      Address: swift-nio-http2PackageTests.xctest[0x000000000074e8ec] (swift-nio-http2PackageTests.xctest..text + 6558476)
      Summary: swift-nio-http2PackageTests.xctest`outlined destroy of NIOHTTP2.HTTP2Frame + 76 at <compiler-generated>
(lldb) image lookup --address 0x555555e77de5
      Address: swift-nio-http2PackageTests.xctest[0x0000000000923de5] (swift-nio-http2PackageTests.xctest..text + 8480773)
      Summary: swift-nio-http2PackageTests.xctest`NIOHTTP2Tests.SimpleClientServerTests.testBasicRequestResponse() throws -> () + 13509 at SimpleClientServerTests.swift:216:9
(lldb) image lookup --address 0x555555e68605
      Address: swift-nio-http2PackageTests.xctest[0x0000000000914605] (swift-nio-http2PackageTests.xctest..text + 8417317)
      Summary: swift-nio-http2PackageTests.xctest`partial apply forwarder with unmangled suffix ".270" + 37 at <compiler-generated>
(lldb) image lookup --address 0x5555556d05a5
      Address: swift-nio-http2PackageTests.xctest[0x000000000017c5a5] (swift-nio-http2PackageTests.xctest..text + 454597)
      Summary: swift-nio-http2PackageTests.xctest`reabstraction thunk helper from @escaping @callee_guaranteed () -> (@error @owned Swift.Error) to @escaping @callee_guaranteed () -> (@out (), @error @owned Swift.Error) + 21 at <compiler-generated>
(lldb) image lookup --address 0x555555e6858a
      Address: swift-nio-http2PackageTests.xctest[0x000000000091458a] (swift-nio-http2PackageTests.xctest..text + 8417194)
      Summary: swift-nio-http2PackageTests.xctest`partial apply forwarder for reabstraction thunk helper from @escaping @callee_guaranteed () -> (@error @owned Swift.Error) to @escaping @callee_guaranteed () -> (@out (), @error @owned Swift.Error) + 26 at <compiler-generated>
(lldb) image lookup --address 0x7ffff7ed3600
      Address: libXCTest.so[0x0000000000030600] (libXCTest.so..text + 81440)
      Summary: libXCTest.so`partial apply forwarder for reabstraction thunk helper from @escaping @callee_guaranteed () -> (@out (), @error @owned Swift.Error) to @escaping @callee_guaranteed () -> (@error @owned Swift.Error) + 16
(lldb) image lookup --address 0x7ffff7ed342b
      Address: libXCTest.so[0x000000000003042b] (libXCTest.so..text + 80971)
      Summary: libXCTest.so`partial apply forwarder for closure #&#8203;1 (XCTest.XCTestCase) throws -> () in XCTest.(test in _3BE257A46ADB477C7BF2D39968B39F9D)<A where A: XCTest.XCTestCase>((A) -> () throws -> ()) -> (XCTest.XCTestCase) throws -> () + 91
(lldb) image lookup --address 0x7ffff7ed3393
      Address: libXCTest.so[0x0000000000030393] (libXCTest.so..text + 80819)
      Summary: libXCTest.so`partial apply forwarder for reabstraction thunk helper from @escaping @callee_guaranteed (@guaranteed XCTest.XCTestCase) -> (@error @owned Swift.Error) to @escaping @callee_guaranteed (@in_guaranteed XCTest.XCTestCase) -> (@out (), @error @owned Swift.Error) + 19
(lldb) image lookup --address 0x7ffff7ed3668
      Address: libXCTest.so[0x0000000000030668] (libXCTest.so..text + 81544)
      Summary: libXCTest.so`reabstraction thunk helper from @escaping @callee_guaranteed (@guaranteed XCTest.XCTestCase) -> (@error @owned Swift.Error) to @escaping @callee_guaranteed (@in_guaranteed XCTest.XCTestCase) -> (@out (), @error @owned Swift.Error)partial apply forwarder with unmangled suffix ".37" + 8
(lldb) image lookup --address 0x7ffff7ec54c6
      Address: libXCTest.so[0x00000000000224c6] (libXCTest.so..text + 23782)
      Summary: libXCTest.so`partial apply forwarder for reabstraction thunk helper from @escaping @callee_guaranteed (@in_guaranteed XCTest.XCTestCase) -> (@out (), @error @owned Swift.Error) to @escaping @callee_guaranteed (@guaranteed XCTest.XCTestCase) -> (@error @owned Swift.Error) + 38
(lldb) image lookup --address 0x7ffff7ed1ddc
      Address: libXCTest.so[0x000000000002eddc] (libXCTest.so..text + 75260)
      Summary: libXCTest.so`XCTest.XCTestCase.invokeTest() -> () + 76
(lldb) image lookup --address 0x7ffff7ed16dc
      Address: libXCTest.so[0x000000000002e6dc] (libXCTest.so..text + 73468)
      Summary: libXCTest.so`XCTest.XCTestCase.perform(XCTest.XCTestRun) -> () + 172
(lldb) image lookup --address 0x7ffff7ed5de1
      Address: libXCTest.so[0x0000000000032de1] (libXCTest.so..text + 91649)
      Summary: libXCTest.so`XCTest.XCTest.run() -> () + 193
(lldb) image lookup --address 0x7ffff7ed39d7
      Address: libXCTest.so[0x00000000000309d7] (libXCTest.so..text + 82423)
      Summary: libXCTest.so`XCTest.XCTestSuite.perform(XCTest.XCTestRun) -> () + 231
(lldb) image lookup --address 0x7ffff7ed5de1
      Address: libXCTest.so[0x0000000000032de1] (libXCTest.so..text + 91649)
      Summary: libXCTest.so`XCTest.XCTest.run() -> () + 193
(lldb) image lookup --address 0x7ffff7ed39d7
      Address: libXCTest.so[0x00000000000309d7] (libXCTest.so..text + 82423)
      Summary: libXCTest.so`XCTest.XCTestSuite.perform(XCTest.XCTestRun) -> () + 231
(lldb) image lookup --address 0x7ffff7ed5de1
      Address: libXCTest.so[0x0000000000032de1] (libXCTest.so..text + 91649)
      Summary: libXCTest.so`XCTest.XCTest.run() -> () + 193
(lldb) image lookup --address 0x7ffff7ed0452
      Address: libXCTest.so[0x000000000002d452] (libXCTest.so..text + 68722)
      Summary: libXCTest.so`XCTest.XCTMain(Swift.Array<(testCaseClass: XCTest.XCTestCase.Type, allTests: Swift.Array<(Swift.String, (XCTest.XCTestCase) throws -> ())>)>) -> Swift.Never + 1090
(lldb) image lookup --address 0x555555f9c24d
      Address: swift-nio-http2PackageTests.xctest[0x0000000000a4824d] (swift-nio-http2PackageTests.xctest..text + 9677933)
      Summary: swift-nio-http2PackageTests.xctest`main + 2269 at LinuxMain.swift:29:4
(lldb) image lookup --address 0x7ffff5285b96
      Address: libc.so.6[0x0000000000021b96] (libc.so.6..text + 2246)
      Summary: libc.so.6`__libc_start_main + 230
(lldb) image lookup --address 0x555555661609
      Address: swift-nio-http2PackageTests.xctest[0x000000000010d609] (swift-nio-http2PackageTests.xctest..text + 41)
      Summary: swift-nio-http2PackageTests.xctest`_start + 41

@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
@weissi weissi added TSan For issues in the Thread Sanitizer itself and removed TSan For issues in the Thread Sanitizer itself labels May 16, 2023
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 run-time crash Bug → crash: Swift code crashed during execution swift 5.0
Projects
None yet
Development

No branches or pull requests

5 participants