Chrome Extension MV3 Service Worker sporadically does not show

292 views
Skip to first unread message

Michael Wanke

unread,
Nov 12, 2024, 6:16:48 AMNov 12
to Chromium Extensions
Hello,

For years, we had a MV2 extension and know it is past time to transition to MV3. We ran our MV3 extension for a year in a select deployment before rolling it out to broadly to try to avoid any issues and impact to our healthcare customers, but we are experiencing some significant challenges.

Problem
On Citrix in a new session, our extension will successfully install and show in chrome://serviceworker-internals 22 times in a row. Then, the next session the extension will show in the force installed extension list, but it won't work. When this occurs, our service worker will not show in chrome://serviceworker-internals. Occasionally (a subset of the sporadic times, the service worker will appear a couple minutes later. Most often when this happens, it seems to never show up.

We are already following the wrapper/try...catch approach to load our service worker:

ourExtensionWrapper.js:

try {

    importScripts("myServiceWorker.js");

} catch (err) {

    console.error(err);

}

Out of desperation, we even modified the above and added retry logic here with a delay to no effect. Getting Chrome.exe debug logs are incredibly challenging but have been requested again.

Any ideas on what we should look/try? 

Mitigations we have tried:

  1. Leverage wrapper approach with try/catch around service worker code
  2. In the wrapper, retry importing the service worker code
  3. Using alarms to try to keep the service worker running. We don't have any technical reason we need this but did it anyway. When the above circus
  4. For content.js - we are subscribing to chrome.runtime.onInstalled, chrome.runtime.onStartup, chrome.management.onDisabled, chrome.management.onEnabled to reinject our content.js to prevent invalid extension context within our background service worker code (not the wrapper). 

I saw https://issues.chromium.org/issues/336832598?pli=1 which seems possibly related, and https://groups.google.com/a/chromium.org/g/chromium-extensions/c/Tv0Q8rtDohg, but my posts to that thread were never approved by a moderator.

Thanks,
Michael

Oliver Dunk

unread,
Nov 14, 2024, 9:27:12 AMNov 14
to Michael Wanke, Chromium Extensions
Hi Michael,

Thanks so much for sharing this. All of your posts should be approved now and any future ones should go live immediately. We don't want this to be a heavily moderated forum and generally accept whatever comes in - but we had to introduce the queue since we saw an increase in spam that was impacting everyone who is subscribed to the posts here.

The behavior you're describing sounds wrong for sure, and as you mentioned there have been a couple of other reports of interesting behavior in Citrix environments. I can't speak to specific workarounds because it's not an environment I'm familiar with, but none of them should be necessary. It seems like it would be worthwhile investing some time on our side to see if we can reproduce what is described.

I'm going to chat to the engineering team today to see if they have any thoughts here and I'll let you know when I hear back. I appreciate your patience.

Thanks,
Oliver Dunk | DevRel, Chrome Extensions | https://developer.chrome.com/ | London, GB


--
You received this message because you are subscribed to the Google Groups "Chromium Extensions" group.
To unsubscribe from this group and stop receiving emails from it, send an email to chromium-extens...@chromium.org.
To view this discussion visit https://groups.google.com/a/chromium.org/d/msgid/chromium-extensions/ab2782b7-d24f-4978-bd1f-bf15b53d6958n%40chromium.org.

Michael Wanke

unread,
Nov 14, 2024, 10:36:36 AMNov 14
to Oliver Dunk, Chromium Extensions
Thanks Oliver. We really appreciate it. 

I'm happy to provide anything and everything that would help.

Michael

From: Oliver Dunk <olive...@google.com>
Sent: Thursday, November 14, 2024 6:26:35 AM
To: Michael Wanke <Michae...@forwardadvantage.com>
Cc: Chromium Extensions <chromium-...@chromium.org>
Subject: Re: [crx] Chrome Extension MV3 Service Worker sporadically does not show
 

Michael Wanke

unread,
Nov 14, 2024, 10:44:10 AMNov 14
to Oliver Dunk, Chromium Extensions
I am looking over a log and the sporadic failure seems to have a "not found" error on the log:
[7792:18548:1113/134754.740:ERROR:service_worker_task_queue.cc(196)] DidStartWorkerFail cbcjdhblcnboaegpdapojngjkckbklim: 5

