Issue 1:
Preflight Checklist

I have read the Contributing Guidelines for this project.

I agree to follow the Code of Conduct that this project adheres to.

I have searched the issue tracker for an issue that matches the one I want to file, without success.

Issue Details

Electron Version:

v9.0.0-beta.12

Operating System:

win7 sp1 x64

Expected Behavior

no crash

Actual Behavior

[4544:0330/164451.410:VERBOSE1:pref_proxy_config_tracker_impl.cc(185)] 0AB540A8: set chrome proxy config service to 0AB54350
[4544:0330/164451.410:VERBOSE1:pref_proxy_config_tracker_impl.cc(185)] 0AB76100: set chrome proxy config service to 0AB76AA8
[4544:0330/164451.425:VERBOSE1:device_event_log_impl.cc(206)] [16:44:51.423] Bluetooth: EVENT: bluetooth_api.cc:73 BluetoothAPI: 0AB3BBC0
[4544:0330/164451.425:VERBOSE1:device_event_log_impl.cc(206)] [16:44:51.425] Bluetooth: EVENT: bluetooth_api.cc:100 BluetoothAPI: Shutdown
[4544:0330/164451.425:VERBOSE1:device_event_log_impl.cc(206)] [16:44:51.426] Bluetooth: EVENT: bluetooth_api.cc:86 ~BluetoothAPI: 0AB3BBC0
[4544:0330/164451.425:VERBOSE1:pref_proxy_config_tracker_impl.cc(185)] 0AC1EFE0: set chrome proxy config service to 0ABE6210
[4544:0330/164451.425:VERBOSE1:pref_proxy_config_tracker_impl.cc(185)] 0AC3AAD0: set chrome proxy config service to 0AC1F8B0
[4544:0330/164451.425:VERBOSE1:device_event_log_impl.cc(206)] [16:44:51.437] Bluetooth: EVENT: bluetooth_api.cc:73 BluetoothAPI: 0AB771A0
[4544:0330/164451.425:VERBOSE1:device_event_log_impl.cc(206)] [16:44:51.437] Bluetooth: EVENT: bluetooth_api.cc:100 BluetoothAPI: Shutdown
[4544:0330/164451.441:VERBOSE1:device_event_log_impl.cc(206)] [16:44:51.439] Bluetooth: EVENT: bluetooth_api.cc:86 ~BluetoothAPI: 0AB771A0
[4544:0330/164451.441:VERBOSE1:pref_proxy_config_tracker_impl.cc(185)] 0AC4CDD0: set chrome proxy config service to 0AC1F8B0
[4544:0330/164451.441:VERBOSE1:device_event_log_impl.cc(206)] [16:44:51.450] Bluetooth: EVENT: bluetooth_api.cc:73 BluetoothAPI: 0AB771A0
[4544:0330/164451.457:VERBOSE1:device_event_log_impl.cc(206)] [16:44:51.455] Bluetooth: EVENT: bluetooth_api.cc:100 BluetoothAPI: Shutdown
[4544:0330/164451.457:VERBOSE1:device_event_log_impl.cc(206)] [16:44:51.455] Bluetooth: EVENT: bluetooth_api.cc:86 ~BluetoothAPI: 0AB771A0
[4544:0330/164451.457:VERBOSE1:pref_proxy_config_tracker_impl.cc(185)] 0AC6CFD0: set chrome proxy config service to 0AC1F8B0
[4544:0330/164451.457:VERBOSE1:device_event_log_impl.cc(206)] [16:44:51.468] Bluetooth: EVENT: bluetooth_api.cc:73 BluetoothAPI: 0AB771A0
[4544:0330/164451.472:VERBOSE1:device_event_log_impl.cc(206)] [16:44:51.470] Bluetooth: EVENT: bluetooth_api.cc:100 BluetoothAPI: Shutdown
[4544:0330/164451.472:VERBOSE1:device_event_log_impl.cc(206)] [16:44:51.471] Bluetooth: EVENT: bluetooth_api.cc:86 ~BluetoothAPI: 0AB771A0
Received fatal exception EXCEPTION_ACCESS_VIOLATION
Backtrace:
(No symbol) [0x44205D31]
electron::ElectronExtensionsBrowserClient::GetOriginalContext [0x0149B292+34] (C:\projects\src\electron\shell\browser\extensions\electron_extensions_browser_client.cc:114)
KeyedServiceFactory::GetServiceForContext [0x03396657+65] (C:\projects\src\components\keyed_service\core\keyed_service_factory.cc:57)
extensions::ProcessMapFactory::GetForBrowserContext [0x02D9BB12+22] (C:\projects\src\extensions\browser\process_map_factory.cc:17)
extensions::PermissionHelper::PermissionHelper [0x02E44BAA+30] (C:\projects\src\extensions\browser\api\web_request\permission_helper.cc:20)
BrowserContextKeyedServiceFactory::BuildServiceInstanceFor [0x0369B43F+15] (C:\projects\src\components\keyed_service\content\browser_context_keyed_service_factory.cc:94)
KeyedServiceFactory::GetServiceForContext [0x033966D0+186] (C:\projects\src\components\keyed_service\core\keyed_service_factory.cc:80)
BrowserContextKeyedServiceFactory::CreateServiceNow [0x0369B48D+13] (C:\projects\src\components\keyed_service\content\browser_context_keyed_service_factory.cc:127)
DependencyManager::CreateContextServices [0x03993B14+130] (C:\projects\src\components\keyed_service\core\dependency_manager.cc:71)
BrowserContextDependencyManager::DoCreateBrowserContextServices [0x0369B1EA+62] (C:\projects\src\components\keyed_service\content\browser_context_dependency_manager.cc:47)
BrowserContextDependencyManager::CreateBrowserContextServices [0x0369B1A7+13] (C:\projects\src\components\keyed_service\content\browser_context_dependency_manager.cc:32)
electron::ElectronBrowserContext::ElectronBrowserContext [0x0140EA0D+967] (C:\projects\src\electron\shell\browser\electron_browser_context.cc:145)
electron::ElectronBrowserContext::From [0x0140F8E4+160] (C:\projects\src\electron\shell\browser\electron_browser_context.cc:451)
electron::api::Session::FromPartition [0x013C8D45+303] (C:\projects\src\electron\shell\browser\api\electron_api_session.cc:955)
electron::api::WebContents::WebContents [0x013E2E99+733] (C:\projects\src\electron\shell\browser\api\electron_api_web_contents.cc:448)
electron::api::WebContents::Create [0x013EDDA1+49] (C:\projects\src\electron\shell\browser\api\electron_api_web_contents.cc:2748)
electron::api::BrowserWindow::BrowserWindow [0x0139ECE1+541] (C:\projects\src\electron\shell\browser\api\electron_api_browser_window.cc:77)
electron::api::BrowserWindow::New [0x013A010C+204] (C:\projects\src\electron\shell\browser\api\electron_api_browser_window.cc:466)
base::internal::FunctorTraits<gin_helper::WrappableBase *(*)(gin_helper::ErrorThrower, gin::Arguments *),void>::Invoke<gin_helper::WrappableBase *(*const &)(gin_helper::ErrorThrower, gin::Arguments *),gin_helper::ErrorThrower,gin::Ar
guments *> [0x0139C846+42] (C:\projects\src\base\bind_internal.h:399)
base::internal::Invoker<base::internal::BindState<gin_helper::WrappableBase *(*)(gin_helper::ErrorThrower, gin::Arguments *)>,gin_helper::WrappableBase *(gin_helper::ErrorThrower, gin::Arguments *)>::Run [0x0139C804+36] (C:\projects\
src\base\bind_internal.h:654)
gin_helper::internal::InvokeFactory<gin_helper::ErrorThrower,gin::Arguments *> [0x0139C7B2+85] (C:\projects\src\electron\shell\common\gin_helper\constructor.h:43)
gin_helper::internal::InvokeNew<gin_helper::WrappableBase *(gin_helper::ErrorThrower, gin::Arguments *)> [0x0139C658+56] (C:\projects\src\electron\shell\common\gin_helper\constructor.h:132)
base::internal::Invoker<base::internal::BindState<bool (*)(const base::RepeatingCallback<void (const std::__1::vector<std::__1::basic_string<wchar_t,std::__1::char_traits<wchar_t>,std::__1::allocator<wchar_t> >,std::__1::allocator<st
d::__1::basic_string<w [0x01390F33+19] (C:\projects\src\base\bind_internal.h:654)
gin_helper::Invoker<gin_helper::IndicesHolder<0,1>,electron::api::AutoUpdater *,gin_helper::Arguments *>::DispatchToCallback [0x0139B342+52] (C:\projects\src\electron\shell\common\gin_helper\function_template.h:229)
gin_helper::Dispatcher<void (v8::Isolate *, gin_helper::Arguments *)>::DispatchToCallback [0x0139C741+129] (C:\projects\src\electron\shell\common\gin_helper\function_template.h:263)
v8::internal::FunctionCallbackArguments::Call [0x01E41B4E+494] (C:\projects\src\v8\src\api\api-arguments-inl.h:158)
v8::internal::`anonymous namespace'::HandleApiCallHelper<1> [0x01E40FD9+441] (C:\projects\src\v8\src\builtins\builtins-api.cc:113)
v8::internal::Builtin_Impl_HandleApiCall [0x01E40B22+178] (C:\projects\src\v8\src\builtins\builtins-api.cc:137)
v8::internal::Builtin_HandleApiCall [0x01E4087F+47] (C:\projects\src\v8\src\builtins\builtins-api.cc:129)
Builtins_CEntry_Return1_DontSaveFPRegs_ArgvOnStack_BuiltinExit [0x025EB237+55]
Builtins_JSBuiltinsConstructStub [0x0258CE76+86]
Builtins_ConstructHandler [0x02655AEC+172]
Builtins_InterpreterEntryTrampoline [0x02590515+181]
Builtins_ArgumentsAdaptorTrampoline [0x0258AF52+178]
Builtins_InterpreterEntryTrampoline [0x02590515+181]
Builtins_ArgumentsAdaptorTrampoline [0x0258AF52+178]
Builtins_InterpreterEntryTrampoline [0x02590515+181]
Builtins_ArgumentsAdaptorTrampoline [0x0258AF52+178]
Builtins_JSEntryTrampoline [0x0258E61A+90]
Builtins_JSEntry [0x0258E43B+91]
v8::internal::`anonymous namespace'::Invoke [0x01EDC370+1152] (C:\projects\src\v8\src\execution\execution.cc:367)
v8::internal::Execution::Call [0x01EDBED0+208] (C:\projects\src\v8\src\execution\execution.cc:461)
v8::Function::Call [0x01DFA5B1+449] (C:\projects\src\v8\src\api\api.cc:4988)
node::InternalMakeCallback [0x036B069E+140] (C:\projects\src\third_party\electron_node\src\api\callback.cc:156)
node::MakeCallback [0x036B0991+177] (C:\projects\src\third_party\electron_node\src\api\callback.cc:223)
node::MakeCallback [0x036B08B4+132] (C:\projects\src\third_party\electron_node\src\api\callback.cc:202)
node::MakeCallback [0x036B0802+114] (C:\projects\src\third_party\electron_node\src\api\callback.cc:188)
gin_helper::internal::CallMethodWithArgs [0x01474361+69] (C:\projects\src\electron\shell\common\gin_helper\event_emitter_caller.cc:23)
gin_helper::EmitEvent<base::BasicStringPiece<std::__1::basic_string<char> >,v8::Local<v8::Object> &,const base::DictionaryValue &> [0x0138FAE7+137] (C:\projects\src\electron\shell\common\gin_helper\event_emitter_caller.h:50)
gin_helper::EventEmitter<electron::api::App>::EmitWithEvent<const base::DictionaryValue &> [0x0138FA03+105] (C:\projects\src\electron\shell\common\gin_helper\event_emitter.h:114)
gin_helper::EventEmitter<electron::api::App>::Emit<const base::DictionaryValue &> [0x01387A4B+97] (C:\projects\src\electron\shell\common\gin_helper\event_emitter.h:79)
electron::api::App::OnFinishLaunching [0x013879E5+21] (C:\projects\src\electron\shell\browser\api\electron_api_app.cc:611)
electron::Browser::DidFinishLaunching [0x01401573+229] (C:\projects\src\electron\shell\browser\browser.cc:180)
electron::ElectronBrowserMainParts::PreMainMessageLoopRun [0x0141108E+350] (C:\projects\src\electron\shell\browser\electron_browser_main_parts.cc:476)
content::BrowserMainLoop::PreMainMessageLoopRun [0x02860374+52] (C:\projects\src\content\browser\browser_main_loop.cc:1026)
content::StartupTaskRunner::RunAllTasksNow [0x02B3E5A5+45] (C:\projects\src\content\browser\startup_task_runner.cc:41)
content::BrowserMainLoop::CreateStartupTasks [0x0285F48E+490] (C:\projects\src\content\browser\browser_main_loop.cc:936)
content::BrowserMainRunnerImpl::Initialize [0x02861C38+88] (C:\projects\src\content\browser\browser_main_runner_impl.cc:130)
content::BrowserMain [0x0285E094+156] (C:\projects\src\content\browser\browser_main.cc:43)
content::RunBrowserProcessMain [0x027843F5+77] (C:\projects\src\content\app\content_main_runner_impl.cc:529)
content::ContentMainRunnerImpl::RunServiceManager [0x02784E01+725] (C:\projects\src\content\app\content_main_runner_impl.cc:978)
content::ContentMainRunnerImpl::Run [0x02784B02+258] (C:\projects\src\content\app\content_main_runner_impl.cc:882)
content::ContentServiceManagerMainDelegate::RunEmbedderProcess [0x01D582F3+19] (C:\projects\src\content\app\content_service_manager_main_delegate.cc:52)
service_manager::Main [0x034C8249+961] (C:\projects\src\services\service_manager\embedder\main.cc:423)
content::ContentMain [0x01D58953+51] (C:\projects\src\content\app\content_main.cc:19)
wWinMain [0x0138136B+605] (C:\projects\src\electron\shell\app\electron_main.cc:158)
__scrt_common_main_seh [0x05CA7D9A+248] (d:\agent\_work\4\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl:288)
BaseThreadInitThunk [0x7591343D+18]
RtlInitializeExceptionChain [0x777398B2+99]
RtlInitializeExceptionChain [0x77739885+54]

To Reproduce

run the following app

'use strict';

const {app, BrowserWindow} = require('electron');

let win;

app.once('ready', async () => {

win = new BrowserWindow({
webPreferences: {
partition: 'memory_partition_1',
},
});

});

Issue 2:
Preflight Checklist

I have read the Contributing Guidelines for this project.

I agree to follow the Code of Conduct that this project adheres to.

I have searched the issue tracker for an issue that matches the one I want to file, without success.

Issue Details

Electron Version:

9.0.0-beta.1 -- terminates silently

9.0.0-beta.3 -- terminates silently

master (10.0.0-nightly.20200225) -- crashes with [448015:0227/160341.082069:FATAL:dependency_manager.cc(144)] Check failed: false. Attempted to access a context that was ShutDown()

Operating System:

Arch Linux current

Last Known Working Electron version:

8.0.2

Expected Behavior

I don't expect session.fromPartition() to terminate or crash the app.

I expect that I will be able to use that session later.

Note that attempting to use the returned session does not prevent the crash/termination.

Actual Behavior

The app terminates in 9.0.0-beta.* and crashes on master.

Crash log:

[449023:0227/160822.369119:FATAL:dependency_manager.cc(144)] Check failed: false. Attempted to access a context that was ShutDown(). This is most likely a heap smasher in progress. After KeyedService::Shutdown() completes, your service MUST NOT refer to depended services again.
#0 0x561dae402699 base::debug::CollectStackTrace()
#1 0x561dae32b223 base::debug::StackTrace::StackTrace()
#2 0x561dae3412a4 logging::LogMessage::~LogMessage()
#3 0x561daf440189 DependencyManager::AssertContextWasntDestroyed()
#4 0x561daf43f98c KeyedServiceBaseFactory::AssertContextWasntDestroyed()
#5 0x561db29d3adb BrowserContextKeyedServiceFactory::GetContextToUse()
#6 0x561daf441280 KeyedServiceFactory::GetServiceForContext()
#7 0x561dae031d95 extensions::BrowserContextKeyedAPIFactory<>::BuildServiceInstanceFor()
#8 0x561db29d3a45 BrowserContextKeyedServiceFactory::BuildServiceInstanceFor()
#9 0x561daf44131a KeyedServiceFactory::GetServiceForContext()
#10 0x561daf43fea9 DependencyManager::CreateContextServices()
#11 0x561db29d3727 BrowserContextDependencyManager::DoCreateBrowserContextServices()
#12 0x561daac4b583 electron::ElectronBrowserContext::ElectronBrowserContext()
#13 0x561daac4cddc electron::ElectronBrowserContext::From()
#14 0x561daabe645f electron::api::Session::FromPartition()
#15 0x561daabe8609 (anonymous namespace)::FromPartition()
#16 0x561daabe88b7 gin_helper::Invoker<>::DispatchToCallback<>()
#17 0x561daabe87ab gin_helper::Dispatcher<>::DispatchToCallback()
#18 0x561dabe90a30 v8::internal::FunctionCallbackArguments::Call()
#19 0x561dabe8f0d1 v8::internal::(anonymous namespace)::HandleApiCallHelper<>()
#20 0x561dabe8d0da v8::internal::Builtin_Impl_HandleApiCall()
#21 0x561dabe8cb89 v8::internal::Builtin_HandleApiCall()
#22 0x561dace0c03f Builtins_CEntry_Return1_DontSaveFPRegs_ArgvOnStack_BuiltinExit

Received signal 6
#0 0x561dae402699 base::debug::CollectStackTrace()
#1 0x561dae32b223 base::debug::StackTrace::StackTrace()
#2 0x561dae4021b0 base::debug::(anonymous namespace)::StackDumpSignalHandler()
#3 0x7f306a24c800 (/usr/lib/libpthread-2.31.so+0x147ff)
#4 0x7f3068c27ce5 __GI_raise
#5 0x7f3068c11857 __GI_abort
#6 0x561dae400f65 base::debug::BreakDebugger()
#7 0x561dae34174e logging::LogMessage::~LogMessage()
#8 0x561daf440189 DependencyManager::AssertContextWasntDestroyed()
#9 0x561daf43f98c KeyedServiceBaseFactory::AssertContextWasntDestroyed()
#10 0x561db29d3adb BrowserContextKeyedServiceFactory::GetContextToUse()
#11 0x561daf441280 KeyedServiceFactory::GetServiceForContext()
#12 0x561dae031d95 extensions::BrowserContextKeyedAPIFactory<>::BuildServiceInstanceFor()
#13 0x561db29d3a45 BrowserContextKeyedServiceFactory::BuildServiceInstanceFor()
#14 0x561daf44131a KeyedServiceFactory::GetServiceForContext()
#15 0x561daf43fea9 DependencyManager::CreateContextServices()
#16 0x561db29d3727 BrowserContextDependencyManager::DoCreateBrowserContextServices()
#17 0x561daac4b583 electron::ElectronBrowserContext::ElectronBrowserContext()
#18 0x561daac4cddc electron::ElectronBrowserContext::From()
#19 0x561daabe645f electron::api::Session::FromPartition()
#20 0x561daabe8609 (anonymous namespace)::FromPartition()
#21 0x561daabe88b7 gin_helper::Invoker<>::DispatchToCallback<>()
#22 0x561daabe87ab gin_helper::Dispatcher<>::DispatchToCallback()
#23 0x561dabe90a30 v8::internal::FunctionCallbackArguments::Call()
#24 0x561dabe8f0d1 v8::internal::(anonymous namespace)::HandleApiCallHelper<>()
#25 0x561dabe8d0da v8::internal::Builtin_Impl_HandleApiCall()
#26 0x561dabe8cb89 v8::internal::Builtin_HandleApiCall()
#27 0x561dace0c03f Builtins_CEntry_Return1_DontSaveFPRegs_ArgvOnStack_BuiltinExit
r8: 0000000000000000 r9: 00007ffd4147e670 r10: 0000000000000008 r11: 0000000000000246
r12: 00007ffd4147e8d0 r13: aaaaaaaaaaaaaaaa r14: 00007ffd4147f938 r15: 00007ffd4147e8d0
di: 0000000000000002 si: 00007ffd4147e670 bp: 00007ffd4147e8c0 bx: 00007f3067929c40
dx: 0000000000000000 ax: 0000000000000000 cx: 00007f3068c27ce5 sp: 00007ffd4147e670
ip: 00007f3068c27ce5 efl: 0000000000000246 cgf: 002b000000000033 erf: 0000000000000000
trp: 0000000000000000 msk: 0000000000000000 cr2: 0000000000000000
[end of stack trace]

To Reproduce

const { BrowserWindow, app, session } = require('electron')
console.log(process.versions)
app.on('ready', () => {
const foo = session.fromPartition('foo')
const window = new BrowserWindow({
webPreferences: {
// session: foo
}
})
window.webContents.loadURL('about:blank')
window.show()
})