IsmaelMartinez / teams-for-linux

Unofficial Microsoft Teams for Linux client
GNU General Public License v3.0
2.93k stars 237 forks source link

Fails to detect active connection: `Testing network using net.request() for https://teams.microsoft.com` #1405

Closed akorn closed 3 weeks ago

akorn commented 1 month ago

Describe the bug For the last few days, I've been unable to use the application. On startup, it pops up an empty window with the title "No internet connection", and logs this to the console:

13:06:18.231 › Testing network using net.request() for https://teams.microsoft.com
13:06:19.233 › Network test failed with method https
13:06:19.233 › No internet connection

To Reproduce Steps to reproduce the behavior:

  1. Start teams-for-linux

Expected behavior Normal startup.

Screenshots Not useful (the log messages say it all).

Desktop (please complete the following information):

Debug

% teams-for-linux --webDebug
No config file found, using default values
all good with appLogLevels you aren't using them
Initialising logger with config: "{}"
Logger initialised with transports: {}
13:10:34.418 › File logging at /home/korn/.config/teams-for-linux/logs/main.log with level silly
13:10:34.421 › Console logging enabled with level silly
13:10:34.422 › Logger initialised
13:10:34.422 › configPath: /home/korn/.config/teams-for-linux
13:10:34.423 › configFile: {}
[9563:0913/131101.100878:ERROR:object_proxy.cc(576)] Failed to call method: org.kde.KWallet.isEnabled: object_path= /modules/kwalletd5: org.freedesktop.DBus.Error.NoReply: Did not receive a reply. Possible causes include: the remote application did not send a reply, the message bus security policy blocked the reply, the reply timeout expired, or the network connection was broken.
[9563:0913/131101.100910:ERROR:kwallet_dbus.cc(112)] Error contacting kwalletd5 (isEnabled)
[9563:0913/131101.101097:ERROR:object_proxy.cc(576)] Failed to call method: org.kde.KLauncher.start_service_by_desktop_name: object_path= /KLauncher: org.freedesktop.DBus.Error.ServiceUnknown: The name is not activatable
[9563:0913/131101.101131:ERROR:kwallet_dbus.cc(81)] Error contacting klauncher to start kwalletd5
[9563:0913/131126.126264:ERROR:object_proxy.cc(576)] Failed to call method: org.kde.KWallet.close: object_path= /modules/kwalletd5: org.freedesktop.DBus.Error.NoReply: Did not receive a reply. Possible causes include: the remote application did not send a reply, the message bus security policy blocked the reply, the reply timeout expired, or the network connection was broken.
[9563:0913/131126.126285:ERROR:kwallet_dbus.cc(502)] Error contacting kwalletd5 (close)
13:11:26.302 › processArgs: [ '/opt/teams-for-linux/teams-for-linux', '--webDebug' ]
13:11:26.303 › testing RegExp processArgs false
13:11:26.304 › testing RegExp processArgs false
13:11:26.304 › Testing network using net.request() for https://teams.microsoft.com
13:11:26.307 › Spellchecker is disabled!
[9563:0913/131126.643723:ERROR:network_service_instance_impl.cc(599)] Network service crashed, restarting service.
13:11:27.651 › Network test failed with method https
13:11:27.651 › Waiting for network...
13:11:27.651 › Testing network using net.request() for https://teams.microsoft.com
13:11:28.653 › Testing network using net.request() for https://teams.microsoft.com
13:11:29.655 › Testing network using net.request() for https://teams.microsoft.com
13:11:30.657 › Testing network using net.request() for https://teams.microsoft.com
13:11:31.659 › Testing network using net.request() for https://teams.microsoft.com
13:11:32.662 › Testing network using net.request() for https://teams.microsoft.com
13:11:33.664 › Testing network using net.request() for https://teams.microsoft.com
13:11:34.667 › Testing network using net.request() for https://teams.microsoft.com
13:11:35.669 › Testing network using net.request() for https://teams.microsoft.com
13:11:36.671 › Testing network using net.request() for https://teams.microsoft.com
13:11:37.673 › Testing network using net.request() for https://teams.microsoft.com
13:11:38.675 › Testing network using net.request() for https://teams.microsoft.com
13:11:39.677 › Testing network using net.request() for https://teams.microsoft.com
13:11:40.679 › Testing network using net.request() for https://teams.microsoft.com
13:11:41.684 › Testing network using net.request() for https://teams.microsoft.com
13:11:42.686 › Testing network using net.request() for https://teams.microsoft.com
13:11:43.687 › Testing network using net.request() for https://teams.microsoft.com
13:11:44.689 › Testing network using net.request() for https://teams.microsoft.com
13:11:45.691 › Testing network using net.request() for https://teams.microsoft.com
13:11:46.694 › Testing network using net.request() for https://teams.microsoft.com
13:11:47.696 › Testing network using net.request() for https://teams.microsoft.com
13:11:48.698 › Testing network using net.request() for https://teams.microsoft.com
13:11:49.700 › Testing network using net.request() for https://teams.microsoft.com
13:11:50.702 › Testing network using net.request() for https://teams.microsoft.com
13:11:51.704 › Testing network using net.request() for https://teams.microsoft.com
13:11:52.706 › Testing network using net.request() for https://teams.microsoft.com
13:11:53.707 › Testing network using net.request() for https://teams.microsoft.com
13:11:54.709 › Testing network using net.request() for https://teams.microsoft.com
13:11:55.712 › Testing network using net.request() for https://teams.microsoft.com
13:11:56.713 › Testing network using net.request() for https://teams.microsoft.com
13:11:57.715 › Network test failed with method https
13:11:57.716 › No internet connection

