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

HTTP2 go away at the protocol level lets the request hang

Aperta
#660 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
38/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Ferma
Stack tecnologico
swift
Ambito
networking

Direzione di ricerca

Inizia da Sources/AsyncHTTPClient/ConnectionPool/HTTP2/HTTP2IdleHandler.swift, in particolare dalla gestione del codice di errore GOAWAY di HTTP/2. Esegui il test di riproduzione testGoAwayFromServerDoesntHangRequest, che usa un body della request non vuoto e una deadline in un futuro lontano. Il lavoro è completato quando la request non rimane più bloccata e il test osserva l’errore lanciato previsto.

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

Descrizione

kind/bug

We currently ignore the error code of the go away. I think if it is a protocol error we will never receive any further HTTP2Frame on the connection or any stream and need manually cancel all active streams. Maybe this is better handled at the nio http2 level but I'm not sure yet.

Reproducer:

    func testGoAwayFromServerDoesntHangRequest() throws {
        //try XCTSkipIf(true, "this currently hangs")
        let bin = HTTPBin(.http2())
        defer { XCTAssertNoThrow(try bin.shutdown()) }
        
        let loggerFactor = StreamLogHandler.standardOutput(label:)
        var bgLogger = Logger(label: "BG", factory: loggerFactor)
        bgLogger.logLevel = .trace
        
        let client = HTTPClient(
            eventLoopGroupProvider: .createNew,
            configuration: .init(certificateVerification: .none),
            backgroundActivityLogger: bgLogger
        )
        
        defer { XCTAssertNoThrow(try client.syncShutdown()) }
        
        var request = try HTTPClient.Request(url: bin.baseURL, method: .POST)
        // add ~64 KB header
        let headerValue = String(repeating: "0", count: 1024)
        for headerID in 0..<64 {
            request.headers.replaceOrAdd(name: "larg-header-\(headerID)", value: headerValue)
        }

        // non empty body is important to trigger this bug as we otherwise finish the request in a single flush
        request.body = .byteBuffer(ByteBuffer(bytes: [0]))

        var rqLogger = Logger(label: "RQ", factory: loggerFactor)
        rqLogger.logLevel = .trace
        
        XCTAssertThrows(try client.execute(request: request, deadline: .distantFuture, logger: rqLogger).wait())
    }
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.