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-7388] lldb on Linux broken further with Swift 4.1 (error: could not build C module 'SwiftGlibc') #4374

Closed
weissi opened this issue Apr 9, 2018 · 19 comments
Assignees
Labels
bug LLDB for Swift

Comments

@weissi
Copy link
Member

weissi commented Apr 9, 2018

Previous ID SR-7388
Radar rdar://problem/39277133
Original Reporter @weissi
Type Bug
Status Resolved
Resolution Done

Attachment: Download

Additional Detail from JIRA
Votes 0
Component/s LLDB for Swift
Labels Bug
Assignee @adrian-prantl
Priority Medium

md5: 48024bbb57e421386b584d49266538c4

Issue Description:

Up to Swift 4.0 to get lldb to work on anything that uses the Glibc or Foundation module, you just do this

export C_INCLUDE_PATH=/usr/lib/swift/clang/include
export CPLUS_INCLUDE_PATH=$C_INCLUDE_PATH

before starting lldb and it'll work. That is filed as SR-5524 . In Swift 4.1 though even that fails 🙁

expected

demo in the working state (4.0.3):

$ tar xf test.tar.gz # this is the attached file and contains a simple demo project
$ cd test
$ swift build
Compile Swift Module 'test' (1 sources)
Linking ./.build/x86_64-unknown-linux/debug/test
$ export C_INCLUDE_PATH=/usr/lib/swift/clang/include
$ export CPLUS_INCLUDE_PATH=$C_INCLUDE_PATH
$ which swift
/usr/bin/swift
$ which lldb
/usr/bin/lldb
$ swift -version
Swift version 4.0.3 (swift-4.0.3-RELEASE)
Target: x86_64-unknown-linux-gnu
$ lldb ./.build/x86_64-unknown-linux/debug/test
[...]
(lldb) break set -n breakHereReally
Breakpoint 1: where = test`test.breakHereReally() -> () + 4 at main.swift:13, address = 0x00000000004012c4
(lldb) run
Process 100 launched: './.build/x86_64-unknown-linux/debug/test' (x86_64)
Hello, world!
Process 100 stopped
* thread #​1, name = 'test', stop reason = breakpoint 1.1
    frame #​0: 0x00000000004012c4 test`breakHereReally() at main.swift:13
   10   }
   11   
   12   func breakHereReally() {
-> 13       let a = Socket()
   14       a.foo()
   15   }
   16   
Target 0: (test) stopped.
(lldb) next
Process 100 stopped
* thread #​1, name = 'test', stop reason = step over
    frame #​0: 0x00000000004012d4 test`breakHereReally() at main.swift:14
   11   
   12   func breakHereReally() {
   13       let a = Socket()
-> 14       a.foo()
   15   }
   16   
   17   print("Hello, world!")
Target 0: (test) stopped.
(lldb) p a
(test.Socket) $R0 = 0x0000000000404fc0 (a = true, b = "hi", c = 2)

actual (Swift 4.1)

$ tar xf test.tar.gz # this is the attached file and contains a simple demo project
$ cd test
$ swift build
Compile Swift Module 'test' (1 sources)
Linking ./.build/x86_64-unknown-linux/debug/test
$ export C_INCLUDE_PATH=/usr/lib/swift/clang/include
$ export CPLUS_INCLUDE_PATH=$C_INCLUDE_PATH
$ which swift
/usr/bin/swift
$ which lldb
/usr/bin/lldb
$ swift -version
Swift version 4.1 (swift-4.1-RELEASE)
Target: x86_64-unknown-linux-gnu
$ lldb ./.build/x86_64-unknown-linux/debug/test
(lldb) target create "./.build/x86_64-unknown-linux/debug/test"
Current executable set to './.build/x86_64-unknown-linux/debug/test' (x86_64).
(lldb) break set -n breakHereReally
Breakpoint 1: where = test`test.breakHereReally() -> () + 4 at main.swift:13, address = 0x0000000000001404
(lldb) run
Process 101 launched: './.build/x86_64-unknown-linux/debug/test' (x86_64)
Hello, world!
Process 101 stopped
* thread #​1, name = 'test', stop reason = breakpoint 1.1
    frame #​0: 0x0000555555555404 test`breakHereReally() at main.swift:13
   10   }
   11   
   12   func breakHereReally() {
-> 13       let a = Socket()
   14       a.foo()
   15   }
   16   
Target 0: (test) stopped.
(lldb) next
Process 101 stopped
* thread #​1, name = 'test', stop reason = step over
    frame #​0: 0x0000555555555414 test`breakHereReally() at main.swift:14
   11   
   12   func breakHereReally() {
   13       let a = Socket()
-> 14       a.foo()
   15   }
   16   
   17   print("Hello, world!")
Target 0: (test) stopped.
(lldb) p a
error: in auto-import:
failed to get module 'test' from AST context:
<module-includes>:3:9: note: in file included from <module-includes>:3:
#import "///usr/include/utmp.h"
        ^

///usr/include/utmp.h:23:10: note: in file included from ///usr/include/utmp.h:23:
#include <sys/types.h>
         ^

error: //usr/include/x86_64-linux-gnu/sys/types.h:146:10: error: 'stddef.h' file not found
#include <stddef.h>
         ^

error: could not build C module 'SwiftGlibc'

which as shown above throws this error

error: in auto-import:
failed to get module 'test' from AST context:
<module-includes>:3:9: note: in file included from <module-includes>:3:
#import "///usr/include/utmp.h"
        ^

///usr/include/utmp.h:23:10: note: in file included from ///usr/include/utmp.h:23:
#include <sys/types.h>
         ^

error: //usr/include/x86_64-linux-gnu/sys/types.h:146:10: error: 'stddef.h' file not found
#include <stddef.h>
         ^

error: could not build C module 'SwiftGlibc'

oddly enough, in the REPL, exporting C_INCLUDE_PATH still seems to work:

$ swift
Welcome to Swift version 4.1 (swift-4.1-RELEASE). Type :help for assistance.
  1> import Glibc
  2> write(-1, nil, -1)
$R0: Int = -1

which shows that the import works fine. For the record, not having C_INCLUDE_PATH exported makes the REPL fail with the same error:

$ swift
Welcome to Swift version 4.1 (swift-4.1-RELEASE). Type :help for assistance.
  1> import Glibc
<module-includes>:3:10: note: in file included from <module-includes>:3:
#include "///usr/include/utmp.h"
         ^

///usr/include/utmp.h:23:10: note: in file included from ///usr/include/utmp.h:23:
#include <sys/types.h>
         ^

error: /usr/include/x86_64-linux-gnu/sys/types.h:146:10: error: 'stddef.h' file not found
#include <stddef.h>
         ^

error: could not build C module 'SwiftGlibc'

please note: This is best tested in a Docker container as LLDB seems to heavily cache both positive and negative results. So sometimes reproductions are hard because LLDB cached something that previously worked (or the other way around).

@weissi
Copy link
Member Author

weissi commented Apr 9, 2018

@swift-ci create

@weissi
Copy link
Member Author

weissi commented Apr 9, 2018

please also note that this is a really bad bug and I don't currently have a workaround: This stops you from working with LLDB for any module that (transitively) depends on Glibc which is pretty much anything.

@belkadan
Copy link

belkadan commented Apr 9, 2018

@adrian-prantl, @compnerd, I thought we backed out the change that caused this?

@adrian-prantl
Copy link
Member

adrian-prantl commented Apr 9, 2018

Yeah I thought that this would be fixed by shipping the correct clang headers with LLDB, but we don't have a testcase that imports glibc in the Swift LLDB Linux testsuite at the moment. I'll add one and see if I can reproduce this.

@adrian-prantl
Copy link
Member

adrian-prantl commented Apr 9, 2018

@swift-ci create

@adrian-prantl
Copy link
Member

adrian-prantl commented Apr 13, 2018

