Closed
Description
AsyncHTTPClient release: 1.2.3 (using in Xcode)
Context:
While trying to send a POST request to a unix socket, i get the following error and stack trace, however am able to talk to the same unix socket using curl --unix-socket ~/test.sock -d {"key":"value"} http://api
but fails from swift using AsyncHTTPClient
I am trying to use this library in Xcode to build a GUI macOS app
2021-02-15 23:51:33.657622+0530 [10776:2468640] [] -[NWConcrete_nw_address_endpoint port] Can't fetch port for address family: 1
2021-02-15 23:51:33.657739+0530 [10776:2468639] [] nw_socket_set_common_sockopts [C1:1] setsockopt SO_NECP_CLIENTUUID failed [22: Invalid argument]
2021-02-15 23:51:33.657778+0530 [10776:2468639] [] nw_socket_set_common_sockopts setsockopt SO_NECP_CLIENTUUID failed [22: Invalid argument]
2021-02-15 23:51:33.657814+0530 [10776:2468639] [] nw_socket_set_no_delay [C1:1] setsockopt TCP_NODELAY failed [102: Operation not supported on socket]
2021-02-15 23:51:33.657854+0530 [10776:2468639] [] nw_socket_set_no_delay setsockopt TCP_NODELAY failed [102: Operation not supported on socket]
2021-02-15 23:51:33.658072+0530 [10776:2468639] [] nw_socket_set_no_delay setsockopt TCP_NODELAY failed [102: Operation not supported on socket], dumping backtrace:
[x86_64] libnetcore-1880.120.4
0 libnetwork.dylib 0x00007fff6c498eb8 __nw_create_backtrace_string + 120
1 libnetwork.dylib 0x00007fff6c1c0f03 nw_socket_set_no_delay + 579
2 libnetwork.dylib 0x00007fff6c1b99f2 nw_socket_set_common_sockopts + 13698
3 libnetwork.dylib 0x00007fff6c127cea nw_socket_initialize_socket + 1738
4 libnetwork.dylib 0x00007fff6c126204 nw_socket_add_input_handler + 772
5 libnetwork.dylib 0x00007fff6c124776 nw_endpoint_flow_attach_socket_protocol + 374
6 libnetwork.dylib 0x00007fff6c11b1eb nw_endpoint_flow_attach_protocols + 7851
7 libnetwork.dylib 0x00007fff6c11669a nw_endpoint_flow_setup_protocols + 2794
8 libnetwork.dylib 0x00007fff6c139a03 -[NWConcrete_nw_endpoint_flow startWithHandler:] + 4451
9 libnetwork.dylib 0x00007fff6c1354e7 nw_endpoint_handler_path_change + 7239
10 libnetwork.dylib 0x00007fff6c12fada nw_endpoint_handler_start + 1210
11 libnetwork.dylib 0x00007fff6c12f474 __nw_connection_start_block_invoke + 788
12 libdispatch.dylib 0x000000010129a844 _dispatch_call_block_and_release + 12
13 libdispatch.dylib 0x000000010129b826 _dispatch_client_callout + 8
14 libdispatch.dylib 0x00000001012a5525 _dispatch_workloop_invoke + 3149
15 libdispatch.dylib 0x00000001012b0fe0 _dispatch_workloop_worker_thread + 691
16 libsystem_pthread.dylib 0x0000000101329361 _pthread_wqthread + 290
17 libsystem_pthread.dylib 0x000000010132849b start_wqthread + 15
2021-02-15 23:51:33.658635+0530 [10776:2468640] [] -[NWConcrete_nw_address_endpoint port] Can't fetch port for address family: 1
2021-02-15 23:51:33.658652+0530 [10776:2468639] [] nw_socket_setup_notsent_lowat [C1:1] setsockopt TCP_NOTSENT_LOWAT(16384) failed on fd 4 [102: Operation not supported on socket]
2021-02-15 23:51:33.658692+0530 [10776:2468639] [] nw_socket_setup_notsent_lowat setsockopt TCP_NOTSENT_LOWAT(16384) failed on fd 4 [102: Operation not supported on socket]
2021-02-15 23:51:33.658719+0530 [10776:2468640] [] -[NWConcrete_nw_address_endpoint port] Can't fetch port for address family: 1
2021-02-15 23:51:33.658791+0530 [10776:2468639] [] nw_socket_setup_notsent_lowat setsockopt TCP_NOTSENT_LOWAT(16384) failed on fd 4 [102: Operation not supported on socket], dumping backtrace:
[x86_64] libnetcore-1880.120.4
0 libnetwork.dylib 0x00007fff6c498eb8 __nw_create_backtrace_string + 120
1 libnetwork.dylib 0x00007fff6c1c84e4 nw_socket_setup_notsent_lowat + 884
2 libnetwork.dylib 0x00007fff6c1c74c6 nw_socket_handle_socket_event + 1622
3 libdispatch.dylib 0x000000010129b826 _dispatch_client_callout + 8
4 libdispatch.dylib 0x000000010129e67d _dispatch_continuation_pop + 585
5 libdispatch.dylib 0x00000001012b4635 _dispatch_source_invoke + 2135
6 libdispatch.dylib 0x00000001012a5316 _dispatch_workloop_invoke + 2622
7 libdispatch.dylib 0x00000001012b0fe0 _dispatch_workloop_worker_thread + 691
8 libsystem_pthread.dylib 0x0000000101329361 _pthread_wqthread + 290
9 libsystem_pthread.dylib 0x000000010132849b start_wqthread + 15
notFound
2021-02-15 23:51:33.664536+0530 [10776:2468639] [] nw_endpoint_flow_fillout_tcp_info_block_invoke getsockopt TCP_INFO failed [102: Operation not supported on socket]
2021-02-15 23:51:33.664579+0530 [10776:2468639] [] nw_connection_copy_connected_local_endpoint [C1] Connection has no local endpoint
Steps to reproduce: Using something similar to following to send the request
class client {
let httpClient: HTTPClient
init() {
self.httpClient = HTTPClient(eventLoopGroupProvider: .createNew)
}
deinit {
try? self.httpClient.syncShutdown()
}
func getStatus() {
do {
let reqJson = try JSONEncoder().encode(Request(command: "status", args: nil))
if let response = try? self.httpClient.execute(.POST,
socketPath: "/Users/anjan/test.sock",
urlPath: "/api",
body: .string(String(data: reqJson, encoding: .utf8)!)).wait() {
print(response.status)
}
}
catch (let err) {
print(err)
}
}
}
$ swift --version
Apple Swift version 5.3.2 (swiftlang-1200.0.45 clang-1200.0.32.28)
Target: x86_64-apple-darwin19.6.0
Operating system: macOS catalina 10.15.7
$ uname -a
19.6.0 Darwin Kernel Version 19.6.0
Metadata
Metadata
Assignees
Labels
No labels