From main.log:

[2024-09-13 13:11:26.302] [debug] processArgs: [ '/opt/teams-for-linux/teams-for-linux', '--webDebug' ]
[2024-09-13 13:11:26.303] [debug] testing RegExp processArgs false
[2024-09-13 13:11:26.304] [debug] testing RegExp processArgs false
[2024-09-13 13:11:26.304] [debug] Testing network using net.request() for https://teams.microsoft.com
[2024-09-13 13:11:26.307] [debug] Spellchecker is disabled!
[2024-09-13 13:11:27.651] [debug] Network test failed with method https
[2024-09-13 13:11:27.651] [debug] Waiting for network...
[2024-09-13 13:11:27.651] [debug] Testing network using net.request() for https://teams.microsoft.com
[2024-09-13 13:11:28.653] [debug] Testing network using net.request() for https://teams.microsoft.com
[2024-09-13 13:11:29.655] [debug] Testing network using net.request() for https://teams.microsoft.com
[2024-09-13 13:11:30.657] [debug] Testing network using net.request() for https://teams.microsoft.com
[2024-09-13 13:11:31.659] [debug] Testing network using net.request() for https://teams.microsoft.com
[2024-09-13 13:11:32.662] [debug] Testing network using net.request() for https://teams.microsoft.com
[2024-09-13 13:11:33.664] [debug] Testing network using net.request() for https://teams.microsoft.com
[2024-09-13 13:11:34.667] [debug] Testing network using net.request() for https://teams.microsoft.com
[2024-09-13 13:11:35.669] [debug] Testing network using net.request() for https://teams.microsoft.com
[2024-09-13 13:11:36.671] [debug] Testing network using net.request() for https://teams.microsoft.com
[2024-09-13 13:11:37.673] [debug] Testing network using net.request() for https://teams.microsoft.com
[2024-09-13 13:11:38.675] [debug] Testing network using net.request() for https://teams.microsoft.com
[2024-09-13 13:11:39.677] [debug] Testing network using net.request() for https://teams.microsoft.com
[2024-09-13 13:11:40.679] [debug] Testing network using net.request() for https://teams.microsoft.com
[2024-09-13 13:11:41.684] [debug] Testing network using net.request() for https://teams.microsoft.com
[2024-09-13 13:11:42.686] [debug] Testing network using net.request() for https://teams.microsoft.com
[2024-09-13 13:11:43.687] [debug] Testing network using net.request() for https://teams.microsoft.com
[2024-09-13 13:11:44.689] [debug] Testing network using net.request() for https://teams.microsoft.com
[2024-09-13 13:11:45.691] [debug] Testing network using net.request() for https://teams.microsoft.com
[2024-09-13 13:11:46.694] [debug] Testing network using net.request() for https://teams.microsoft.com
[2024-09-13 13:11:47.696] [debug] Testing network using net.request() for https://teams.microsoft.com
[2024-09-13 13:11:48.698] [debug] Testing network using net.request() for https://teams.microsoft.com
[2024-09-13 13:11:49.700] [debug] Testing network using net.request() for https://teams.microsoft.com
[2024-09-13 13:11:50.702] [debug] Testing network using net.request() for https://teams.microsoft.com
[2024-09-13 13:11:51.704] [debug] Testing network using net.request() for https://teams.microsoft.com
[2024-09-13 13:11:52.706] [debug] Testing network using net.request() for https://teams.microsoft.com
[2024-09-13 13:11:53.707] [debug] Testing network using net.request() for https://teams.microsoft.com
[2024-09-13 13:11:54.709] [debug] Testing network using net.request() for https://teams.microsoft.com
[2024-09-13 13:11:55.712] [debug] Testing network using net.request() for https://teams.microsoft.com
[2024-09-13 13:11:56.713] [debug] Testing network using net.request() for https://teams.microsoft.com
[2024-09-13 13:11:57.715] [debug] Network test failed with method https
[2024-09-13 13:11:57.716] [error] No internet connection

