Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

AHC causes uncleanShutdown error on server side.

Aperta
#808 3 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
35/100
Tipo di issue
Bug
Chiarezza
Da chiarire
Stato di attività
Ferma
Stack tecnologico
swift
Ambito
networking

Direzione di ricerca

Riproduci il report usando il server hummingbird-examples/http2 e il codice client AsyncParsableCommand run() async throws mostrato, quindi confrontalo con la richiesta curl. Traccia l'arresto del client e la gestione di TLS intorno a HTTPClient.withHTTPClient e client.shutdown(), concentrandoti sul fatto che la connessione invii o meno CLOSE_NOTIFY. Il lavoro è completato quando la richiesta può terminare e il comando può uscire senza che il server segnali uncleanShutdown.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

I have a server that is functionally similar in setup to hummingbird-examples/http2, when I use async-http-client to make a request with a command line program that exits after the request, humming bird reports this error:

[HummingbirdHTTP2] Error handling inbound connection for HTTP2 handler: uncleanShutdown

I do not see the same error when using curl:

curl --cacert certs/ca.crt --http2 -v https://localhost:8043/healthcheck
    var tlsConfiguration: TLSConfiguration {
        get throws {
            let certificateChain = try NIOSSLCertificate.fromPEMFile(self.certificateChain)
            var tlsConfiguration = TLSConfiguration.makeClientConfiguration()
            tlsConfiguration.trustRoots = .certificates(certificateChain)
            #if os(macOS)
            tlsConfiguration.certificateVerification = .none
            #else
            // not supported with Network.framework
            tlsConfiguration.certificateVerification = .noHostnameVerification
            #endif
            return tlsConfiguration
        }
    }

relevant code in the run() async throws method of an AsyncParsableCommand:

        var clientConfig = HTTPClient.Configuration()
        clientConfig.tlsConfiguration = try self.tlsConfiguration
        try await HTTPClient.withHTTPClient(configuration: clientConfig) { client in
            var request = HTTPClientRequest(url: url.absoluteString)
            request.method = .POST
            request.headers.add(name: "content-type", value: "application/json")
            request.headers.add(name: "content-length", value: "\(payloadData.count)")
            request.body = .bytes(payloadData)
            let response = try await client.execute(request, timeout: .seconds(30))
            let body = try await response.body.collect(upTo: 10 * 1024 * 1024)
        }

I've tried many variations that all execute await client.shutdown() before exiting and they all result in this error. From what Cory says here: https://forums.swift.org/t/niossl-spurious-uncleanshutdown-error/53031/3 it seems like AHC isn't sending CLOSE_NOTIFY on shutdown?

Lingua principale
Swift
Stelle
1.1k
Fork
156
Merge medio
1h 54m
PR unite (30g)
4

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di swift-server/async-http-client

Tutte le issue di swift-server/async-http-client

Issue simili

Altre issue su Swift

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.