Does this also reproduce for with a recent trunk development snapshot (https://swift.org/download/#snapshots),) and without setting any additional environment variables the alter the Clang include path?

If it doesn't reproduce, then this bug is a duplicate of https://bugs.swift.org/browse/SR-6954. The workaround then is to move the clang headers inside of lldb into a subdirectory with the lldb version number:
mv /usr/lib/lldb/clang/include /usr/lib/lldb/clang/5.0.0/include
... and stop manually setting C_INCLUDE_PATH. This will allow LLDB to find the clang resource headers that match the clang LLDB was built against.

@weissi
Copy link
Member Author

weissi commented Apr 19, 2018

@adrian-prantl, sorry for the late response. This is the state with the the latest snapshot (swift-DEVELOPMENT-SNAPSHOT-2018-04-18-a-ubuntu16.04):

$ /usr/local/swift/swift-DEVELOPMENT-SNAPSHOT-2018-04-18-a-ubuntu16.04/usr/bin/lldb  ./.build/x86_64-unknown-linux/debug/test
(lldb) target create "./.build/x86_64-unknown-linux/debug/test"
Current executable set to './.build/x86_64-unknown-linux/debug/test' (x86_64).
(lldb) break set -n breakHereReally
Breakpoint 1: where = test`test.breakHereReally() -> () + 4 at main.swift:13, address = 0x0000000000001204
(lldb) run
Process 24526 launched: './.build/x86_64-unknown-linux/debug/test' (x86_64)
Hello, world!
Process 24526 stopped
* thread #&#8203;1, name = 'test', stop reason = breakpoint 1.1
    frame #&#8203;0: 0x0000555555555204 test`breakHereReally() at main.swift:13
   10   }
   11   
   12   func breakHereReally() {
-> 13       let a = Socket()
   14       a.foo()
   15   }
   16   
Target 0: (test) stopped.
(lldb) next 
Process 24526 stopped
* thread #&#8203;1, name = 'test', stop reason = step over
    frame #&#8203;0: 0x0000555555555222 test`breakHereReally() at main.swift:14
   11   
   12   func breakHereReally() {
   13       let a = Socket()
-> 14       a.foo()
   15   }
   16   
   17   print("Hello, world!")
Target 0: (test) stopped.
(lldb) p a
(test.Socket) $R0 = 0x0000555555569d60 (a = true, b = "hi", c = 2)

so for my example it seems to work. However, using a slightly more complicated project:

