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

Link fails with 403 repeatedly until it eventually recovers #191

Open
lawik opened this issue May 17, 2024 · 3 comments
Open

Link fails with 403 repeatedly until it eventually recovers #191

lawik opened this issue May 17, 2024 · 3 comments

Comments

@lawik
Copy link
Contributor

lawik commented May 17, 2024

06:48:16.099 [warn] [NervesHubLink] error: {:error, {:upgrade_failure, %{reason: %Mint.WebSocket.UpgradeFailureError{status_code: 403, headers: [{"date", "Fri, 17 May 2024 06:48:15 GMT"}, {"content-length", "0"}, {"vary", "accept-encoding"}, {"cache-control", "max-age=0, private, must-revalidate"}]}, status_code: 403, resp_headers: [{"date", "Fri, 17 May 2024 06:48:15 GMT"}, {"content-length", "0"}, {"vary", "accept-encoding"}, {"cache-control", "max-age=0, private, must-revalidate"}]}}}

06:48:16.099 [info]     :alarm_handler: {:set,
 {NervesHubLink.Disconnected,
  [
    reason: {:error,
     {:upgrade_failure,
      %{
        reason: %Mint.WebSocket.UpgradeFailureError{
          status_code: 403,
          headers: [
            {"date", "Fri, 17 May 2024 06:48:15 GMT"},
            {"content-length", "0"},
            {"vary", "accept-encoding"},
            {"cache-control", "max-age=0, private, must-revalidate"}
          ]
        },
        status_code: 403,
        resp_headers: [
          {"date", "Fri, 17 May 2024 06:48:15 GMT"},
          {"content-length", "0"},
          {"vary", "accept-encoding"},
          {"cache-control", "max-age=0, private, must-revalidate"}
        ]
      }}}
  ]}}

06:48:16.108 [warn] [NervesHubLink.Socket] Unhandled handle_info: {:EXIT, #Port<0.100>, :normal}

06:48:32.561 [info] disconnect --------

06:48:32.562 [warn] [NervesHubLink] error: {:error, {:upgrade_failure, %{reason: %Mint.WebSocket.UpgradeFailureError{status_code: 403, headers: [{"date", "Fri, 17 May 2024 06:48:31 GMT"}, {"content-length", "0"}, {"vary", "accept-encoding"}, {"cache-control", "max-age=0, private, must-revalidate"}]}, status_code: 403, resp_headers: [{"date", "Fri, 17 May 2024 06:48:31 GMT"}, {"content-length", "0"}, {"vary", "accept-encoding"}, {"cache-control", "max-age=0, private, must-revalidate"}]}}}

06:48:32.563 [info]     :alarm_handler: {:set,
 {NervesHubLink.Disconnected,
  [
    reason: {:error,
     {:upgrade_failure,
      %{
        reason: %Mint.WebSocket.UpgradeFailureError{
          status_code: 403,
          headers: [
            {"date", "Fri, 17 May 2024 06:48:31 GMT"},
            {"content-length", "0"},
            {"vary", "accept-encoding"},
            {"cache-control", "max-age=0, private, must-revalidate"}
          ]
        },
        status_code: 403,
        resp_headers: [
          {"date", "Fri, 17 May 2024 06:48:31 GMT"},
          {"content-length", "0"},
          {"vary", "accept-encoding"},
          {"cache-control", "max-age=0, private, must-revalidate"}
        ]
      }}}
  ]}}

06:48:32.572 [warn] [NervesHubLink.Socket] Unhandled handle_info: {:EXIT, #Port<0.105>, :normal}

This might be the setup of NervesCloud @joshk, or it could be normal thing.

Is there a token or something written to the data partition or something. It seems to happen after I've done a firmware update, it starts up, gets networking but fails to auth?

@lawik
Copy link
Contributor Author

lawik commented May 22, 2024

@joshk have a hunch this is because it tries to connect the NervesHubLink before NervesTime.synchronized? is true. Haven't verified but it seems plausible. If the time behavior is kind of naive or silly on start it might give a time that is several hours off and we allow about 90 seconds of diff.

@joshk
Copy link
Contributor

joshk commented May 24, 2024

I think @lawik has hit the nail on the head.

I have a PR which would add a time synchronisation check when the network is checked, but before I create a PR for that I would like to make a simple RTC lib or module in the NervesTime lib that bypasses NTP when using your host computer. (good for testing)

@joshk
Copy link
Contributor

joshk commented May 24, 2024

I had another idea, instead of a way to bypass NTP, I instead added a way to bypass the time sync check

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants