clients icon indicating copy to clipboard operation
clients copied to clipboard

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

Open setyb opened this issue 4 years ago • 10 comments

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 avatar Apr 16 '20 03:04 setyb

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.

setyb avatar Apr 16 '20 03:04 setyb

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.

hlieberman avatar Sep 29 '20 22:09 hlieberman

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

irvinm avatar Oct 31 '20 14:10 irvinm

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

davidkassa avatar Dec 09 '20 15:12 davidkassa

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.

Jerriy avatar Apr 17 '21 09:04 Jerriy

@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.

setyb avatar Apr 25 '21 02:04 setyb

@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.

QtFuta avatar Jan 07 '22 04:01 QtFuta

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

image

Naxterra avatar Jan 07 '22 16:01 Naxterra

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.

jdharms avatar Sep 12 '22 17:09 jdharms

@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/

eliykat avatar Sep 13 '22 00:09 eliykat

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

koesper avatar Apr 15 '24 08:04 koesper

@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

qinxs avatar Apr 17 '24 01:04 qinxs

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.

eliykat avatar Apr 17 '24 04:04 eliykat