jweiss:~/devel/swift-nio (master)
$ /usr/local/swift/swift-DEVELOPMENT-SNAPSHOT-2018-04-18-a-ubuntu16.04/usr/bin/lldb  ./.build/x86_64-unknown-linux/debug/NIOHTTP1Server
(lldb) target create "./.build/x86_64-unknown-linux/debug/NIOHTTP1Server"
Current executable set to './.build/x86_64-unknown-linux/debug/NIOHTTP1Server' (x86_64).
(lldb) break set -f main.swift -l 396
Breakpoint 1: where = NIOHTTP1Server`NIOHTTP1Server.(HTTPHandler in _8C8F29B600C5A43D561623635B633A31).channelRead(ctx: NIO.ChannelHandlerContext, data: NIO.NIOAny) -> () + 52 at main.swift:396, address = 0x00000000001d0e44
(lldb) run
Process 24861 launched: './.build/x86_64-unknown-linux/debug/NIOHTTP1Server' (x86_64)
htdocs = /dev/null/
Server started and listening on [IPv6]::1:8888, htdocs path /dev/null/
Process 24861 stopped
* thread #&#8203;2, name = 'NIO-ELT-#2', stop reason = breakpoint 1.1
    frame #&#8203;0: 0x0000555555724e44 NIOHTTP1Server`HTTPHandler.channelRead(ctx=<unavailable>, data=<unavailable>, self=<unavailable>) at main.swift:396
   393      }
   394  
   395      func channelRead(ctx: ChannelHandlerContext, data: NIOAny) {
-> 396          let reqPart = self.unwrapInboundIn(data)
   397          if let handler = self.handler {
   398              handler(ctx, reqPart)
   399              return
Target 0: (NIOHTTP1Server) stopped.
(lldb) p ctx
warning: Swift error in module NIOHTTP1Server.
Debug info from this module will be unavailable in the debugger.

error: expression failed to parse, unknown error
(lldb) po ctx
error: Swift expressions require OS X 10.10 / iOS 8 SDKs or later.

(lldb) 

so it still doesn't work 🙁. Note we're on Linux here so the "OS X 10.10 / iOS 8 SDKs or later" message doesn't really make sense.

I used swift-nio at hash 91ef938c60061784ba8734a73d61b7810494f9b3 which corresponds to the 1.5.0 tag.

nio repro:

git clone https://github.com/apple/swift-nio.git
git reset --hard 1.5.0
/usr/local/swift/swift-DEVELOPMENT-SNAPSHOT-2018-04-18-a-ubuntu16.04/usr/bin/swift build
/usr/local/swift/swift-DEVELOPMENT-SNAPSHOT-2018-04-18-a-ubuntu16.04/usr/bin/lldb  ./.build/x86_64-unknown-linux/debug/NIOHTTP1Server

(lldb) break set -f main.swift -l 396
(lldb) run

and then to trigger the break point, use a different terminal and run

echo -e 'GET / HTTP/1.1\r\n\r\n' | nc localhost 8888

then you should have hit the breakpoint, and then you can run:

p ctx
po ctx

to repro

@weissi
Copy link
Member Author

weissi commented Apr 19, 2018

@adrian-prantl and just to prove that with 4.0.3 and the same code it works just fine

$ /usr/local/swift/swift-4.0.3-RELEASE-ubuntu16.04/usr/bin/swift build
Compile CNIOSHA1 c_nio_sha1.c
Compile CNIOZlib empty.c
Compile CNIOLinux shim.c
Compile CNIOHTTPParser c_nio_http_parser.c
Compile CNIODarwin shim.c
Compile CNIOAtomics src/c-atomics.c
Compile Swift Module 'NIOPriorityQueue' (2 sources)
Compile Swift Module 'NIOConcurrencyHelpers' (2 sources)
Compile Swift Module 'NIO' (50 sources)
Compile Swift Module 'NIOFoundationCompat' (1 sources)
Compile Swift Module 'NIOEchoServer' (1 sources)
Compile Swift Module 'NIOChatServer' (1 sources)
Compile Swift Module 'NIOChatClient' (1 sources)
Compile Swift Module 'NIOEchoClient' (1 sources)
Compile Swift Module 'NIOTLS' (3 sources)
Compile Swift Module 'NIOHTTP1' (8 sources)
Linking ./.build/x86_64-unknown-linux/debug/NIOEchoServer
Linking ./.build/x86_64-unknown-linux/debug/NIOChatClient
Linking ./.build/x86_64-unknown-linux/debug/NIOEchoClient
Linking ./.build/x86_64-unknown-linux/debug/NIOChatServer
Compile Swift Module 'NIOHTTP1Server' (1 sources)
Compile Swift Module 'NIOWebSocket' (8 sources)
Compile Swift Module 'NIOWebSocketServer' (1 sources)
Linking ./.build/x86_64-unknown-linux/debug/NIOWebSocketServer
Linking ./.build/x86_64-unknown-linux/debug/NIOHTTP1Server
jweiss:~/devel/swift-nio (master)
$ export C_INCLUDE_PATH=/usr/local/swift/swift-4.0.3-RELEASE-ubuntu16.04/usr/lib/swift/clang/include/
jweiss:~/devel/swift-nio (master)
$ /usr/local/swift/swift-4.0.3-RELEASE-ubuntu16.04/usr/bin/lldb ./.build/x86_64-unknown-linux/debug/NIOHTTP1Server
(lldb) target create "./.build/x86_64-unknown-linux/debug/NIOHTTP1Server"
Current executable set to './.build/x86_64-unknown-linux/debug/NIOHTTP1Server' (x86_64).
(lldb) break set -f main.swift -l 396
Breakpoint 1: where = NIOHTTP1Server`NIOHTTP1Server.(HTTPHandler in _8C8F29B600C5A43D561623635B633A31).channelRead(ctx: NIO.ChannelHandlerContext, data: NIO.NIOAny) -> () + 39 at main.swift:396, address = 0x0000000000604387
(lldb) run
Process 25809 launched: './.build/x86_64-unknown-linux/debug/NIOHTTP1Server' (x86_64)
htdocs = /dev/null/
Server started and listening on [IPv6]::1:8888, htdocs path /dev/null/
Process 25809 stopped
* thread #&#8203;3, name = 'NIO-ELT-#1', stop reason = breakpoint 1.1
    frame #&#8203;0: 0x0000000000604387 NIOHTTP1Server`HTTPHandler.channelRead(ctx=0x00007fffe40279d0, data=NIO.NIOAny @ 0x00007ffff34c2f58, self=0x00007fffe40278e0) at main.swift:396
   393      }
   394  
   395      func channelRead(ctx: ChannelHandlerContext, data: NIOAny) {
-> 396          let reqPart = self.unwrapInboundIn(data)
   397          if let handler = self.handler {
   398              handler(ctx, reqPart)
   399              return
Target 0: (NIOHTTP1Server) stopped.
(lldb) p ctx
warning: (x86_64) /home/jweiss/devel/swift-nio/.build/x86_64-unknown-linux/debug/ModuleCache/3I30K38GRG9K4/CNIOZlib-3CNGZE9V2CFA7.pcm 0x0000046a: unable to locate module needed for external types: clang version 4.0.0 (git@github.com:apple/swift-clang.git ab7472e733a4081d672e2ef9a8e2011d941d1347) (git@github.com:apple/swift-llvm.git 2dedb62a0bcb69354e15a54be89fb5dfa63275d2)/clang version 4.0.0 (git@github.com:apple/swift-clang.git ab7472e733a4081d672e2ef9a8e2011d941d1347) (git@github.com:apple/swift-llvm.git 2dedb62a0bcb69354e15a54be89fb5dfa63275d2)
error: 'clang version 4.0.0 (git@github.com:apple/swift-clang.git ab7472e733a4081d672e2ef9a8e2011d941d1347) (git@github.com:apple/swift-llvm.git 2dedb62a0bcb69354e15a54be89fb5dfa63275d2)/clang version 4.0.0 (git@github.com:apple/swift-clang.git ab7472e733a4081d672e2ef9a8e2011d941d1347) (git@github.com:apple/swift-llvm.git 2dedb62a0bcb69354e15a54be89fb5dfa63275d2)' does not exist
Debugging will be degraded due to missing types. Rebuilding your project will regenerate the needed module files.
(NIO.ChannelHandlerContext) $R0 = 0x00007fffe40279d0 {
  next = 0x00007fffec0279a0 {
    next = nil
    prev = 0x00007fffe40279d0 {...}
    pipeline = 0x00007fffec028f30 {
      head = 0x00007fffec0288a0 {
        next = 0x00007fffe40271b0 {
          next = 0x00007fffe4027260 {
            next = 0x00007fffe4027540 {
              next = 0x00007fffe4027670 {
                next = 0x00007fffe40279d0 {...}
                prev = 0x00007fffe4027540 {...}
                pipeline = 0x00007fffec028f30 {...}
                name = "handler3"
                inboundHandler = (instance_type = 0x00007fffec027890 -> 0x00000000006b23a0 full type metadata for NIOHTTP1.HTTPServerProtocolErrorHandler + 16, protocol_witness_0 = 0x00000000006a8350 NIOHTTP1Server`protocol witness table for NIOHTTP1.HTTPServerProtocolErrorHandler : NIO._ChannelInboundHandler in NIOHTTP1) {
                  hasUnterminatedResponse = false
                }
                outboundHandler = (instance_type = 0x00007fffec027890 -> 0x00000000006b23a0 full type metadata for NIOHTTP1.HTTPServerProtocolErrorHandler + 16, protocol_witness_0 = 0x00000000006a83b0 NIOHTTP1Server`protocol witness table for NIOHTTP1.HTTPServerProtocolErrorHandler : NIO._ChannelOutboundHandler in NIOHTTP1) {...}
              }
              prev = 0x00007fffe4027260 {...}
              pipeline = 0x00007fffec028f30 {...}
              name = "handler2"
              inboundHandler = 0x00007fffec028f90 {
                state = idle
                readPending = false
                eventBuffer = {
                  buffer = {
                    _buffer = {
                      _storage = 0x00007ffff7b8fc78 {
                        Swift._ContiguousArrayStorageBase = 0 values {}
                      }
                    }
                  }
                  bufferCapacity = 0
                  startIdx = 0
                  endIdx = 0
                  ringLength = 0
                }
                nextExpectedOutboundMessage = head
              }
              outboundHandler = 0x00007fffec028f90 {...}
            }
            prev = 0x00007fffe40271b0 {...}
            pipeline = 0x00007fffec028f30 {...}
            name = "handler1"
            inboundHandler = 0x00007fffec029800 {
              NIOHTTP1.HTTPDecoder = {
                parser = {
                  nread = 67127296
                  content_length = 18446744073709551615
                  http_major = 1
                  http_minor = 1
                  data = (_rawValue = 0x00007fffe4027260 -> 0x00000000006ad7d8 full type metadata for NIO.ChannelHandlerContext + 16)
                }
                settings = {
                  on_message_begin = 0x0000000000588a60 NIOHTTP1Server`@objc closure #&#8203;1 (Swift.Optional<Swift.UnsafeMutablePointer<__C.http_parser>>) -> Swift.Int32 in NIOHTTP1.HTTPDecoder.decoderAdded(ctx: NIO.ChannelHandlerContext) -> () at HTTPDecoder.swift
                  on_url = 0x000000000058c700 NIOHTTP1Server`@objc closure #&#8203;7 (Swift.Optional<Swift.UnsafeMutablePointer<__C.http_parser>>, Swift.Optional<Swift.UnsafePointer<Swift.Int8>>, Swift.Int) -> Swift.Int32 in NIOHTTP1.HTTPDecoder.decoderAdded(ctx: NIO.ChannelHandlerContext) -> () at HTTPDecoder.swift
                  on_status = 0x000000000058c240 NIOHTTP1Server`@objc closure #&#8203;6 (Swift.Optional<Swift.UnsafeMutablePointer<__C.http_parser>>, Swift.Optional<Swift.UnsafePointer<Swift.Int8>>, Swift.Int) -> Swift.Int32 in NIOHTTP1.HTTPDecoder.decoderAdded(ctx: NIO.ChannelHandlerContext) -> () at HTTPDecoder.swift
                  on_header_field = 0x000000000058bbf0 NIOHTTP1Server`@objc closure #&#8203;4 (Swift.Optional<Swift.UnsafeMutablePointer<__C.http_parser>>, Swift.Optional<Swift.UnsafePointer<Swift.Int8>>, Swift.Int) -> Swift.Int32 in NIOHTTP1.HTTPDecoder.decoderAdded(ctx: NIO.ChannelHandlerContext) -> () at HTTPDecoder.swift
                  on_header_value = 0x000000000058bd80 NIOHTTP1Server`@objc closure #&#8203;5 (Swift.Optional<Swift.UnsafeMutablePointer<__C.http_parser>>, Swift.Optional<Swift.UnsafePointer<Swift.Int8>>, Swift.Int) -> Swift.Int32 in NIOHTTP1.HTTPDecoder.decoderAdded(ctx: NIO.ChannelHandlerContext) -> () at HTTPDecoder.swift
                  on_headers_complete = 0x000000000058a6f0 NIOHTTP1Server`@objc closure #&#8203;2 (Swift.Optional<Swift.UnsafeMutablePointer<__C.http_parser>>) -> Swift.Int32 in NIOHTTP1.HTTPDecoder.decoderAdded(ctx: NIO.ChannelHandlerContext) -> () at HTTPDecoder.swift
                  on_body = 0x000000000058ba60 NIOHTTP1Server`@objc closure #&#8203;3 (Swift.Optional<Swift.UnsafeMutablePointer<__C.http_parser>>, Swift.Optional<Swift.UnsafePointer<Swift.Int8>>, Swift.Int) -> Swift.Int32 in NIOHTTP1.HTTPDecoder.decoderAdded(ctx: NIO.ChannelHandlerContext) -> () at HTTPDecoder.swift
                  on_message_complete = 0x000000000058dbd0 NIOHTTP1Server`@objc closure #&#8203;8 (Swift.Optional<Swift.UnsafeMutablePointer<__C.http_parser>>) -> Swift.Int32 in NIOHTTP1.HTTPDecoder.decoderAdded(ctx: NIO.ChannelHandlerContext) -> () at HTTPDecoder.swift
                  on_chunk_header = nil
                  on_chunk_complete = nil
                }
                pendingInOut = 0 values {}
                state = {
                  dataAwaitingState = messageBegin
                  currentNameIndex = nil
                  currentHeaders = 0 values {}
                  currentURI = byteBuffer {
                    byteBuffer = {
                      _readerIndex = 0
                      _writerIndex = 1
                      _slice = 4..<5
                      _storage = 0x00007fffe4026e50 {
                        capacity = 1024
                        bytes = (_rawValue = 0x00007fffe4027b80)
                        fullSlice = 0..<1024
                        allocator = (malloc = 0x000000000045f100 NIOHTTP1Server`@objc closure #&#8203;1 (Swift.Int) -> Swift.Optional<Swift.UnsafeMutableRawPointer> in NIO.ByteBufferAllocator.init() -> NIO.ByteBufferAllocator at ByteBuffer-core.swift, realloc = 0x000000000045f140 NIOHTTP1Server`@objc closure #&#8203;2 (Swift.Optional<Swift.UnsafeMutableRawPointer>, Swift.Int) -> Swift.Optional<Swift.UnsafeMutableRawPointer> in NIO.ByteBufferAllocator.init() -> NIO.ByteBufferAllocator at ByteBuffer-core.swift, free = 0x000000000045f180 NIOHTTP1Server`@objc closure #&#8203;3 (Swift.Optional<Swift.UnsafeMutableRawPointer>) -> () in NIO.ByteBufferAllocator.init() -> NIO.ByteBufferAllocator at ByteBuffer-core.swift, memcpy = 0x000000000045f1c0 NIOHTTP1Server`@objc closure #&#8203;4 (Swift.UnsafeMutableRawPointer, Swift.UnsafeRawPointer, Swift.Int) -> () in NIO.ByteBufferAllocator.init() -> NIO.ByteBufferAllocator at ByteBuffer-core.swift)
                      }
                    }
                  }
                  currentStatus = nil
                  slice = nil
                  readerIndexAdjustment = 0
                  baseAddress = nil
                  currentError = nil
                  seenEOF = false
                  cumulationBuffer = nil
                }
              }
            }
            outboundHandler = nil
          }
          prev = 0x00007fffec0288a0 {...}
          pipeline = 0x00007fffec028f30 {...}
          name = "handler0"
          inboundHandler = nil
          outboundHandler = (instance_type = 0x00007fffec027a10 -> 0x00000000006b2088 full type metadata for NIOHTTP1.HTTPResponseEncoder + 16, protocol_witness_0 = 0x00000000006a76f0 NIOHTTP1Server`protocol witness table for NIOHTTP1.HTTPResponseEncoder : NIO._ChannelOutboundHandler in NIOHTTP1) {
            isChunked = false
          }
        }
        prev = nil
        pipeline = 0x00007fffec028f30 {...}
        name = "head"
        inboundHandler = nil
        outboundHandler = 0x00000000006e3aa0
      }
      tail = 0x00007fffec0279a0 {...}
      idx = 5
      destroyed = false
      eventLoop = 0x00007fffe4000950 {
        selector = 0x00007fffe4000a90 {
          lifecycleState = open
          eventfd = 7
          timerfd = 8
          earliestTimer = 18446744073709551615
          fd = 6
          eventsCapacity = 64
          events = 0x00007fffe4000ae0
          registrations = 1 key/value pair {
            [0] = {
              key = 40
              value = socketChannel {
                socketChannel = {
                  0 = 0x40007fffec028920 {
                    NIO.BaseSocketChannel = {
                      parent = <read memory from 0x40007fffec028930 failed (0 of 16 bytes read)>

                      socket = <read memory from 0x40007fffec028940 failed (0 of 8 bytes read)>

                      closePromise = {
                        futureResult = <read memory from 0x40007fffec028948 failed (0 of 8 bytes read)>

                      }
                      selectableEventLoop = <read memory from 0x40007fffec028950 failed (0 of 8 bytes read)>

                      addressesCached = <read memory from 0x40007fffec028958 failed (0 of 8 bytes read)>

                      bufferAllocatorCached = <read memory from 0x40007fffec028960 failed (0 of 8 bytes read)>

                      isActiveAtomic = <read memory from 0x40007fffec028968 failed (0 of 8 bytes read)>

                      _pipeline = <read memory from 0x40007fffec028970 failed (0 of 8 bytes read)>

                      interestedEvent = (rawValue = NIO.SelectorEventSet.RawValue @ )
                      readPending = true
                      pendingConnect = <read memory from 0x40007fffec028980 failed (0 of 8 bytes read)>

                      recvAllocator = <read memory from 0x40007fffec028988 failed (0 of 40 bytes read)>

                      maxMessagesPerRead = <read memory from 0x40007fffec0289b0 failed (0 of 8 bytes read)>

                      inFlushNow = true
                      autoRead = true
                      lifecycleManager = {
                        eventLoop = <read memory from 0x40007fffec0289c0 failed (0 of 16 bytes read)>

                        isActiveAtomic = <read memory from 0x40007fffec0289d0 failed (0 of 8 bytes read)>

                        currentState = <read memory from 0x40007fffec0289d8 failed (0 of 1 bytes read)>

                      }
                      bufferAllocator = (malloc = <read memory from 0x40007fffec0289e0 failed (0 of 8 bytes read)>, realloc = <read memory from 0x40007fffec0289e8 failed (0 of 8 bytes read)>, free = <read memory from 0x40007fffec0289f0 failed (0 of 8 bytes read)>, memcpy = <read memory from 0x40007fffec0289f8 failed (0 of 8 bytes read)>)
                    }
                    connectTimeout = <read memory from 0x40007fffec028a00 failed (0 of 9 bytes read)>

                    connectTimeoutScheduled = <read memory from 0x40007fffec028a10 failed (0 of 24 bytes read)>

                    allowRemoteHalfClosure = true
                    inputShutdown = true
                    outputShutdown = true
                    pendingWrites = <read memory from 0x40007fffec028a30 failed (0 of 8 bytes read)>

                  }
                  1 = (rawValue = 5)
                }
              }
            }
          }
        }
        thread = 0x00007fffe4000930 (pthread = 140737275258624)
        scheduledTasks = {
          heap = {
            type = minHeap
            storage = {
              _buffer = {
                _storage = 0 values {}
              }
            }
            comparator = 0x00000000004eb9f0 NIOHTTP1Server`partial apply forwarder with unmangled suffix ".23" at Heap.swift
          }
        }
        tasksCopy = {
          _buffer = {
            _storage = 0 values {}
          }
        }
        tasksLock = 0x00007fffe4000a20 (mutex = 0x00007fffe40008c0)
        lifecycleState = open
        _iovecs = 0x00007fffe4000df0
        _storageRefs = 0x00007fffe4004e00
        iovecs = (_position = 0x00007fffe4000df0, _end = 0x00007fffe4004df0)
        storageRefs = (_position = 0x00007fffe4004e00, _end = 0x00007fffe4006e00)
        _msgs = 0x00007fffe4006e10
        _addresses = 0x00007ffff7eb5010
        msgs = (_position = 0x00007fffe4006e10, _end = 0x00007fffe4016e10)
        addresses = (_position = 0x00007ffff7eb5010, _end = 0x00007ffff7ed5010)
        promiseCreationStoreLock = 0x00007fffe4000a40 (mutex = 0x00007fffe4000a60)
        _promiseCreationStore = 20 key/value pairs {
          [0] = {
            key = (_value = 0x00007fffec027830)
            value = (file = "/home/jweiss/devel/swift-nio/Sources/NIO/Bootstrap.swift", line = 636)
          }
          [1] = {
            key = (_value = 0x00007fffe4027090)
            value = (file = "/home/jweiss/devel/swift-nio/Sources/NIO/BaseSocketChannel.swift", line = 431)
          }
          [2] = {
            key = (_value = 0x00007fffec02e0c0)
            value = (file = "/home/jweiss/devel/swift-nio/Sources/NIO/EventLoopFuture.swift", line = 837)
          }
          [3] = {
            key = (_value = 0x00007fffec02eca0)
            value = (file = "/home/jweiss/devel/swift-nio/Sources/NIO/EventLoopFuture.swift", line = 837)
          }
          [4] = {
            key = (_value = 0x00007fffec02e300)
            value = (file = "/home/jweiss/devel/swift-nio/Sources/NIO/EventLoopFuture.swift", line = 837)
          }
          [5] = {
            key = (_value = 0x00007fffec029320)
            value = (file = "/home/jweiss/devel/swift-nio/Sources/NIO/ChannelPipeline.swift", line = 165)
          }
          [6] = {
            key = (_value = 0x00007fffec029760)
            value = (file = "n/a", line = 0)
          }
          [7] = {
            key = (_value = 0x00007fffec028e90)
            value = (file = "/home/jweiss/devel/swift-nio/Sources/NIO/ChannelPipeline.swift", line = 165)
          }
          [8] = {
            key = (_value = 0x00007fffe40273f0)
            value = (file = "/home/jweiss/devel/swift-nio/Sources/NIO/BaseSocketChannel.swift", line = 431)
          }
          [9] = {
            key = (_value = 0x00007fffe40277a0)
            value = (file = "/home/jweiss/devel/swift-nio/Sources/NIO/SocketChannel.swift", line = 456)
          }
          [10] = {
            key = (_value = 0x00007fffec028e10)
            value = (file = "/home/jweiss/devel/swift-nio/Sources/NIO/BaseSocketChannel.swift", line = 355)
          }
          [11] = {
            key = (_value = 0x00007fffec02dd40)
            value = (file = "/home/jweiss/devel/swift-nio/Sources/NIO/EventLoopFuture.swift", line = 837)
          }
          [12] = {
            key = (_value = 0x00007fffec02dfc0)
            value = (file = "/home/jweiss/devel/swift-nio/Sources/NIO/SocketChannel.swift", line = 456)
          }
          [13] = {
            key = (_value = 0x00007fffec02de80)
            value = (file = "/home/jweiss/devel/swift-nio/Sources/NIO/ChannelInvoker.swift", line = 141)
          }
          [14] = {
            key = (_value = 0x00007fffec0291e0)
            value = (file = "/home/jweiss/devel/swift-nio/Sources/NIO/ChannelPipeline.swift", line = 165)
          }
          [15] = {
            key = (_value = 0x00007fffec02df20)
            value = (file = "/home/jweiss/devel/swift-nio/Sources/NIO/ChannelPipeline.swift", line = 165)
          }
          [16] = {
            key = (_value = 0x00007fffec02e490)
            value = (file = "/home/jweiss/devel/swift-nio/Sources/NIO/EventLoopFuture.swift", line = 837)
          }
          [17] = {
            key = (_value = 0x00007fffec027ba0)
            value = (file = "/home/jweiss/devel/swift-nio/Sources/NIOHTTP1Server/main.swift", line = 516)
          }
          [18] = {
            key = (_value = 0x00007fffec02dc70)
            value = (file = "/home/jweiss/devel/swift-nio/Sources/NIO/EventLoopFuture.swift", line = 837)
          }
          [19] = {
            key = (_value = 0x00007fffec029120)
            value = (file = "/home/jweiss/devel/swift-nio/Sources/NIO/EventLoop.swift", line = 175)
          }
        }
      }
      _channel = (instance_type = 0x00007fffec028920, protocol_witness_0 = 0x0000000000696a48 NIOHTTP1Server`protocol witness table for <A where A: NIO.BaseSocket> NIO.BaseSocketChannel<A> : NIO.Channel in NIO)
    }
    name = "tail"
    inboundHandler = 0x00000000006e3bb0
    outboundHandler = nil
  }
  prev = 0x00007fffe4027670 {...}
  pipeline = 0x00007fffec028f30 {...}
  name = "handler4"
  inboundHandler = 0x00007fffe40278e0 {
    buffer = some {
      _readerIndex = 0
      _writerIndex = 12
      _slice = 0..<16
      _storage = 0x00007fffe4027160 {
        capacity = 16
        bytes = (_rawValue = 0x00007fffe4027450)
        fullSlice = 0..<16
        allocator = (malloc = 0x000000000045f100 NIOHTTP1Server`@objc closure #&#8203;1 (Swift.Int) -> Swift.Optional<Swift.UnsafeMutableRawPointer> in NIO.ByteBufferAllocator.init() -> NIO.ByteBufferAllocator at ByteBuffer-core.swift, realloc = 0x000000000045f140 NIOHTTP1Server`@objc closure #&#8203;2 (Swift.Optional<Swift.UnsafeMutableRawPointer>, Swift.Int) -> Swift.Optional<Swift.UnsafeMutableRawPointer> in NIO.ByteBufferAllocator.init() -> NIO.ByteBufferAllocator at ByteBuffer-core.swift, free = 0x000000000045f180 NIOHTTP1Server`@objc closure #&#8203;3 (Swift.Optional<Swift.UnsafeMutableRawPointer>) -> () in NIO.ByteBufferAllocator.init() -> NIO.ByteBufferAllocator at ByteBuffer-core.swift, memcpy = 0x000000000045f1c0 NIOHTTP1Server`@objc closure #&#8203;4 (Swift.UnsafeMutableRawPointer, Swift.UnsafeRawPointer, Swift.Int) -> () in NIO.ByteBufferAllocator.init() -> NIO.ByteBufferAllocator at ByteBuffer-core.swift)
      }
    }
    keepAlive = false
    state = idle
    htdocsPath = "/dev/null/"
    infoSavedRequestHead = nil
    infoSavedBodyBytes = 0
    continuousCount = 0
    handler = nil
    handlerFuture = nil
    fileIO = {
      threadPool = 0x00000000006dc490 {
        semaphore = 0x00000000006dc2c0 {
          Dispatch.DispatchObject = {}
          __wrapped = 0x00000000006dd0b0
        }
        lock = 0x00000000006df8b0 (mutex = 0x00000000006dc460)
        queues = 6 values {
          [0] = 0x00000000006dfba0 {
            Dispatch.DispatchObject = {}
            __wrapped = 0x00000000006dfc10
          }
          [1] = 0x00000000006dfcc0 {
            Dispatch.DispatchObject = {}
            __wrapped = 0x00000000006dfce0
          }
          [2] = 0x00000000006dfd90 {
            Dispatch.DispatchObject = {}
            __wrapped = 0x00000000006dfdb0
          }
          [3] = 0x00000000006dfe60 {
            Dispatch.DispatchObject = {}
            __wrapped = 0x00000000006dfe80
          }
          [4] = 0x00000000006dff30 {
            Dispatch.DispatchObject = {}
            __wrapped = 0x00000000006dff50
          }
          [5] = 0x00000000006e0000 {
            Dispatch.DispatchObject = {}
            __wrapped = 0x00000000006e0020
          }
        }
        state = running {
          running = {
            buffer = {
              _buffer = {
                _storage = 0x40000000006e00a0 {
                  Swift._SwiftNativeNSArrayWithContiguousStorage = {}
                  countAndCapacity = {
                    _storage = {
                      count = <read memory from 0x40000000006e00b0 failed (0 of 8 bytes read)>

                      _capacityAndFlags = <read memory from 0x40000000006e00b8 failed (0 of 8 bytes read)>

                    }
                  }
                }
              }
            }
            bufferCapacity = 16
            startIdx = 0
            endIdx = 0
            ringLength = 0
          }
        }
        numberOfThreads = 6
      }
    }
  }
  outboundHandler = nil
}
(lldb) po ctx
<ChannelHandlerContext: 0x7fffe40279d0>

(lldb) 

@weissi
Copy link
Member Author

weissi commented Apr 19, 2018

@adrian-prantl sorry for the spam, I couldn't do the mv command you suggested as that directory doesn't exist

$ ls  /usr//local/swift/swift-DEVELOPMENT-SNAPSHOT-2018-04-18-a-ubuntu16.04/usr/lib/lldb/clang/include
ls: cannot access '/usr//local/swift/swift-DEVELOPMENT-SNAPSHOT-2018-04-18-a-ubuntu16.04/usr/lib/lldb/clang/include': No such file or directory
$ find /usr/local/swift/swift-DEVELOPMENT-SNAPSHOT-2018-04-18-a-ubuntu16.04/usr/lib/lldb/clang/ -maxdepth 2
/usr/local/swift/swift-DEVELOPMENT-SNAPSHOT-2018-04-18-a-ubuntu16.04/usr/lib/lldb/clang/
/usr/local/swift/swift-DEVELOPMENT-SNAPSHOT-2018-04-18-a-ubuntu16.04/usr/lib/lldb/clang/5.0.0
/usr/local/swift/swift-DEVELOPMENT-SNAPSHOT-2018-04-18-a-ubuntu16.04/usr/lib/lldb/clang/5.0.0/dfsan_abilist.txt
/usr/local/swift/swift-DEVELOPMENT-SNAPSHOT-2018-04-18-a-ubuntu16.04/usr/lib/lldb/clang/5.0.0/asan_blacklist.txt
/usr/local/swift/swift-DEVELOPMENT-SNAPSHOT-2018-04-18-a-ubuntu16.04/usr/lib/lldb/clang/5.0.0/lib
/usr/local/swift/swift-DEVELOPMENT-SNAPSHOT-2018-04-18-a-ubuntu16.04/usr/lib/lldb/clang/5.0.0/cfi_blacklist.txt
/usr/local/swift/swift-DEVELOPMENT-SNAPSHOT-2018-04-18-a-ubuntu16.04/usr/lib/lldb/clang/5.0.0/msan_blacklist.txt
/usr/local/swift/swift-DEVELOPMENT-SNAPSHOT-2018-04-18-a-ubuntu16.04/usr/lib/lldb/clang/5.0.0/include

@adrian-prantl
Copy link
Member

adrian-prantl commented Apr 23, 2018

This should be fixed in swift-4.2-branch f7c80dd or later. Please let me know if you run into further problems!

@weissi
Copy link
Member Author

weissi commented Apr 24, 2018

thanks very much @adrian-prantl, now fixed with swift-DEVELOPMENT-SNAPSHOT-2018-04-23-a-ubuntu16.04

$ /usr/local/swift/swift-DEVELOPMENT-SNAPSHOT-2018-04-23-a-ubuntu16.04/usr/bin/lldb ./.build/x86_64-unknown-linux/debug/NIOHTTP1Server
(lldb) target create "./.build/x86_64-unknown-linux/debug/NIOHTTP1Server"
Current executable set to './.build/x86_64-unknown-linux/debug/NIOHTTP1Server' (x86_64).
(lldb) break set -f main.swift -l 396
Breakpoint 1: where = NIOHTTP1Server`NIOHTTP1Server.(HTTPHandler in _8C8F29B600C5A43D561623635B633A31).channelRead(ctx: NIO.ChannelHandlerContext, data: NIO.NIOAny) -> () + 52 at main.swift:396, address = 0x00000000001d0e44
(lldb) run
Process 1663 launched: './.build/x86_64-unknown-linux/debug/NIOHTTP1Server' (x86_64)
htdocs = /dev/null/
Server started and listening on [IPv6]::1:8888, htdocs path /dev/null/
Process 1663 stopped
* thread #&#8203;2, name = 'NIO-ELT-#1', stop reason = breakpoint 1.1
    frame #&#8203;0: 0x0000555555724e44 NIOHTTP1Server`HTTPHandler.channelRead(ctx=0x00007fffe4027900, data=NIO.NIOAny @ 0x00007ffff34eaff0, self=0x00007fffe4027820) at main.swift:396
   393      }
   394  
   395      func channelRead(ctx: ChannelHandlerContext, data: NIOAny) {
-> 396          let reqPart = self.unwrapInboundIn(data)
   397          if let handler = self.handler {
   398              handler(ctx, reqPart)
   399              return
Target 0: (NIOHTTP1Server) stopped.
(lldb) p ctx
(NIO.ChannelHandlerContext) $R0 = 0x00007fffe4027900 {
  next = 0x00007fffec027de0 {
    next = nil
    prev = 0x00007fffe4027900 {...}
    pipeline = 0x00007fffec028000 {
      head = 0x00007fffec027d80 {
        next = 0x00007fffe4027140 {
          next = 0x00007fffe4027590 {
            next = 0x00007fffe4027310 {
              next = 0x00007fffe4027370 {
                next = 0x00007fffe4027900 {...}
                prev = 0x00007fffe4027310 {...}
                pipeline = 0x00007fffec028000 {...}
                name = "handler3"
                inboundHandler = (instance = 0x00007fffec029130 -> 0x00005555557c3aa8 full type metadata for NIOHTTP1.HTTPServerProtocolErrorHandler + 16, witness_table__ChannelInboundHandler = 0x00005555557bd170 NIOHTTP1Server`protocol witness table for NIOHTTP1.HTTPServerProtocolErrorHandler : NIO._ChannelInboundHandler in NIOHTTP1) {
                  hasUnterminatedResponse = false
                }
                outboundHandler = (instance = 0x00007fffec029130 -> 0x00005555557c3aa8 full type metadata for NIOHTTP1.HTTPServerProtocolErrorHandler + 16, witness_table__ChannelOutboundHandler = 0x00005555557bd200 NIOHTTP1Server`protocol witness table for NIOHTTP1.HTTPServerProtocolErrorHandler : NIO._ChannelOutboundHandler in NIOHTTP1) {...}
              }
              prev = 0x00007fffe4027590 {...}
              pipeline = 0x00007fffec028000 {...}
              name = "handler2"
              inboundHandler = 0x00007fffec029750 {
                state = idle
                readPending = false
                eventBuffer = {
                  buffer = {
                    _buffer = {
                      _storage = 0x00007ffff7788d60 {
                        Swift._ContiguousArrayStorageBase = 0 values {}
                      }
                    }
                  }
                  bufferCapacity = 0
                  startIdx = 0
                  endIdx = 0
                  ringLength = 0
                }
                nextExpectedOutboundMessage = head
              }
              outboundHandler = 0x00007fffec029750 {...}
            }
            prev = 0x00007fffe4027140 {...}
            pipeline = 0x00007fffec028000 {...}
            name = "handler1"
            inboundHandler = 0x00007fffec029210 {
              NIOHTTP1.HTTPDecoder = {
                parser = {
                  nread = 0
                  content_length = 18446744073709551615
                  http_major = 1
                  http_minor = 1
                  data = (_rawValue = 0x00007fffe4027590 -> 0x00005555557c1d90 full type metadata for NIO.ChannelHandlerContext + 16)
                }
                settings = {
                  on_message_begin = 0x00005555556c8d20 NIOHTTP1Server`@objc closure #&#8203;1 (Swift.Optional<Swift.UnsafeMutablePointer<__C.http_parser>>) -> Swift.Int32 in NIOHTTP1.HTTPDecoder.decoderAdded(ctx: NIO.ChannelHandlerContext) -> () at <compiler-generated>
                  on_url = 0x00005555556cbc80 NIOHTTP1Server`@objc closure #&#8203;7 (Swift.Optional<Swift.UnsafeMutablePointer<__C.http_parser>>, Swift.Optional<Swift.UnsafePointer<Swift.Int8>>, Swift.Int) -> Swift.Int32 in NIOHTTP1.HTTPDecoder.decoderAdded(ctx: NIO.ChannelHandlerContext) -> () at <compiler-generated>
                  on_status = 0x00005555556cb820 NIOHTTP1Server`@objc closure #&#8203;6 (Swift.Optional<Swift.UnsafeMutablePointer<__C.http_parser>>, Swift.Optional<Swift.UnsafePointer<Swift.Int8>>, Swift.Int) -> Swift.Int32 in NIOHTTP1.HTTPDecoder.decoderAdded(ctx: NIO.ChannelHandlerContext) -> () at <compiler-generated>
                  on_header_field = 0x00005555556cb230 NIOHTTP1Server`@objc closure #&#8203;4 (Swift.Optional<Swift.UnsafeMutablePointer<__C.http_parser>>, Swift.Optional<Swift.UnsafePointer<Swift.Int8>>, Swift.Int) -> Swift.Int32 in NIOHTTP1.HTTPDecoder.decoderAdded(ctx: NIO.ChannelHandlerContext) -> () at <compiler-generated>
                  on_header_value = 0x00005555556cb3c0 NIOHTTP1Server`@objc closure #&#8203;5 (Swift.Optional<Swift.UnsafeMutablePointer<__C.http_parser>>, Swift.Optional<Swift.UnsafePointer<Swift.Int8>>, Swift.Int) -> Swift.Int32 in NIOHTTP1.HTTPDecoder.decoderAdded(ctx: NIO.ChannelHandlerContext) -> () at <compiler-generated>
                  on_headers_complete = 0x00005555556ca2a0 NIOHTTP1Server`@objc closure #&#8203;2 (Swift.Optional<Swift.UnsafeMutablePointer<__C.http_parser>>) -> Swift.Int32 in NIOHTTP1.HTTPDecoder.decoderAdded(ctx: NIO.ChannelHandlerContext) -> () at <compiler-generated>
                  on_body = 0x00005555556cb0a0 NIOHTTP1Server`@objc closure #&#8203;3 (Swift.Optional<Swift.UnsafeMutablePointer<__C.http_parser>>, Swift.Optional<Swift.UnsafePointer<Swift.Int8>>, Swift.Int) -> Swift.Int32 in NIOHTTP1.HTTPDecoder.decoderAdded(ctx: NIO.ChannelHandlerContext) -> () at <compiler-generated>
                  on_message_complete = 0x00005555556ccc10 NIOHTTP1Server`@objc closure #&#8203;8 (Swift.Optional<Swift.UnsafeMutablePointer<__C.http_parser>>) -> Swift.Int32 in NIOHTTP1.HTTPDecoder.decoderAdded(ctx: NIO.ChannelHandlerContext) -> () at <compiler-generated>
                  on_chunk_header = nil
                  on_chunk_complete = nil
                }
                pendingInOut = 0 values {}
                state = {
                  dataAwaitingState = messageBegin
                  currentNameIndex = nil
                  currentHeaders = 0 values {}
                  currentURI = byteBuffer {
                    byteBuffer = {
                      _readerIndex = 0
                      _writerIndex = 1
                      _slice = 4..<5
                      _storage = 0x80007fffe4027960 {
                        capacity = <read memory from 0x80007fffe4027970 failed (0 of 4 bytes read)>

                        bytes = (_rawValue = <read memory from 0x80007fffe4027978 failed (0 of 8 bytes read)>)
                        fullSlice = {
                          lowerBound = <read memory from 0x80007fffe4027980 failed (0 of 4 bytes read)>

                          upperBound = <read memory from 0x80007fffe4027984 failed (0 of 4 bytes read)>

                        }
                        allocator = (malloc = <read memory from 0x80007fffe4027988 failed (0 of 8 bytes read)>, realloc = <read memory from 0x80007fffe4027990 failed (0 of 8 bytes read)>, free = <read memory from 0x80007fffe4027998 failed (0 of 8 bytes read)>, memcpy = <read memory from 0x80007fffe40279a0 failed (0 of 8 bytes read)>)
                      }
                    }
                  }
                  currentStatus = nil
                  slice = nil
                  readerIndexAdjustment = 0
                  baseAddress = nil
                  currentError = nil
                  seenEOF = false
                  cumulationBuffer = nil
                }
              }
            }
            outboundHandler = nil
          }
          prev = 0x00007fffec027d80 {...}
          pipeline = 0x00007fffec028000 {...}
          name = "handler0"
          inboundHandler = nil
          outboundHandler = (instance = 0x00007fffec027ed0 -> 0x00005555557c3898 full type metadata for NIOHTTP1.HTTPResponseEncoder + 16, witness_table__ChannelOutboundHandler = 0x00005555557bc3b0 NIOHTTP1Server`protocol witness table for NIOHTTP1.HTTPResponseEncoder : NIO._ChannelOutboundHandler in NIOHTTP1) {
            isChunked = false
          }
        }
        prev = nil
        pipeline = 0x00007fffec028000 {...}
        name = "head"
        inboundHandler = nil
        outboundHandler = 0x00005555557f5660
      }
      tail = 0x00007fffec027de0 {...}
      idx = 5
      destroyed = false
      eventLoop = 0x00007fffe4000950 {
        selector = 0x00007fffe4000ac0 {
          lifecycleState = open
          eventfd = 7
          timerfd = 8
          earliestTimer = 18446744073709551615
          fd = 6
          eventsCapacity = 64
          events = 0x00007fffe4000b10
          registrations = 1 key/value pair {
            [0] = {
              key = 40
              value = socketChannel {
                socketChannel = {
                  0 = 0x40007fffec028b20 {
                    NIO.BaseSocketChannel = {
                      parent = <read memory from 0x40007fffec028b30 failed (0 of 16 bytes read)>

                      socket = <read memory from 0x40007fffec028b40 failed (0 of 8 bytes read)>

                      closePromise = {
                        futureResult = <read memory from 0x40007fffec028b48 failed (0 of 8 bytes read)>

                      }
                      selectableEventLoop = <read memory from 0x40007fffec028b50 failed (0 of 8 bytes read)>

                      addressesCached = <read memory from 0x40007fffec028b58 failed (0 of 8 bytes read)>

                      bufferAllocatorCached = <read memory from 0x40007fffec028b60 failed (0 of 8 bytes read)>

                      isActiveAtomic = <read memory from 0x40007fffec028b68 failed (0 of 8 bytes read)>

                      _pipeline = <read memory from 0x40007fffec028b70 failed (0 of 8 bytes read)>

                      interestedEvent = (rawValue = NIO.SelectorEventSet.RawValue @ )
                      readPending = true
                      pendingConnect = <read memory from 0x40007fffec028b80 failed (0 of 8 bytes read)>

                      recvAllocator = <read memory from 0x40007fffec028b88 failed (0 of 40 bytes read)>

                      maxMessagesPerRead = <read memory from 0x40007fffec028bb0 failed (0 of 8 bytes read)>

                      inFlushNow = true
                      autoRead = true
                      lifecycleManager = {
                        eventLoop = <read memory from 0x40007fffec028bc0 failed (0 of 16 bytes read)>

                        isActiveAtomic = <read memory from 0x40007fffec028bd0 failed (0 of 8 bytes read)>

                        currentState = <read memory from 0x40007fffec028bd8 failed (0 of 1 bytes read)>

                      }
                      bufferAllocator = (malloc = <read memory from 0x40007fffec028be0 failed (0 of 8 bytes read)>, realloc = <read memory from 0x40007fffec028be8 failed (0 of 8 bytes read)>, free = <read memory from 0x40007fffec028bf0 failed (0 of 8 bytes read)>, memcpy = <read memory from 0x40007fffec028bf8 failed (0 of 8 bytes read)>)
                    }
                    connectTimeout = <read memory from 0x40007fffec028c00 failed (0 of 9 bytes read)>

                    connectTimeoutScheduled = <read memory from 0x40007fffec028c10 failed (0 of 24 bytes read)>

                    allowRemoteHalfClosure = true
                    inputShutdown = true
                    outputShutdown = true
                    pendingWrites = <read memory from 0x40007fffec028c30 failed (0 of 8 bytes read)>

                  }
                  1 = (rawValue = 7)
                }
              }
            }
          }
        }
        thread = 0x00007fffe4000930 (pthread = 140737275418368)
        scheduledTasks = {
          heap = {
            type = minHeap
            storage = {
              _buffer = {
                _storage = 0 values {}
              }
            }
            comparator = 0x0000555555643c80 NIOHTTP1Server`partial apply forwarder for dispatch thunk of static Swift.Comparable.< infix(A, A) -> Swift.Bool at <compiler-generated>
          }
        }
        tasksCopy = {
          _buffer = {
            _storage = 0 values {}
          }
        }
        tasksLock = 0x00007fffe4000a20 (mutex = 0x00007fffe4000a40)
        lifecycleState = open
        _iovecs = 0x00007fffe4000e20
        _storageRefs = 0x00007fffe4004e30
        iovecs = (_position = 0x00007fffe4000e20, _end = 0x00007fffe4004e20)
        storageRefs = (_position = 0x00007fffe4004e30, _end = 0x00007fffe4006e30)
        _msgs = 0x00007fffe4006e40
        _addresses = 0x00007ffff7ebb010
        msgs = (_position = 0x00007fffe4006e40, _end = 0x00007fffe4016e40)
        addresses = (_position = 0x00007ffff7ebb010, _end = 0x00007ffff7edb010)
        promiseCreationStoreLock = 0x00007fffe4000a70 (mutex = 0x00007fffe4000a90)
        _promiseCreationStore = 19 key/value pairs {
          [0] = {
            key = (_value = 0x00007fffec029570)
            value = (file = "/home/jweiss/devel/swift-nio/Sources/NIO/ChannelInvoker.swift", line = 141)
          }
          [1] = {
            key = (_value = 0x00007fffec029150)
            value = (file = "/home/jweiss/devel/swift-nio/Sources/NIO/Bootstrap.swift", line = 636)
          }
          [2] = {
            key = (_value = 0x00007fffe4027740)
            value = (file = "/home/jweiss/devel/swift-nio/Sources/NIO/SocketChannel.swift", line = 456)
          }
          [3] = {
            key = (_value = 0x00007fffec02a520)
            value = (file = "/home/jweiss/devel/swift-nio/Sources/NIO/ChannelPipeline.swift", line = 165)
          }
          [4] = {
            key = (_value = 0x00007fffe4027140)
            value = (file = "/home/jweiss/devel/swift-nio/Sources/NIO/BaseSocketChannel.swift", line = 431)
          }
          [5] = {
            key = (_value = 0x00007fffec029410)
            value = (file = "/home/jweiss/devel/swift-nio/Sources/NIO/ChannelPipeline.swift", line = 165)
          }
          [6] = {
            key = (_value = 0x00007fffec02a2e0)
            value = (file = "/home/jweiss/devel/swift-nio/Sources/NIO/EventLoopFuture.swift", line = 837)
          }
          [7] = {
            key = (_value = 0x00007fffec02a960)
            value = (file = "/home/jweiss/devel/swift-nio/Sources/NIO/EventLoopFuture.swift", line = 837)
          }
          [8] = {
            key = (_value = 0x00007fffec02aad0)
            value = (file = "/home/jweiss/devel/swift-nio/Sources/NIO/EventLoopFuture.swift", line = 837)
          }
          [9] = {
            key = (_value = 0x00007fffec0293b0)
            value = (file = "/home/jweiss/devel/swift-nio/Sources/NIO/EventLoop.swift", line = 175)
          }
          [10] = {
            key = (_value = 0x00007fffec02a7a0)
            value = (file = "/home/jweiss/devel/swift-nio/Sources/NIO/EventLoopFuture.swift", line = 837)
          }
          [11] = {
            key = (_value = 0x00007fffec02b150)
            value = (file = "/home/jweiss/devel/swift-nio/Sources/NIO/EventLoopFuture.swift", line = 837)
          }
          [12] = {
            key = (_value = 0x00007fffec02a3b0)
            value = (file = "/home/jweiss/devel/swift-nio/Sources/NIO/EventLoopFuture.swift", line = 837)
          }
          [13] = {
            key = (_value = 0x00007fffec027950)
            value = (file = "/home/jweiss/devel/swift-nio/Sources/NIO/BaseSocketChannel.swift", line = 355)
          }
          [14] = {
            key = (_value = 0x00007fffec02b2e0)
            value = (file = "/home/jweiss/devel/swift-nio/Sources/NIO/EventLoopFuture.swift", line = 837)
          }
          [15] = {
            key = (_value = 0x00007fffec02b660)
            value = (file = "/home/jweiss/devel/swift-nio/Sources/NIO/EventLoopFuture.swift", line = 837)
          }
          [16] = {
            key = (_value = 0x00007fffe4027590)
            value = (file = "/home/jweiss/devel/swift-nio/Sources/NIO/BaseSocketChannel.swift", line = 431)
          }
          [17] = {
            key = (_value = 0x00007fffec027c10)
            value = (file = "/home/jweiss/devel/swift-nio/Sources/NIO/ChannelPipeline.swift", line = 165)
          }
          [18] = {
            key = (_value = 0x00007fffec02a650)
            value = (file = "/home/jweiss/devel/swift-nio/Sources/NIO/SocketChannel.swift", line = 456)
          }
        }
      }
      _channel = (instance = 0x00007fffec028b20, witness_table_Channel = 0x00005555557ac618 NIOHTTP1Server`protocol witness table for NIO.BaseSocketChannel<A> : NIO.Channel in NIO)
    }
    name = "tail"
    inboundHandler = 0x00005555557f57e0
    outboundHandler = nil
  }
  prev = 0x00007fffe4027370 {...}
  pipeline = 0x00007fffec028000 {...}
  name = "handler4"
  inboundHandler = (instance = 0x00007fffe4027820 -> 0x00005555557c3c40 full type metadata for NIOHTTP1Server.(HTTPHandler in _8C8F29B600C5A43D561623635B633A31) + 16, witness_table__ChannelInboundHandler = 0x00005555557bebd8 NIOHTTP1Server`protocol witness table for NIOHTTP1Server.(HTTPHandler in _8C8F29B600C5A43D561623635B633A31) : NIO._ChannelInboundHandler in NIOHTTP1Server) {
    instance = 0x00007fffe4027820 -> 0x00005555557c3c40 full type metadata for NIOHTTP1Server.(HTTPHandler in _8C8F29B600C5A43D561623635B633A31) + 16
    witness_table__ChannelInboundHandler = 0x00005555557bebd8 NIOHTTP1Server`protocol witness table for NIOHTTP1Server.(HTTPHandler in _8C8F29B600C5A43D561623635B633A31) : NIO._ChannelInboundHandler in NIOHTTP1Server
  }
  outboundHandler = nil
}

@adrian-prantl
Copy link
Member

adrian-prantl commented Apr 24, 2018

Awesome. Please do let me know if you find any other issues!

@gottesmm
Copy link
Member

gottesmm commented Apr 26, 2018

@weissi is it possible to add this as an integration test to the integration test repo? Seems like something small we could put there. I am surprised that it was not caught earlier.

@adrian-prantl
Copy link
Member

adrian-prantl commented Apr 26, 2018

Just for completeness: I did add a end-to-end test to LLDB that imports libdispatch, when I fixed this.

@weissi
Copy link
Member Author

weissi commented May 1, 2018

thanks @adrian-prantl, that's great to hear!

@swift-ci
Copy link

swift-ci commented May 5, 2018

Comment by Tabor Kelly (JIRA)

I would appear that this is still broken in the Ubuntu 16.04 Swift 4.1.1 release. Would it be possible to get this into a stable release?

@adrian-prantl
Copy link
Member

adrian-prantl commented May 5, 2018

Yes, the fix is only on the swift-4.2 branch. I'll investigate whether it can be backported to 4.1.

@adrian-prantl
Copy link
Member

adrian-prantl commented May 7, 2018

I created a pull request here: apple/swift-lldb#614

@adrian-prantl
Copy link
Member

adrian-prantl commented May 8, 2018

The pull request has been merged onto swift-4.1-branch.

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
@shahmishal shahmishal transferred this issue from apple/swift May 5, 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 LLDB for Swift
Projects
None yet
Development

No branches or pull requests

5 participants