However, https://teams.microsoft.com/ is accessible:

% wget -S -O /dev/null https://teams.microsoft.com/
--2024-09-13 13:13:28--  https://teams.microsoft.com/
Resolving teams.microsoft.com (teams.microsoft.com)... 52.123.129.14, 52.123.128.14, 2603:1063:27:2::14, ...
Connecting to teams.microsoft.com (teams.microsoft.com)|52.123.129.14|:443... connected.
HTTP request sent, awaiting response... 
  HTTP/1.1 302 Found
  Location: https://teams.microsoft.com/v2?clientexperience=t2
  strict-transport-security: max-age=2592000
  x-ring-info: web: general [assigned], mt: general [assigned]
  requestid: 5921fd3a87b24f8e5df006236449e784
  x-content-type-options: nosniff
  timing-allow-origin: *
  x-xss-protection: 1; mode=block
  x-frame-options: SAMEORIGIN
  x-envoy-upstream-service-time: 11
  x-request-id: 7346a823-27d8-44d1-b71b-0e8e66888667
  X-Cache: CONFIG_NOCACHE
  X-MSEdge-Ref: Ref A: E3FDC45C92C84DED8EB48D4721F89D52 Ref B: BUD01EDGE0322 Ref C: 2024-09-13T11:13:25Z
  Set-Cookie: MUIDB=1B810E3C170C6F5E3ABD1AC5161C6E0C; path=/; httponly; secure; expires=Wed, 08-Oct-2025 11:13:25 GMT
  Date: Fri, 13 Sep 2024 11:13:25 GMT
  Content-Length: 0
Location: https://teams.microsoft.com/v2?clientexperience=t2 [following]
--2024-09-13 13:13:28--  https://teams.microsoft.com/v2?clientexperience=t2
Reusing existing connection to teams.microsoft.com:443.
HTTP request sent, awaiting response... 
  HTTP/1.1 301 Moved Permanently
  Location: /v2/?clientexperience=t2
  X-MSEdge-Ref: Ref A: D1693075A8A844599BE6FB7C1BE36F40 Ref B: BUD01EDGE0322 Ref C: 2024-09-13T11:13:25Z
  Date: Fri, 13 Sep 2024 11:13:25 GMT
  Content-Length: 0
