You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm trying to use SwiftyRequest for a simple StatHat client under Linux. The code below worked fine in the past under macOS and Linux but was leaking memory on Linux because of #24 and crashing randomly because of #25.
I decided to give it another go now that both issues seem to have been addressed and my app under linux now fails to do any HTTP requests and is always failing with 1001 (timeout).
The same code works fine under macOS. Swift 5.1 from Xcode 11.
It fails consistently with error 1001 under Linux official docker image for swift 5.1.
DispatchQueue.global().async {
let request = RestRequest(method: .post, url: "https://api.stathat.com/ez")
let stat = ["stat": name, "value": v] as [String : Any]
let json = JSONWrapper(dictionary: ["ezkey": user, "data": [stat]])
request.messageBody = try? json.serialize()
request.response() { data, response, error in
if let e = error {
Log.error("ERROR: failed to stathatTrackEZValue stat: '\(stat)', error: \(e)")
} else if let d = data, let s = String(data: d, encoding: .utf8) {
Log.debug("stathatTrackEZValue: response: \(s)")
}
}
}
All requests seem to be consistently timing out after 60 seconds, the default request timeout. Invoking curl from the docker image against the same API endpoint works. Here is the trace, it seems to be defaulting to http2
* TCP_NODELAY set
* Connected to api.stathat.com (52.207.158.45) port 443 (#0)
* ALPN, offering h2
* ALPN, offering http/1.1
* successfully set certificate verify locations:
* CAfile: /etc/ssl/certs/ca-certificates.crt
CApath: /etc/ssl/certs
* TLSv1.3 (OUT), TLS handshake, Client hello (1):
* TLSv1.3 (IN), TLS handshake, Server hello (2):
* TLSv1.2 (IN), TLS handshake, Certificate (11):
* TLSv1.2 (IN), TLS handshake, Server key exchange (12):
* TLSv1.2 (IN), TLS handshake, Server finished (14):
* TLSv1.2 (OUT), TLS handshake, Client key exchange (16):
* TLSv1.2 (OUT), TLS change cipher, Client hello (1):
* TLSv1.2 (OUT), TLS handshake, Finished (20):
* TLSv1.2 (IN), TLS handshake, Finished (20):
* SSL connection using TLSv1.2 / ECDHE-RSA-AES128-GCM-SHA256
* ALPN, server did not agree to a protocol
* Server certificate:
* subject: CN=*.stathat.com
* start date: Dec 15 00:00:00 2018 GMT
* expire date: Jan 15 12:00:00 2020 GMT
* subjectAltName: host "api.stathat.com" matched cert's "*.stathat.com"
* issuer: C=US; O=Amazon; OU=Server CA 1B; CN=Amazon
* SSL certificate verify ok.
> POST /ez HTTP/1.1
> Host: api.stathat.com
> User-Agent: curl/7.58.0
> Accept: */*
> Content-Length: 59
> Content-Type: application/x-www-form-urlencoded
>
* upload completely sent off: 59 out of 59 bytes
< HTTP/1.1 200 OK
< Content-Type: application/json
< Date: Mon, 30 Sep 2019 13:32:28 GMT
< Content-Length: 41
< Connection: keep-alive
Any obvious mistakes?
The text was updated successfully, but these errors were encountered:
Couple more details. I actually fire 13 simultaneous requests at the same time like this and some appear to succeed and others to timeout. No pattern. working fine from Mac OS.
Here is a simple executable that demonstrates the problem. Simply build and run and it repeatedly fires multiple concurrent http post requests. Works fine under Linux swift 5.0 and fails with timeouts under Linux swift 5.1, so looks like this is a 5.1 issue. Will report a bug.
mman
changed the title
[Linux] Error Domain=NSURLErrorDomain Code=-1001 for working server
[Linux] [Regression] Error Domain=NSURLErrorDomain Code=-1001 under Linux Swift 5.1
Oct 2, 2019
I'm trying to use SwiftyRequest for a simple StatHat client under Linux. The code below worked fine in the past under macOS and Linux but was leaking memory on Linux because of #24 and crashing randomly because of #25.
I decided to give it another go now that both issues seem to have been addressed and my app under linux now fails to do any HTTP requests and is always failing with 1001 (timeout).
The same code works fine under macOS. Swift 5.1 from Xcode 11.
It fails consistently with error 1001 under Linux official docker image for swift 5.1.
All requests seem to be consistently timing out after 60 seconds, the default request timeout. Invoking curl from the docker image against the same API endpoint works. Here is the trace, it seems to be defaulting to http2
Any obvious mistakes?
The text was updated successfully, but these errors were encountered: