vapor/http

Leaking promise in HTTPClientProtocolUpgrader.swift

mura-admin opened this issue · 1 comments

Line 103 of HTTPClientProtocolUpgrader adds an upgrade promise to the event loop.

self.upgradePromise = worker.eventLoop.newPromise(Upgrader.UpgradeResult.self)

The deinit of the Future in NIO checks for unfulfilled promises and throws a fatalError if in debug.

Not sure how this could be better handled. Maybe adding a deinit to HTTPClientProtocolUpgrader? It seems to occur when the upgrader is unable to connect to the host but would be nice to have a more meaningful error in that case so that it can be used downstream.

Thanks for reporting this bug. I was also able to recreate it by attempting to connect to an invalid hostname.

I've put up a PR here to fix the issue: #316