Closed Bug 1394429 Opened 4 years ago Closed 4 years ago

notification opens perpetually loading empty tab

Categories

(Core :: DOM: Service Workers, defect, P1)

defect

Tracking

()

RESOLVED FIXED
Tracking Status
firefox56 --- fixed
firefox57 --- fixed

People

(Reporter: asa, Assigned: asuth)

References

Details

I was prompted to enable Facebook notifications a few days ago. I get regular notifications of updates at FB but clicking the notification leads to an empty tab that never finishes loading. 

The browser console messages I saw was: Terminating ServiceWorker for scope ‘https://www.facebook.com/’ with pending waitUntil/respondWith promises because of grace timeout.
This could have something to do with openWindow so moving to the Service Workers component.

Have you seen this, Ben or Catalin? Is there something Asa can do to help diagnose?

Asa, I'm assuming Nightly on Windows, right?
Component: DOM: Push Notifications → DOM: Service Workers
Flags: needinfo?(catalin.badea392)
Flags: needinfo?(bkelly)
Flags: needinfo?(asa)
Priority: -- → P1
(In reply to Andrew Overholt [:overholt] from comment #1)
> Asa, I'm assuming Nightly on Windows, right?

Yes, up to date nightly builds on Windows 10. Only extension I have is the Gecko Profiler and I see the problem with and without that running.
Flags: needinfo?(asa)
Asa, are you using containers?  Facebook seems to be serving different scripts based on your cookies, etc.  I wonder if containers are messing something up.
Flags: needinfo?(bkelly) → needinfo?(asa)
(In reply to Ben Kelly [:bkelly] from comment #3)
> Asa, are you using containers?  Facebook seems to be serving different
> scripts based on your cookies, etc.  I wonder if containers are messing
> something up.

Not using Containers.
Flags: needinfo?(asa)
Can you go to about:debugging#workers, debug the service worker script, and paste it here?  You may need to opt out of multiple content processes to use the debugger.  (Note, the debugger doesn't seem to work on nightly at all here.)

For some reason they seem to be serving an html file to me for the service worker script...
I've reached out to facebook to help diagnose the problem.
(In reply to Ben Kelly [:bkelly] from comment #5)
> Can you go to about:debugging#workers, debug the service worker script, and
> paste it here?  You may need to opt out of multiple content processes to use
> the debugger.  (Note, the debugger doesn't seem to work on nightly at all
> here.)

I'm going to need more explicit instructions. I've never used the debugger and don't know how.
(In reply to Asa Dotzler [:asa] from comment #7)
> I'm going to need more explicit instructions. I've never used the debugger
> and don't know how.

Its ok.  I think I can see the script now, but I don't understand how they are loading it.  Probably need to wait for them to get in touch.
Flags: needinfo?(catalin.badea392)
I created a new profile to see if there was something wrong with my old profile and I'm still seeing the problem.  When I click the notification it opens a new tab (even if I already have FB open) and that tab never loads. I see this error in the console: Service worker event waitUntil() was passed a promise that rejected with '[Object]'.  sHYhFyuCcNo.js:108:1432
Duplicate of this bug: 1392032
Bug 1392032 looks similar, but its on twitch instead of FB.
Asa, can you post your about:support here?  Also, any chance you could try reproducing with your account in a DEBUG build?
Flags: needinfo?(asa)
I'm happy to try with a debug build. I'll need instructions though. Here's my about:support

Application Basics
------------------

Name: Firefox
Version: 57.0a1
Build ID: 20170828100127
Update Channel: nightly
User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:57.0) Gecko/20100101 Firefox/57.0
OS: Windows_NT 10.0
Multiprocess Windows: 1/1 (Enabled by default)
Web Content Processes: 5/4
Stylo: true (enabled by default)
Google Key: Found
Mozilla Location Service Key: Found
Safe Mode: false

Crash Reports for the Last 3 Days
---------------------------------

All Crash Reports

Nightly Features
----------------

Name: Activity Stream
Version: 0.0.0
ID: activity-stream@mozilla.org

Name: Application Update Service Helper
Version: 2.0
ID: aushelper@mozilla.org

Name: Click-to-Play staged rollout
Version: 1.2
ID: clicktoplay-rollout@mozilla.org

Name: Firefox Screenshots
Version: 10.12.0
ID: screenshots@mozilla.org

Name: FlyWeb
Version: 1.0.0
ID: flyweb@mozilla.org

Name: Follow-on Search Telemetry
Version: 0.9.3
ID: followonsearch@mozilla.com

Name: Form Autofill
Version: 1.0
ID: formautofill@mozilla.org

Name: Multi-process staged rollout
Version: 2.15
ID: e10srollout@mozilla.org

Name: Photon onboarding
Version: 0.1
ID: onboarding@mozilla.org

Name: Pocket
Version: 1.0.5
ID: firefox@getpocket.com

Name: Presentation
Version: 1.0.0
ID: presentation@mozilla.org

Name: Shield Recipe Client
Version: 65
ID: shield-recipe-client@mozilla.org

Name: Web Compat
Version: 1.1
ID: webcompat@mozilla.org

Name: WebCompat Reporter
Version: 1.0.0
ID: webcompat-reporter@mozilla.org

Extensions
----------

Name: Mark Selected Links As Visited
Version: 0.3
Enabled: true
ID: {ea63f547-d68a-469b-826e-eac58d64a641}

Graphics
--------

Features
Compositing: Direct3D 11 (Advanced Layers)
Asynchronous Pan/Zoom: wheel input enabled; touch input enabled; scrollbar drag enabled; keyboard enabled
WebGL 1 Driver WSI Info: EGL_VENDOR: Google Inc. (adapter LUID: 000000000000a0d6) EGL_VERSION: 1.4 (ANGLE 2.1.0.dec065540d5f) EGL_EXTENSIONS: EGL_EXT_create_context_robustness EGL_ANGLE_d3d_share_handle_client_buffer EGL_ANGLE_d3d_texture_client_buffer EGL_ANGLE_surface_d3d_texture_2d_share_handle EGL_ANGLE_query_surface_pointer EGL_ANGLE_window_fixed_size EGL_ANGLE_keyed_mutex EGL_ANGLE_surface_orientation EGL_ANGLE_direct_composition EGL_NV_post_sub_buffer EGL_KHR_create_context EGL_EXT_device_query EGL_KHR_image EGL_KHR_image_base EGL_KHR_gl_texture_2D_image EGL_KHR_gl_texture_cubemap_image EGL_KHR_gl_renderbuffer_image EGL_KHR_get_all_proc_addresses EGL_KHR_stream EGL_KHR_stream_consumer_gltexture EGL_NV_stream_consumer_gltexture_yuv EGL_ANGLE_flexible_surface_compatibility EGL_ANGLE_stream_producer_d3d_texture_nv12 EGL_ANGLE_create_context_webgl_compatibility EGL_CHROMIUM_create_context_bind_generates_resource EGL_EXTENSIONS(nullptr): EGL_EXT_client_extensions EGL_EXT_platform_base EGL_EXT_platform_device EGL_ANGLE_platform_angle EGL_ANGLE_platform_angle_d3d EGL_ANGLE_device_creation EGL_ANGLE_device_creation_d3d11 EGL_ANGLE_experimental_present_path EGL_KHR_client_get_all_proc_addresses
WebGL 1 Driver Renderer: Google Inc. -- ANGLE (Intel(R) HD Graphics 520 Direct3D11 vs_5_0 ps_5_0)
WebGL 1 Driver Version: OpenGL ES 2.0 (ANGLE 2.1.0.dec065540d5f)
WebGL 1 Driver Extensions: GL_ANGLE_depth_texture GL_ANGLE_framebuffer_blit GL_ANGLE_framebuffer_multisample GL_ANGLE_instanced_arrays GL_ANGLE_lossy_etc_decode GL_ANGLE_pack_reverse_row_order GL_ANGLE_request_extension GL_ANGLE_robust_client_memory GL_ANGLE_texture_compression_dxt3 GL_ANGLE_texture_compression_dxt5 GL_ANGLE_texture_usage GL_ANGLE_translated_shader_source GL_CHROMIUM_bind_generates_resource GL_CHROMIUM_bind_uniform_location GL_CHROMIUM_copy_compressed_texture GL_CHROMIUM_copy_texture GL_CHROMIUM_sync_query GL_EXT_blend_minmax GL_EXT_color_buffer_half_float GL_EXT_debug_marker GL_EXT_discard_framebuffer GL_EXT_disjoint_timer_query GL_EXT_draw_buffers GL_EXT_frag_depth GL_EXT_map_buffer_range GL_EXT_occlusion_query_boolean GL_EXT_read_format_bgra GL_EXT_robustness GL_EXT_sRGB GL_EXT_shader_texture_lod GL_EXT_texture_compression_dxt1 GL_EXT_texture_filter_anisotropic GL_EXT_texture_format_BGRA8888 GL_EXT_texture_rg GL_EXT_texture_storage GL_EXT_unpack_subimage GL_KHR_debug GL_NV_EGL_stream_consumer_external GL_NV_fence GL_NV_pack_subimage GL_NV_pixel_buffer_object GL_OES_EGL_image GL_OES_EGL_image_external GL_OES_compressed_ETC1_RGB8_texture GL_OES_depth32 GL_OES_element_index_uint GL_OES_get_program_binary GL_OES_mapbuffer GL_OES_packed_depth_stencil GL_OES_rgb8_rgba8 GL_OES_standard_derivatives GL_OES_texture_float GL_OES_texture_float_linear GL_OES_texture_half_float GL_OES_texture_half_float_linear GL_OES_texture_npot GL_OES_vertex_array_object
WebGL 1 Extensions: ANGLE_instanced_arrays EXT_blend_minmax EXT_color_buffer_half_float EXT_frag_depth EXT_shader_texture_lod EXT_texture_filter_anisotropic EXT_disjoint_timer_query MOZ_debug OES_element_index_uint OES_standard_derivatives OES_texture_float OES_texture_float_linear OES_texture_half_float OES_texture_half_float_linear OES_vertex_array_object WEBGL_color_buffer_float WEBGL_compressed_texture_s3tc WEBGL_debug_renderer_info WEBGL_debug_shaders WEBGL_depth_texture WEBGL_draw_buffers WEBGL_lose_context MOZ_WEBGL_lose_context MOZ_WEBGL_compressed_texture_s3tc MOZ_WEBGL_depth_texture
WebGL 2 Driver WSI Info: EGL_VENDOR: Google Inc. (adapter LUID: 000000000000a0d6) EGL_VERSION: 1.4 (ANGLE 2.1.0.dec065540d5f) EGL_EXTENSIONS: EGL_EXT_create_context_robustness EGL_ANGLE_d3d_share_handle_client_buffer EGL_ANGLE_d3d_texture_client_buffer EGL_ANGLE_surface_d3d_texture_2d_share_handle EGL_ANGLE_query_surface_pointer EGL_ANGLE_window_fixed_size EGL_ANGLE_keyed_mutex EGL_ANGLE_surface_orientation EGL_ANGLE_direct_composition EGL_NV_post_sub_buffer EGL_KHR_create_context EGL_EXT_device_query EGL_KHR_image EGL_KHR_image_base EGL_KHR_gl_texture_2D_image EGL_KHR_gl_texture_cubemap_image EGL_KHR_gl_renderbuffer_image EGL_KHR_get_all_proc_addresses EGL_KHR_stream EGL_KHR_stream_consumer_gltexture EGL_NV_stream_consumer_gltexture_yuv EGL_ANGLE_flexible_surface_compatibility EGL_ANGLE_stream_producer_d3d_texture_nv12 EGL_ANGLE_create_context_webgl_compatibility EGL_CHROMIUM_create_context_bind_generates_resource EGL_EXTENSIONS(nullptr): EGL_EXT_client_extensions EGL_EXT_platform_base EGL_EXT_platform_device EGL_ANGLE_platform_angle EGL_ANGLE_platform_angle_d3d EGL_ANGLE_device_creation EGL_ANGLE_device_creation_d3d11 EGL_ANGLE_experimental_present_path EGL_KHR_client_get_all_proc_addresses
WebGL 2 Driver Renderer: Google Inc. -- ANGLE (Intel(R) HD Graphics 520 Direct3D11 vs_5_0 ps_5_0)
WebGL 2 Driver Version: OpenGL ES 3.0 (ANGLE 2.1.0.dec065540d5f)
WebGL 2 Driver Extensions: GL_ANGLE_depth_texture GL_ANGLE_framebuffer_blit GL_ANGLE_framebuffer_multisample GL_ANGLE_instanced_arrays GL_ANGLE_lossy_etc_decode GL_ANGLE_pack_reverse_row_order GL_ANGLE_request_extension GL_ANGLE_robust_client_memory GL_ANGLE_texture_compression_dxt3 GL_ANGLE_texture_compression_dxt5 GL_ANGLE_texture_usage GL_ANGLE_translated_shader_source GL_CHROMIUM_bind_generates_resource GL_CHROMIUM_bind_uniform_location GL_CHROMIUM_copy_compressed_texture GL_CHROMIUM_copy_texture GL_CHROMIUM_sync_query GL_EXT_blend_minmax GL_EXT_color_buffer_float GL_EXT_color_buffer_half_float GL_EXT_debug_marker GL_EXT_discard_framebuffer GL_EXT_disjoint_timer_query GL_EXT_draw_buffers GL_EXT_frag_depth GL_EXT_map_buffer_range GL_EXT_occlusion_query_boolean GL_EXT_read_format_bgra GL_EXT_robustness GL_EXT_sRGB GL_EXT_shader_texture_lod GL_EXT_texture_compression_dxt1 GL_EXT_texture_filter_anisotropic GL_EXT_texture_format_BGRA8888 GL_EXT_texture_norm16 GL_EXT_texture_rg GL_EXT_texture_storage GL_EXT_unpack_subimage GL_KHR_debug GL_NV_EGL_stream_consumer_external GL_NV_fence GL_NV_pack_subimage GL_NV_pixel_buffer_object GL_OES_EGL_image GL_OES_EGL_image_external GL_OES_EGL_image_external_essl3 GL_OES_compressed_ETC1_RGB8_texture GL_OES_depth32 GL_OES_element_index_uint GL_OES_get_program_binary GL_OES_mapbuffer GL_OES_packed_depth_stencil GL_OES_rgb8_rgba8 GL_OES_standard_derivatives GL_OES_texture_float GL_OES_texture_float_linear GL_OES_texture_half_float GL_OES_texture_half_float_linear GL_OES_texture_npot GL_OES_vertex_array_object
WebGL 2 Extensions: EXT_color_buffer_float EXT_texture_filter_anisotropic EXT_disjoint_timer_query MOZ_debug OES_texture_float_linear WEBGL_compressed_texture_s3tc WEBGL_debug_renderer_info WEBGL_debug_shaders WEBGL_lose_context MOZ_WEBGL_lose_context MOZ_WEBGL_compressed_texture_s3tc
Direct2D: true
DirectWrite: true (10.0.15063.483)
GPU #1
Active: Yes
Description: Intel(R) HD Graphics 520
Vendor ID: 0x8086
Device ID: 0x1916
Driver Version: 20.19.15.4463
Driver Date: 7-6-2016
Drivers: igdumdim64 igd10iumd64 igd10iumd64 igd12umd64 igdumdim32 igd10iumd32 igd10iumd32 igd12umd32
Subsys ID: 00141414
RAM: Unknown
GPU #2
Active: No
Description: NVIDIA GeForce GPU
Vendor ID: 0x10de
Device ID: 0x134b
Driver Version: 21.21.13.7667
Driver Date: 1-15-2017
Drivers: C:\WINDOWS\System32\DriverStore\FileRepository\nvmso.inf_amd64_98dc755eff368925\nvd3dumx,C:\WINDOWS\System32\DriverStore\FileRepository\nvmso.inf_amd64_98dc755eff368925\nvwgf2umx,C:\WINDOWS\System32\DriverStore\FileRepository\nvmso.inf_amd64_98dc755eff368925\nvwgf2umx,C:\WINDOWS\System32\DriverStore\FileRepository\nvmso.inf_amd64_98dc755eff368925\nvwgf2umx C:\WINDOWS\System32\DriverStore\FileRepository\nvmso.inf_amd64_98dc755eff368925\nvd3dum,C:\WINDOWS\System32\DriverStore\FileRepository\nvmso.inf_amd64_98dc755eff368925\nvwgf2um,C:\WINDOWS\System32\DriverStore\FileRepository\nvmso.inf_amd64_98dc755eff368925\nvwgf2um,C:\WINDOWS\System32\DriverStore\FileRepository\nvmso.inf_amd64_98dc755eff368925\nvwgf2um
Subsys ID: 00081414
RAM: 1024
Diagnostics
AzureCanvasAccelerated: 0
AzureCanvasBackend: Direct2D 1.1
AzureCanvasBackend (UI Process): skia
AzureContentBackend: Direct2D 1.1
AzureContentBackend (UI Process): skia
AzureFallbackCanvasBackend (UI Process): cairo
GPUProcessPid: 1380
GPUProcess: Terminate GPU Process
Device Reset: Trigger Device Reset
Decision Log
WEBRENDER:
opt-in by default: WebRender is an opt-in feature




Media
-----

Audio Backend: wasapi
Max Channels: 2
Preferred Channel Layout: stereo
Preferred Sample Rate: 48000
Output Devices
Name: Group
Headphones (MINIJAMBOX by Jawbone Stereo): BTHENUM\{0000110b-0000-1000-8000-00805f9b34fb}_LOCALMFG&0048\7&297c82f3&0&E0D1E6039C34_C00000000
Speakers (Realtek High Definition Audio(SST)): INTELAUDIO\FUNC_01&VEN_10EC&DEV_0298&SUBSYS_10EC1072&REV_1001\4&a4c0fcf&0&0001
Headphones (Realtek High Definition Audio(SST)): INTELAUDIO\FUNC_01&VEN_10EC&DEV_0298&SUBSYS_10EC1072&REV_1001\4&a4c0fcf&0&0001
DELL U3014 (Intel(R) Display Audio): INTELAUDIO\FUNC_01&VEN_8086&DEV_2809&SUBSYS_80860101&REV_1000\4&a4c0fcf&0&0201
Headset (MINIJAMBOX by Jawbone Hands-Free): BTHHFENUM\BthHFPAudio\8&10bafe3a&0&97
Speakers (Realtek High Definition Audio(SST)): INTELAUDIO\FUNC_01&VEN_10EC&DEV_0298&SUBSYS_10EC1072&REV_1001\4&a4c0fcf&0&0001
Headphones (Realtek High Definition Audio(SST)): INTELAUDIO\FUNC_01&VEN_10EC&DEV_0298&SUBSYS_10EC1072&REV_1001\4&a4c0fcf&0&0001
Input Devices
Name: Group
Headset (MINIJAMBOX by Jawbone Hands-Free): BTHHFENUM\BthHFPAudio\8&10bafe3a&0&97
Microphone Array (Realtek High Definition Audio(SST)): INTELAUDIO\FUNC_01&VEN_10EC&DEV_0298&SUBSYS_10EC1072&REV_1001\4&a4c0fcf&0&0001
Headset Microphone (Realtek High Definition Audio(SST)): INTELAUDIO\FUNC_01&VEN_10EC&DEV_0298&SUBSYS_10EC1072&REV_1001\4&a4c0fcf&0&0001

Important Modified Preferences
------------------------------

browser.cache.disk.capacity: 358400
browser.cache.disk.filesystem_reported: 1
browser.cache.disk.hashstats_reported: 1
browser.cache.disk.smart_size.first_run: false
browser.cache.frecency_experiment: 3
browser.places.smartBookmarksVersion: 8
browser.startup.homepage_override.buildID: 20170828100127
browser.startup.homepage_override.mstone: 57.0a1
browser.tabs.warnOnClose: false
browser.urlbar.lastSuggestionsPromptDate: 20170828
browser.urlbar.timesBeforeHidingSuggestionsHint: 0
dom.forms.autocomplete.formautofill: true
dom.push.userAgentID: 058c8a9345434fb9bf9ac79e008fd19a
extensions.lastAppVersion: 57.0a1
layers.mlgpu.sanity-test-failed: false
media.benchmark.vp9.fps: 145
media.benchmark.vp9.versioncheck: 2
media.gmp-gmpopenh264.abi: x86_64-msvc-x64
media.gmp-gmpopenh264.lastUpdate: 1503953869
media.gmp-gmpopenh264.version: 1.6
media.gmp-manager.buildID: 20170828100127
media.gmp-manager.lastCheck: 1503953924
media.gmp-widevinecdm.abi: x86_64-msvc-x64
media.gmp-widevinecdm.lastUpdate: 1503953870
media.gmp-widevinecdm.version: 1.4.8.970
media.gmp.storage.version.observed: 1
media.hardware-video-decoding.failed: false
network.cookie.prefsMigrated: true
network.predictor.cleaned-up: true
places.database.lastMaintenance: 1503954084
places.history.expiration.transient_current_max_pages: 82783
plugin.disable_full_page_plugin_for_types: application/pdf
privacy.donottrackheader.enabled: true
security.sandbox.content.tempDirSuffix: {78fd3142-5c22-42e4-b20e-f398828a6b87}
services.sync.declinedEngines: prefs,addons
services.sync.engine.addons: false
services.sync.engine.addresses.available: true
services.sync.engine.bookmarks.validation.lastTime: 1503953649
services.sync.engine.prefs: false
services.sync.engine.prefs.modified: false
services.sync.lastPing: 1503953508
services.sync.lastSync: Tue Aug 29 2017 10:53:57 GMT-0700 (Pacific Standard Time)
storage.vacuum.last.index: 0
storage.vacuum.last.places.sqlite: 1503954083
ui.osk.debug.keyboardDisplayReason: IKPOS: Keyboard presence confirmed.

Important Locked Preferences
----------------------------

Places Database
---------------

JavaScript
----------

Incremental GC: true

Accessibility
-------------

Activated: false
Prevent Accessibility: 0
Accessible Handler Used: true
Accessibility Instantiator:

Library Versions
----------------

NSPR
Expected minimum version: 4.17 Beta
Version in use: 4.17 Beta

NSS
Expected minimum version: 3.33 Beta
Version in use: 3.33 Beta

NSSSMIME
Expected minimum version: 3.33 Beta
Version in use: 3.33 Beta

NSSSSL
Expected minimum version: 3.33 Beta
Version in use: 3.33 Beta

NSSUTIL
Expected minimum version: 3.33 Beta
Version in use: 3.33 Beta

Experimental Features
---------------------

Sandbox
-------

Content Process Sandbox Level: 3
Effective Content Process Sandbox Level: 3
Flags: needinfo?(asa)
Does this reproduce in beta or release?  If not, maybe we can use mozregression to narrow down the cause.
Flags: needinfo?(asa)
I went to about:debugging#workers and opted out of e10s with dom.ipc.multiOptOut and now push notifications on facebook work.
Flags: needinfo?(asa)
I wonder if bug 1293277 would fix this.  Unfortunately all my try builds there have expired so I can't point you at a download right now.  Let me see if I can get another build going.
(In reply to Asa Dotzler [:asa] from comment #15)
> I went to about:debugging#workers and opted out of e10s with
> dom.ipc.multiOptOut and now push notifications on facebook work.

And it continues to work after re-enabling e10s. 

To double-check this I created a new profile and could reproduce the problem with the new profile. Then I set dom.ipc.multiOptOut to 1 and back to 0 and push notifications work.
(In reply to Ben Kelly [:bkelly] from comment #18)
> wat?

Triple checked. Created a new profile. Push notifications are broken as reported in this bug. Set dom.ipc.multiOptOut to 1 and then back to 0 and push notifications work. I don't understand this.
(In reply to Asa Dotzler [:asa] from comment #19)
> Triple checked. Created a new profile. Push notifications are broken as
> reported in this bug. Set dom.ipc.multiOptOut to 1 and then back to 0 and
> push notifications work. I don't understand this.

While it may not be related, I believe uBlock Origin had a similar fix. It wasn't blocking ads, but if you uninstalled it and then reinstalled it, it started blocking ads again.
I'm trying to reproduce, but I don't have a great way to trigger FB notifications.  Asa, how are you doing that?
(In reply to Ben Kelly [:bkelly] from comment #21)
> I'm trying to reproduce, but I don't have a great way to trigger FB
> notifications.  Asa, how are you doing that?

I just posted asking people what their first automobile was and the comments came flooding in. People on Facebook like to talk about themselves :)
I can reproduce on:

https://gauntface.github.io/simple-push-demo/
Summary: Facebook notification opens perpetually loading empty tab → notification opens perpetually loading empty tab
Andrew, do you have any time to investigate?
Flags: needinfo?(bugmail)
FWIW, the tab that opens when I click on the notification is a different PID than the one I had simple-push-demo open.
(In reply to Andrew Overholt [:overholt] from comment #25)
> FWIW, the tab that opens when I click on the notification is a different PID
> than the one I had simple-push-demo open.

^ probably un-related.

In 55 things work as expected but not in nightly. I'm on Windows.
mrbkap says things are broken in beta for him.
FWIW I just got it to work in Nightly :/
Okay, this is indeed bug 1383905 which bounced off central because of xpcshell test failures that I didn't finish investigating.  If we deliver the push notification to the WebExtensions process, the problem reliably reproduces.  This depends on "extensions.webextensions.remote" being set to true.  This was set to true only on windows in bug 1357486 landed on m-c=Firefox 56 on July 10th.  I think someone claimed to have reproduced this on MacOS/OS X, I presume they manually flipped the pref.  It certainly explains why I could only reproduce the problem randomly on both Beta and Nightly on Windows, but never on either on Linux.  But if you turn the pref on on Linux and invert the fix from bug 1383905 you can reproduce it all the time, which is nice.

I feel really bad about this, so I'm going to enumerate the silver linings:
- We know what breaks without the fix!  No need to wonder if it's dangerous for us to dispatch the push events at the webextensions process.  We have the conclusive answer, yes, the dangerous thing was dangerous.
- I think this makes a clear case that we do want MOZ_LOG for ServiceWorker stuff.  For probabilistic failures like this, logs would have been handy.  Especially given the existence of https://www.janbambas.cz/mozilla-log-analyzer-added-basic-network-diagnostics/.

Interestingly, in the failure case, both the relevant content process and the parent process start using up a lot of CPU.  I see the following according to the perf-html.io profiler (on an -Og optimized nightly build I made):
- The parent process is spending about 23% of its time in "LocationChange" and "SecurityChange" messages and 8% in SessionStore:restoreHistoryComplete and SessionStore:update and other sesionstore stuff.
- The content process is spending:
  - 19% of its time in SessionStore:restoreTabContent
  - 12% of its time in SessionStore:restoreHistory

I'm not sure there's anything directly actionable about the above since the ServiceWorker path side-steps a lot of things and :bkelly's clients patches will change things related to openWindow and our ServiceWorkerPrivate remoting changes will avoid push notifications or other consumers from doing dangerous things.

However, until we get there, a good stop-gap defense-in-depth for scenarios like this might be for us to have ServiceWorkerManager::GetInstance() return null in the non-"web" process scenario.  We've been quite thorough about adding checks that handle it returning null because of shutdown, and PushMessageDispatcher::NotifyWorkers() returns NS_ERROR_FAILURE in such a case.  At the very least, it will save us some memory in the webextensions process.

I'm going to finish up figuring out the test problem with bug 1383905 now.
Depends on: 1383905
Assignee: nobody → bugmail
Status: NEW → ASSIGNED
Flags: needinfo?(bugmail)
I've pushed the fix on bug 1383905 and the (testing) fix it depends on from bug 1395827 to inbound.  Ideally they will stick and end up in the next nightly build.  If anyone doesn't want to wait until then, my try builds from yesterday are available at:
https://archive.mozilla.org/pub/firefox/try-builds/bugmail@asutherland.org-78821ee2ec8eb39b0115b7167d050ebcda80b2ed/

I'm needinfo-ing myself to request beta uplifts after the fix has baked on nightly for a few days/the holiday weekend is over.  (I'm assuming no new betas will be spun before tuesday.)
Flags: needinfo?(bugmail)
Just to clarify, is this only an issue in beta, or was it in 55 as well? (The linked bug is still ? for 55) I want to rule this out as a (significant) contributor to notif clickthrough rate because our Firefox notif ramp isn't quite seeing the results I'd expect.
(In reply to Seth Kinast from comment #30)
> Just to clarify, is this only an issue in beta, or was it in 55 as well?
> (The linked bug is still ? for 55) I want to rule this out as a
> (significant) contributor to notif clickthrough rate because our Firefox
> notif ramp isn't quite seeing the results I'd expect.

The underlying bug exists in Fx55, the triggering problem (OOP WebExts on Windows) does not.  There is an edge case related to "file://" URLs, but that shouldn't be a thing.  See https://bugzilla.mozilla.org/show_bug.cgi?id=1383905#c11 for more rationale/discussion.

Can you characterize the metric?  Specifically, for this bug, we expect the following chain of events to happen:
1) Works: Firefox receives push notification and event gets delivered to a ServiceWorker.
2) Works: ServiceWorker decides to show a desktop notification.
3) Works: User sees desktop notification.
4) Works: User clicks desktop notification, ServiceWorker sees click event.
5) Does not work, window never actually opens: clients.openWindow(...)

If your metric says you're seeing a click event (4 is happening) but the window never seems to open (5 is not happening), then we may be looking at a variant of this bug.  If your metric says you're trying to show a notification (2 is happening) but the user never seems to click (4 is not happening), that's something else.

If you can also indicate whether the problem is happening across all platforms, or if it seems specific to certain platforms, that's useful as we have platform-specific notification services that could factor into things.  (I believe Windows uses our catch-all XUL.  And OS X, Android, and Gnome seem to have platform specific layers.)

Unless this does seem to this bug, it's likely preferable to take any discussion to a new bug or the private mozilla-facebook list if you're not comfortable discussing things in detail in bugzilla.  We are absolutely happy to help investigate.
Flags: needinfo?(bugmail) → needinfo?(skinast)
Is there anything left to do here, Andrew?
Flags: needinfo?(bugmail)
(In reply to Andrew Overholt [:overholt] from comment #32)
> Is there anything left to do here, Andrew?

No; bug 1383905 fixed this and stuck, and we can spin-off any follow-up replies to comment 31 to a new bug.
Status: ASSIGNED → RESOLVED
Closed: 4 years ago
Flags: needinfo?(bugmail)
Resolution: --- → FIXED
Flags: needinfo?(skinast)
You need to log in before you can comment on or make changes to this bug.