Location: /v2/?clientexperience=t2 [following]
--2024-09-13 13:13:28--  https://teams.microsoft.com/v2/?clientexperience=t2
Reusing existing connection to teams.microsoft.com:443.
HTTP request sent, awaiting response... 
  HTTP/1.1 302 Found
  Location: /v2/unsupported-browser#env=work
  strict-transport-security: max-age=2592000
  x-ring-info: web: general [assigned];
  requestid: 75fc3382583135a6fc49ba4fdecd0bca
  x-content-type-options: nosniff
  timing-allow-origin: *
  x-xss-protection: 1; mode=block
  x-frame-options: SAMEORIGIN
  x-envoy-upstream-service-time: 1
  x-request-id: 03e37a48-735c-4caf-a5ba-6903038cd338
  X-Cache: CONFIG_NOCACHE
  X-MSEdge-Ref: Ref A: A7BBF6B8AD4744CAB646732DA93E052F Ref B: BUD01EDGE0322 Ref C: 2024-09-13T11:13:25Z
  Date: Fri, 13 Sep 2024 11:13:25 GMT
  Content-Length: 0
Location: /v2/unsupported-browser#env=work [following]
--2024-09-13 13:13:28--  https://teams.microsoft.com/v2/unsupported-browser
Reusing existing connection to teams.microsoft.com:443.
HTTP request sent, awaiting response... 
  HTTP/1.1 200 OK
  Cache-Control: no-store, no-transform, must-revalidate, no-cache
  Content-Length: 182166
  Content-Type: text/html; charset=utf-8
  Expires: Thu, 12 Sep 2024 11:13:25 GMT
  Vary: Accept-Encoding
  Set-Cookie: clocale=en-us; expires=Sat, 13 Sep 2025 11:13:25 GMT; path=/;Partitioned; secure; httponly
  strict-transport-security: max-age=2592000
  x-ring-info: web: general [assigned];
  content-security-policy: base-uri 'none';default-src 'none';script-src 'nonce-rAm5sV1wTfE9KbRBnYjHnA==' 'unsafe-inline' 'report-sample';style-src 'nonce-rAm5sV1wTfE9KbRBnYjHnA==' 'unsafe-inline' 'report-sample';style-src-attr 'unsafe-inline' 'report-sample';img-src https://statics.teams.cdn.office.net;form-action 'none';frame-ancestors 'none';object-src 'none';upgrade-insecure-requests;require-trusted-types-for 'script';trusted-types 'none';report-uri https://csp.microsoft.com/report/teams-web-r4?v=24080212011&env=prod&exp=react-web-client&endpoint=unsupported-browser;
  requestid: f0191791bbdf86df3df971d82ff72520
  x-content-type-options: nosniff
  timing-allow-origin: *
  x-xss-protection: 1; mode=block
  x-envoy-upstream-service-time: 2
  x-request-id: ed3b2e2e-2333-4b4b-9099-adba054dacc4
  X-Cache: CONFIG_NOCACHE
  X-MSEdge-Ref: Ref A: 796C28337C0247A2B82EEBC19FF9AF56 Ref B: BUD01EDGE0322 Ref C: 2024-09-13T11:13:25Z
  Date: Fri, 13 Sep 2024 11:13:25 GMT
Length: 182166 (178K) [text/html]
Saving to: ‘/dev/null’

/dev/null                                                                                  100%[=======================================================================================================================================================================================================================================>] 177.90K  --.-KB/s    in 0.04s   

2024-09-13 13:13:28 (3.92 MB/s) - ‘/dev/null’ saved [182166/182166]

Additional context

Up to about a week ago I had no problem.

Teams still works from Ferdium on the same computer, in the same network.

