Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handling TCP connection errors #2829

Open
mikee47 opened this issue Jun 23, 2024 · 0 comments
Open

Handling TCP connection errors #2829

mikee47 opened this issue Jun 23, 2024 · 0 comments
Labels

Comments

@mikee47
Copy link
Contributor

mikee47 commented Jun 23, 2024

There is an ongoing issue with the apparent lack of response when HTTP connections fail, such as with invalid URLs (issue #1937).

PR #1939 was a simple attempt to address this problem, but I'm closing that because this issue requires scoping out properly first and applies to all types of TCP connections, not just HTTP.

When a HTTP request is issued a completed delgate is supplied, which receives a boolean successful parameter. This parameter is false if HTTP parsing fails or the remote connection returns an HTTP error code.

If, when sending the request, a failure occurs in the connection process then the callback is never invoked. This can happen if:

  • The server address specified cannot be resolved (DNS failure)
  • A TCP connection cannot be made to the server (no service on the specified port)

And probabaly others. Issues are:

  • These failures are essentially permanent so retrying the request is generally pointless, but that is what happen and can continue indefinitely
  • Diagnosing the issue requires setting DEBUG_VERBOSE_LEVEL=3 and observing output
  • There's no mechanism for reporting these failures to an application

My feeling is that invoking the HttpRequest completion callback is not the correct approach here since a failure (successful=false) should only relate to the response from the remote server. Here, the request hasn't actually completed and is still in the queue.

This suggests that a new API for catching such errors would be useful for an application.
We'd need to:

  • Decide where to place the API (probably in the TCP classes somewhere)
  • How to define the callback, perhaps with a code indicating the cause of failure (e.g. DNS resolution failure)
  • Fully document the various callbacks and methods to clarify usage
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant