bitwarden / clients

Bitwarden client apps (web, browser extension, desktop, and cli).
https://bitwarden.com
Other
9.04k stars 1.19k forks source link

Does not internally handle lack of connection gracefully - Error: Could not establish connection. Receiving end does not exist. #1208

Open setyb opened 4 years ago

setyb commented 4 years ago

If the Bitwarden extension cannot reach its servers when launching Firefox, internally it does not handle this issue gracefully. Externally, I don't see an issue.

Here is the error displayed in the developer tools. You may need to create a remote connection to the browser to see all the details (go to Settings within Firefox's developer tools, and select the last 2 checkboxes in the lower-right corner, then create a separate remote developer tools session).

Unchecked lastError value: Error: Could not establish connection. Receiving end does not exist. background.js:1504
    send moz-extension://[UUID]/background.js:1504

I recommend implementing a handler for this case.

setyb commented 4 years ago

Besides network issues, it's possible that Bitwarden also will not be able to access the network when Firefox loads if suspendTabsUntilReady is set to yes in the Advanced Settings in the uBlock Origin web extension.

hlieberman commented 3 years ago

This can happen even if the vault has not been logged into in a particular session, when there's not even a mechanism to communicate with the Bitwarden server.

This causes Bitwarden to chew a fairly significant amount of CPU in the background, even when doing nothing.

irvinm commented 3 years ago

Using Bitwarden 1.46.2, it looks like in about 10 minutes, I got about 80 of these messages in my console.

Line 1890 is: chrome.runtime.sendMessage(message);

In my light research into this message, it appears one way to address it is to convert to using browser.runtime.sendMessage and to catch any errors and to either eat them or take action on them.

2020-10-31_10-42-47

davidkassa commented 3 years ago

I am also getting many of these in Version: 1.47.1. Performance impact doesn't seem high on my system, though.

Jerriy commented 3 years ago

Bump.

I am having tis problem too and no solution is provided here.

So 1) what is it? and 2) how do I stop it?

The addon tries to connect to the internet or does whatever it does on my computer every single time I open any tab or do any refresh. It doesn't even have to be a website. Every time I go to the browser option tab or any other internal browser info or setting tab, Bitwarden tries something and fails, resulting in the "Unchecked..." error message shown above. It also doesn't matter if Bitwarden/the vault is logged in or not. The mysterious background action takes place and the error shows up.

setyb commented 3 years ago

@Jerriy Yes, it's now been over a year since I posted this issue, and we still haven't received any response from anyone actively working on the responsible code (or anyone at all from Bitwarden, Inc.). The lack of communication and response is concerning, especially for a project like Bitwarden.

QtFuta commented 2 years ago

@eliykat you closed the duplicates on this topic, can we then expect this to be worked on soon?
Seems like fixes have been already proposed by different users on those tickets.

As far as I can see the background script isn't properly checking when it can't reach any content script.
The issue comes form here https://github.com/bitwarden/browser/blob/8ffe2c2dcabfb358322ff030c381db6d6a61386c/src/services/browserMessaging.service.ts#L6

I only tested this in a mock project but, since the promise isn't being used at all, it only needs this to be attached .catch(() => {})

EDIT: This error seems to be printed 8 times each time a tab is updated.

Naxterra commented 2 years ago

It is happening on FF 95.0.2 too and Biometric login not working.

image

jdharms commented 2 years ago

I'm also seeing this and as a result the Firefox Task Manager reports that the Bitwarden extension is constantly the top entry when sorted by Energy Impact. Kind of disappointing this hasn't been fixed in over 2 years. Is there a documented preferred approach somewhere? I could attempt a pull request.

eliykat commented 2 years ago

@jdharms a pull request is welcome. My suggested solution is to log (catch + rethrow?) the error the first few times it occurs. After (for example) 5 occurrences, warn the user that further repeated errors will be suppressed, and silently swallow them from that point onwards.

Alternative solutions are welcome though.

General instructions for local development setup are here: https://contributing.bitwarden.com/

koesper commented 5 months ago

Just a bump, since this is still happening (In my case: Chrome-dev: v2024.2.1 on Mac Sonoma 14.4.1)

qinxs commented 5 months ago

@eliykat Can we solve this problem as soon as possible? The solution is readily available on Stackoverflow.

how-to-fix-unchecked-runtime-lasterror-could-not-establish-connection

eliykat commented 5 months ago

Hi @qinxs, I'll bump our internal tracking of this issue for visibility, however it's not currently prioritised for work. PRs are welcome though, please see my previous comment.

ltpquang commented 1 week ago

The chrome ext of mine got the same error, reinstalling it fixed for me.

Mazvy commented 4 days ago

@eliykat This problem still persists, however it's intermittent in that after restarting Firefox many times, occasionally the extension will start working without errors.

Autofill and icons next to input fields do not work on all websites when this error happens. I'm forced to keep restarting Firefox and hope it'll magically start working.

My two cents is that this is not just an inconvenience, but one of the reasons password managers are so useful for preventing phishing attacks - autofill/suggestions on input fields.

Screenshot 2024-09-18 134723

Also this error is present when inspecting the extension

image

eliykat commented 3 days ago

I'm not sure I was aware that it was affecting autofill. @cagonzalezcs could you please take a look at the last comment? Thank you.

cagonzalezcs commented 3 days ago

@eliykat Autofill's issues are more than likely related to the symptoms reported in this thread - https://github.com/bitwarden/clients/issues/10814

This comment gives an explanation as to why autofill is likely encountering problems