IsmaelMartinez commented 1 month ago

I suspect this is related to your network configuration. Can you check the onlineCheckMethodType config option?

Default is https, but you can try with dns, native or none

akorn commented 1 month ago

Yes, it indeed works when I set that to dns. Too bad it doesn't tell me what's wrong with the https check.

IsmaelMartinez commented 1 month ago

We can maybe try to be much cleaver and try another methods maybe after 5 tries (or something). Maybe a feature we can add

On Fri, 13 Sept 2024, 19:43 Dr. András Korn, @.***> wrote:

Yes, it indeed works when I set that to dns. Too bad it doesn't tell me what's wrong with the https check.

— Reply to this email directly, view it on GitHub https://github.com/IsmaelMartinez/teams-for-linux/issues/1405#issuecomment-2349859853, or unsubscribe https://github.com/notifications/unsubscribe-auth/AADJHECZ23XF7NSDAOJLLETZWMW35AVCNFSM6AAAAABOFE6TWSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGNBZHA2TSOBVGM . You are receiving this because you commented.Message ID: @.***>

akorn commented 1 month ago

I'm not sure I understand what the purpose of the online check is. Why can't you just try to access the Teams service, and print a meaningful error message when that fails? Any synthetic check is going to have false negatives (as seen here) as well as false positives -- where the check succeeds, but the service doesn't work, so you have to deal with that anyway.

IsmaelMartinez commented 1 month ago

it is a bit complicated but we need to ensure we are online for some features. We handle the auto refresh in some cases, when jumping from network to network, and we need to wait to be online to load parts of the pre-load script.

For example, if we don't handle the check of the network connection with the refresh (or even initial load) you end up with white screens (specially when the connection is a bit choppy).

As I say, we might be able to be a bit more cleaver on that connection test. Like check n times per type, but maybe changing the final message to indicate that config option is available is good enough. Unfortunately there isn't an easy way to check what type of check we need to perform (as far as I know) otherwise we could do that.

akorn commented 1 month ago

I'm probably being naïve. :) Still, in my fantasy world a network request either succeeds within a timeout, or not. If it doesn't, then we're "not online", but can retry with some back-off (up to some maximum time between retries).

I don't see why/how successful requests can lead to white screens, and why they can't just be retried if they aren't successful.

I'm not trying to argue, I'll take your word for it, it just seems counter-intuitive.

The way I would approach this (again, probably naïvely) would be to have heuristic acceptance criteria for network requests; e.g. https://teams.microsoft.com/ should redirect at least once, the final content-type should be such-and-such and the file size should be at least X kB. If the actual result doesn't match, try to use it regardless but log a warning and retry with back-off.

Then again, you're building on Electron, so maybe this isn't a viable approach anyway, in which case sorry about the noise.

IsmaelMartinez commented 1 month ago

no worries and thanks for the suggestions, they are always welcome.

I was more thinking that the backoff logic just tries another network request. It is a pain that electron don't have a 'isOnline' method that does that for us. But I might add something to this retries as it keeps popping up every now and then.

I was thinking something simpler like checking 1st with https (as it seems to work most times), then dns (my repeater needs that for example) and then native. And just go around them 5 times. If that doesnt' work, then fail and put a log message

IsmaelMartinez commented 1 month ago

this network issue is related to https://github.com/IsmaelMartinez/teams-for-linux/issues/1381 (both are the same issue, I think)

IsmaelMartinez commented 1 month ago

Can you check https://github.com/IsmaelMartinez/teams-for-linux/releases/tag/v1.11.1 and see if this solves your issue? Now it goes around https (10 times), dns (10 times), electron (5 times, as it is extremely optimistic) and finally just assumes you are online.

I might need to tweak timings and others but I think is simpler and can support better when changing from networks. Thanks!

IsmaelMartinez commented 3 weeks ago

closing as 1381 was fixed by the mentioned fixes. Do reach out if this isn't working for you and I can reopen