brave / brave-browser

Brave browser for Android, iOS, Linux, macOS, Windows.
https://brave.com
Mozilla Public License 2.0
17.52k stars 2.27k forks source link

Single websocket won't connect using brave. Works for all other browsers. #23762

Open Rambatino opened 2 years ago

Rambatino commented 2 years ago

Similar issue here: https://github.com/brave/brave-browser/issues/22851

But apparently fixed.

Description

After multiple refreshes of our app: https://endx.gg, the websockets stop connecting.

Chrome works as expected, as does wscat.

E.g. wscat -c "wss://auth.endx.gg/api/prices"

Steps to Reproduce

  1. Head to endx.gg
  2. Sign in with test@test.com
  3. Password: Testing1!
  4. Shields can be up or down
  5. Refresh the browser multiple times (keep refreshing until it happens)
  6. Websockets stop connecting

Actual result:

image

Expected result:

On chrome:

image

Reproduces how often:

All the time.

Brave version (brave://version info)

Version 1.40.107 Chromium: 103.0.5060.53 (Official Build) (arm64)


Brave | 1.40.107 Chromium: 103.0.5060.53 (Official Build) (arm64)
-- | --
Revision | a1711811edd74ff1cf2150f36ffa3b0dae40b17f-refs/branch-heads/5060@{#853}
OS | macOS Version 12.4 (Build 21F79)
JavaScript | V8 10.3.174.14
User agent | Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/103.0.5060.53 Safari/537.36
Command Line | /Applications/Brave Browser.app/Contents/MacOS/Brave Browser --disable-client-side-phishing-detection --disable-domain-reliability --enable-dom-distiller --no-pings --component-updater=url-source=https://go-updater.brave.com/extensions --origin-trial-public-key=bYUKPJoPnCxeNvu72j4EmPuK7tr1PAC7SHh8ld9Mw3E=,fMS4mpO6buLQ/QMd+zJmxzty/VQ6B1EUZqoCU04zoRU= --sync-url=https://sync-v2.brave.com/v2 --lso-url=https://no-thanks.invalid --variations-server-url=https://variations.brave.com/seed --variations-insecure-server-url=https://variations.brave.com/seed --flag-switches-begin --flag-switches-end
Executable Path | /Applications/Brave Browser.app/Contents/MacOS/Brave Browser
Profile Path | /Users/mark/Library/Application Support/BraveSoftware/Brave-Browser/Profile 1
Linker | lld
Active variations | AdRewardsStudy:NextPaymentDayAdServingStudy:DefaultAdNotificationsPerHour=10/MaximumAdNotificationsPerDay=100/MaximumInlineContentAdsPerHour=12/MaximumInlineContentAdsPerDay=60BraveAds.EpsilonGreedyBanditStudy:ControlBraveAds.FrequencyCappingStudy:ExcludeAdIfWithinTimeWindow=0hBraveAds.UserActivityStudy:Triggers=EMPTY/Threshold=0.0/IdleTimeThreshold=5BraveDebounceStudy:EnabledConversionsStudy:NewDefaultPatternDefault1pBlockingStudy:DisabledDisableReduceLanguage:DefaultEphemeralStorageStudy:EnabledExtendedVariationsSafeMode5:SignalAndWriteViaFileUtil5FirstPartyEphemeralDomainBlockStudy:EnabledForceDisableBlinkFeatures:EnabledMacCoreLocationBackendStudy:EnabledNativeCosmeticFilteringStudy:EnabledPartitionBlinkMemoryCacheStudy:EnabledPartitionConnectionsByNetworkIsolationKeyStudy:EnabledPermissionLifetimeReleaseStudy:EnabledRequestAdsEnabledApiStudy:EnabledSpeedreaderReleaseStudy:Enabled

Version/Channel Information:

Other Additional Information:

Miscellaneous Information:

rebron commented 2 years ago

cc: @ryanbr

ryanbr commented 2 years ago

Testing in Brave 1.41.96.

I refreshed the page a few times (10 so far), takes a few seconds between a refresh and the page loading. Nothing so far @Rambatino Can you re-test in the latest ver?

Rambatino commented 2 years ago

Hi @ryanbr thanks for getting back to me. Just tried it on the new version and it's still an issue.

I've been using cmd+shift+r and if it still works, then I press it multiple times in a row before the page has reloaded and then the socket stops connecting.

Would you mind having another go please? 🙏

(you will need to be logged in to access the websocket)

Rambatino commented 2 years ago

For context, this is the issue:

image

mmRoshani commented 2 years ago

I have the same issue. I am working on the backend based on Nest.js. I have WebSocket that all other browsers will work fine but the brave browser was working fine after a while it won't receive messages from a WebSocket. note that my operating system is Windows 10 in case you want to change the issue tag.

moraisaugusto commented 2 years ago

same here and tested on Linux. [Version 1.42.86 Chromium: 104.0.5112.81 (Official Build) (64-bit)]

vicenterusso commented 1 year ago

Problems with websockets too. Can't connect.. but it works with chrome and firefox. Linux OS

[Version 1.42.97 Chromium: 104.0.5112.102 (Official Build) (64-bit]

marsrobertson commented 1 year ago

Same here.

Need to disable Trackers & ads blocking:

image

I am a little bit disappointed

(EDIT: I calibrated my language to not appear pretentious)

There should be some flag "allow dev mode" to connect to localhost.

(apparently someone in the past abused it to fingerprint / track users)

I've heard about Brave since 2017 and BAT, and here we are in 2023, in the meanwhile tried many times to switch and each time I found some "non starter" issue in the first 5-10 minutes of usage.

Related: https://github.com/danhper/atomic-chrome/issues/36

kokofixcomputers commented 1 year ago

I also have this issue. On brave version: 1.49.128 Chromium: 111.0.5563.110 (Official Build)

ShivanKaul commented 1 year ago

I'm unable to repro the issue on https://csgo.endx.gg/dashboard after logging in using the test creds provided. I hard refreshed several times, and didn't get the broken page. Is this still an issue?

Rambatino commented 1 year ago

@ShivanKaul we switched to ably to manage our sockets instead which is a single socket.

jzatarain commented 1 year ago

I have the same issue.

I have an external app that hosts ws endpoints, and when I try to connect, I get: "webSocket connection to 'wss://{url}' failed:"

After disabling the option for "disable Trackers & ads blocking", everything works.

ShivanKaul commented 1 year ago

Can you say which external app it is?

jzatarain commented 1 year ago

Unfortunately, It's not a public app, but I can tell you that it is an app written in asp .net 6 that just maps a middleware for websockets.

jondubois commented 6 months ago

I also have an issue with WebSockets being blocked during the handshake. I can see the connection hitting my server but it doesn't complete it, it stays stuck in pending status for a while and then I eventually get:

WebSocket connection to 'wss://example.com/socket/' failed: WebSocket is closed before the connection is established.

I'm using nginx to proxy websockets on the back end though I doubt that's the problem. I tried restarting it and also my WebSocket server and the issue persisted. It works fine in all other browsers. I opened a new incognito tab with Brave and it also worked... Then I go back to a regular Brave tab and it doesn't work. I tried disabling the shields, this seems to have fixed it in the past, but not anymore.

One weird thing I noticed is that, when I look at the WebSocket messages, under the Timing tab, it says Stalled 7.6 days... I only just opened the connection so I don't see how it could have taken 7.6 days... Could it be some issue with old sockets from several days ago which did not get cleaned up? The issue persists even when I open new (non-icognito) tabs within the same Browser window.

I'm using Linux (Kubuntu). I noticed that if I close the browser, open it again and try again, it starts working again! Will be fine for several days or weeks. This seems to support the theory of it being related to old socket data not getting cleaned up properly.