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

Tracker Checker: handle HTTP Tracker error ConnectionRefused #683

Closed
Tracked by #669 ...
josecelano opened this issue Feb 2, 2024 · 1 comment
Closed
Tracked by #669 ...

Tracker Checker: handle HTTP Tracker error ConnectionRefused #683

josecelano opened this issue Feb 2, 2024 · 1 comment
Assignees
Labels
- Admin - Enjoyable to Install and Setup our Software - Developer - Torrust Improvement Experience Code Cleanup / Refactoring Tidying and Making Neat Easy Good for Newcomers Enhancement / Feature Request Something New good first issue Good for newcomers Testing Checking Torrust
Milestone

Comments

@josecelano
Copy link
Member

Parent issue: #669
Depends on: #680

When you run the Tracker Checker with a HTTP Tracker service not running you get this error:

TORRUST_CHECKER_CONFIG='{
    "udp_trackers": [],
    "http_trackers": ["http://127.0.0.1:7070"],
    "health_checks": []
}' cargo run --bin tracker_checker
Running checks for trackers ...
UDP trackers ...
HTTP trackers ...
thread 'main' panicked at /home/josecelano/Documents/git/committer/me/github/torrust/torrust-tracker/src/shared/bit_torrent/tracker/http/client/mod.rs:87:61:
called `Result::unwrap()` on an `Err` value: reqwest::Error { kind: Request, url: Url { scheme: "http", cannot_be_a_base: false, username: "", password: None, host: Some(Ipv4(127.0.0.1)), port: Some(7070), path: "/announce", query: Some("info_hash=%9C8B%22%13%E3%0B%FF%21%2B0%C3%60%D2o%9A%02%13d%22&peer_addr=192.168.1.88&downloaded=0&uploaded=0&peer_id=%2DqB00000000000000001&port=17548&left=0&event=completed&compact=0"), fragment: None }, source: hyper::Error(Connect, ConnectError("tcp connect error", Os { code: 111, kind: ConnectionRefused, message: "Connection refused" })) }
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

After implementing the issue #680 we could catch the error and continue with the execution of the Tracker Checker, checking other services. CUrrently, the checker is halted without finishing.

@josecelano josecelano added Enhancement / Feature Request Something New Easy Good for Newcomers Code Cleanup / Refactoring Tidying and Making Neat - Developer - Torrust Improvement Experience - Admin - Enjoyable to Install and Setup our Software Testing Checking Torrust good first issue Good for newcomers labels Feb 2, 2024
@josecelano josecelano added this to the v3.1.0 milestone Feb 2, 2024
@da2ce7 da2ce7 self-assigned this Mar 28, 2024
@josecelano
Copy link
Member Author

This was implemented by @da2ce7.

The current output is you disable only the HTTP tracker:

$ TORRUST_CHECKER_CONFIG='{
    "udp_trackers": ["127.0.0.1:6969"],
    "http_trackers": ["http://127.0.0.1:7070"],
    "health_checks": []
}' cargo run --bin tracker_checker
    Finished `dev` profile [optimized + debuginfo] target(s) in 0.09s
     Running `target/debug/tracker_checker`
2024-09-11T15:44:27.049057Z  INFO torrust_tracker::console::clients::checker::service: Running checks for trackers ...
[
  {
    "Udp": {
      "Ok": {
        "remote_addr": "127.0.0.1:6969",
        "results": [
          [
            "Setup",
            {
              "Ok": null
            }
          ],
          [
            "Connect",
            {
              "Ok": null
            }
          ],
          [
            "Announce",
            {
              "Ok": null
            }
          ],
          [
            "Scrape",
            {
              "Ok": null
            }
          ]
        ]
      }
    }
  },
  {
    "Http": {
      "Err": {
        "url": "http://127.0.0.1:7070/",
        "results": [
          [
            "Announce",
            {
              "Err": "Http request did not receive a response within the timeout: ResponseError { err: reqwest::Error { kind: Request, url: \"http://127.0.0.1:7070/announce?info_hash=%9C8B%22%13%E3%0B%FF%21%2B0%C3%60%D2o%9A%02%13d%22&peer_addr=192.168.1.88&downloaded=0&uploaded=0&peer_id=%2DqB00000000000000001&port=17548&left=0&event=completed&compact=0\", source: hyper_util::client::legacy::Error(Connect, ConnectError(\"tcp connect error\", Os { code: 111, kind: ConnectionRefused, message: \"Connection refused\" })) } }"
            }
          ],
          [
            "Scrape",
            {
              "Err": "Http request did not receive a response within the timeout: ResponseError { err: reqwest::Error { kind: Request, url: \"http://127.0.0.1:7070/scrape?info_hash=%9C8B%22%13%E3%0B%FF%21%2B0%C3%60%D2o%9A%02%13d%22\", source: hyper_util::client::legacy::Error(Connect, ConnectError(\"tcp connect error\", Os { code: 111, kind: ConnectionRefused, message: \"Connection refused\" })) } }"
            }
          ]
        ]
      }
    }
  }
]

The checks for the UDP are executed correctly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
- Admin - Enjoyable to Install and Setup our Software - Developer - Torrust Improvement Experience Code Cleanup / Refactoring Tidying and Making Neat Easy Good for Newcomers Enhancement / Feature Request Something New good first issue Good for newcomers Testing Checking Torrust
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

2 participants