It can work repeatedly on the same host, and then the above. We're just struggling to figure out the cause or how to avoid it. 

I learned this morning from our support team that if the customer removes another extension (that was also pushed by GPO), our extension seems to load successfully every time.

Michael


From: Michael Wanke <Michae...@forwardadvantage.com>
Sent: Thursday, November 14, 2024 7:35:59 AM
To: Oliver Dunk <olive...@google.com>

Oliver Dunk

unread,
Nov 14, 2024, 10:56:44 AMNov 14
to Michael Wanke, Chromium Extensions
[7792:18548:1113/134754.740:ERROR:service_worker_task_queue.cc(196)] DidStartWorkerFail cbcjdhblcnboaegpdapojngjkckbklim: 5

At least in some cases, my understanding is that this error is expected. It's worth posting on the bug though in case it's helpful to the team.

I learned this morning from our support team that if the customer removes another extension (that was also pushed by GPO), our extension seems to load successfully every time.

This is really interesting! Are you able to share what extension this was by any chance? 
Oliver Dunk | DevRel, Chrome Extensions | https://developer.chrome.com/ | London, GB

Michael Wanke

unread,
Nov 14, 2024, 1:42:32 PMNov 14
to Chromium Extensions, Oliver Dunk, Chromium Extensions, Michael Wanke
Hi Oliver,

The extension being disabled is bpgncafocbpieaeigfcookhgmeamglgo. It seems like the "success" of disabling this extension must be a misnomer, something we're doing wrong, or a complication of our particular deployments. To elaborate: both this extension and our extension are interacting with the same Electronic Healthcare Record system's web page and leverage native messaging, pushed through GPO, in Citrix, etc. We are also partners with the author of that extension and I have reached out to see review for any additional insights.

Michael


Michael Wanke

unread,
Nov 15, 2024, 10:16:53 PMNov 15
to Chromium Extensions, Michael Wanke, Oliver Dunk, Chromium Extensions
We continue to troubleshoot and have narrowed the situation down to Chrome with Citrix non-persistent environments. Toggling the extension off and back on again gets it working again. 

Any other environment we think we can ultimately get working normally (instance clones, thick clients, desktops, etc.).

We're currently evaluating our options, including going back to MV2 and having customers add the enterprise policy to allow it.

Oliver - did you get any feedback from the engineering team?

Michael

Oliver Dunk

unread,
Nov 18, 2024, 10:56:30 AM (14 days ago) Nov 18
to Michael Wanke, Chromium Extensions
No feedback yet - I raised the issue though and there was agreement that this is worth looking at.
Oliver Dunk | DevRel, Chrome Extensions | https://developer.chrome.com/ | London, GB

Michael Wanke

unread,
Nov 18, 2024, 3:11:32 PM (14 days ago) Nov 18
to Chromium Extensions, Oliver Dunk, Chromium Extensions, Michael Wanke
Thanks Oliver. I went ahead and added more notes to https://issues.chromium.org/issues/336832598 and a log I received. We can get more logs with some notice. We're also seeing similarity with bug https://issues.chromium.org/issues/40935316 so I copied a comment there too just in case.

Michael

Michael Wanke

unread,
Nov 20, 2024, 3:51:10 PM (12 days ago) Nov 20
to Chromium Extensions, Michael Wanke, Oliver Dunk, Chromium Extensions
An update if helpful: We're hearing consistently that customers are deleting the userData folder as a workaround.

Michael Wanke

unread,
Nov 22, 2024, 1:50:30 PM (10 days ago) Nov 22
to Chromium Extensions, Michael Wanke, Oliver Dunk, Chromium Extensions
Oliver - I saw a comment on one of the bugs that one challenge for the Google team is they don't have a Citrix environment. Our team has invested the time the create a Citrix XenApp test environment and can readily reproduce the issue. We are on a trial and have limited time. How do we help the Google Engineers look this over / leverage our environment?

Michael
Reply all
Reply to author
Forward
0 new messages