Skip to content

fix: do not initialize extension system in in-memory sessions #22772

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 8, 2020

Conversation

MarshallOfSound
Copy link
Member

@MarshallOfSound MarshallOfSound commented Mar 19, 2020

Fixes #22414

Some parts of Chrome in the extension logic expect at least one persistent (not off the record) BrowserContext to exist even when creating an off-the-record context. This change ensures we don't initialize extensions in a context that does not meet that expectation. It also adds some handy new infra in our test suite to make it really easy to test crash regressions in the future 👍

Notes: fixed crash that could occur when calling session.fromPartition inside the ready event

@electron-cation electron-cation bot added the new-pr 🌱 PR opened recently label Mar 19, 2020
@deepak1556
Copy link
Member

We don't allow loading extensions in temp session for the same reason #22090

But at the same time if an app wants to run completely off an in memory session it should be allowed.

In this case we just have to make sure the extension dependencies are not loaded for in memory session rather than always creating a permanent session.

@MarshallOfSound MarshallOfSound force-pushed the fix-in-memory-session-creation-crash branch from 9429809 to de66b34 Compare March 19, 2020 20:46
@MarshallOfSound
Copy link
Member Author

@deepak1556 Took an alternative approach of just not initializing any of the extension stuff in contexts that are in memory

@electron-cation electron-cation bot removed the new-pr 🌱 PR opened recently label Mar 20, 2020
@deepak1556
Copy link
Member

Sorry for the delay, looked further into the original crash, it was happening because the keyed service was trying to register on a browser context that was destroyed. Even if the extension system is registered on an in memory context, the keyed services that need persistence will rely on ExtensionBrowserClient::GetOriginalContext to return a persistent context.

We currently do the following:

BrowserContext* ElectronExtensionsBrowserClient::GetOriginalContext(
    BrowserContext* context) {
  DCHECK(context);
  if (context->IsOffTheRecord()) {
    return ElectronBrowserContext::From("", false); // cause of the crash
  } else {
    return context;
  }
}

ElectronBrowserContext::From only maintains a weak map, the caller needs to make sure the return context is managed. So your original solution of having to create a persistent context is correct but its better we create it through ElectronExtensionsBrowserClient::GetOriginalContext

https://gist.github.com/deepak1556/fccbfd62d4a5ada87dc9b5aca58f75dc

@MarshallOfSound
Copy link
Member Author

@deepak1556 This change ensures that we don't register the extensions system on in-memory contexts (and therefore also fixes this). Do we want to create (and leak) a default session when an. in-memory session is created (and that in-memory session can't use extensions APIs anyway)?

@deepak1556
Copy link
Member

Do we want to create (and leak) a default session when an. in-memory session is created

By leak do you mean the persistent stuff being created on the user's file system ?

that in-memory session can't use extensions APIs anyway

Yeah but realized there are other components that rely just on extension system being initialized without the use of extension api we expose, for ex: PDF viewer.

Chrome is slightly different but it does piggyback an incognito context on top of a permanent context to make these things work. So maybe its better we follow that as well ?

But if we are good with ignoring features like PDF viewer for in-memory context then we can stick with the current solution.

@MarshallOfSound
Copy link
Member Author

@nornagon Thoughts on the above?

@nornagon
Copy link
Contributor

IMO:

  • The PDF viewer should work in in-memory sessions.
  • It's OK to create a default session even if it's not explicitly used. Not having a default session is a relatively rare use-case, and the memory overhead is not that high afaik.

@bughit
Copy link
Contributor

bughit commented Mar 31, 2020

But at the same time if an app wants to run completely off an in memory session it should be allowed.

It's not entirely clear from this discussion, will that still be possible? AFAIK the following used to accomplish that:

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

@nornagon
Copy link
Contributor

@bughit that will continue to work; however, the default session will be created behind the scenes.

If there's a compelling reason not to create the default session, we could potentially consider alternatives, but I'm not aware of any such reason.

@bughit
Copy link
Contributor

bughit commented Mar 31, 2020

however, the default session will be created behind the scenes.

So this default session is a persistent one and will be reading/writing to the userData path?

If there's a compelling reason not to create the default session

My use-case is multiple parallel instances of the app. They have the same userData. Usually they use memory partitions, When they use persistent partitions they are distinct per process, so there's no interference.

If they now start sharing a persistent default session, isn't that going to be a problem? The ability to run without any persistence seems like a valuable feature, worth keeping.

@nornagon
Copy link
Contributor

however, the default session will be created behind the scenes.

So this default session is a persistent one and will be reading/writing to the userData path?

Only data relevant to the session will be written to disk, so if you never open a window or make a request in the default session, no meaningful data will be written. This change doesn't alter observable behavior other than perhaps creating a few empty files and directories in the userData directory that otherwise might not have been created.

If there's a compelling reason not to create the default session

My use-case is multiple parallel instances of the app. They have the save userData. Usually they use memory partitions, When they use persistent partitions they are distinct per process, so there's no interference.

This ought to continue to work. As above, the persistence or otherwise of actual session data isn't affected by this change; it's just creating an empty/unused session behind the scenes, because Chromium's infrastructure expects it.

@bughit
Copy link
Contributor

bughit commented Mar 31, 2020

This change doesn't alter observable behavior other than perhaps creating a few empty files and directories in the userData directory that otherwise might not have been created

My understanding is that chrome does not support sharing its data directory among multiple browser instances. So even though this default sessions will not be used explicitly, it seems to me its implicit use, which at least involves file creation and ultimately whatever else chrome decides to do with it, is not instance-safe. What if two instances start creating it at the same time?

I would expect no parallel multi-instance write to the shared default session to be supported/safe.

@bughit
Copy link
Contributor

bughit commented Mar 31, 2020

I ran the following test with 9.0, which creates but does not use a default session

'use strict';

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

let win;

app.setPath('userData', Path.join(__dirname, 'chrome_user_data'));

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

  session.defaultSession;

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

});

And captured the writing with procmon

6:56:24.3193390 PM	electron.exe	7624	Write	CreateFile	C:\src\electron_test_apps\start_crash\chrome_user_data\Dictionaries	
6:56:24.3626403 PM	electron.exe	7624	Write	CreateFile	C:\src\electron_test_apps\start_crash\chrome_user_data\Local Storage	
6:56:24.3633425 PM	electron.exe	7624	Write	CreateFile	C:\src\electron_test_apps\start_crash\chrome_user_data\Local Storage\leveldb	
6:56:24.3656301 PM	electron.exe	7624	Write	CreateFile	C:\src\electron_test_apps\start_crash\chrome_user_data\Local Storage\leveldb\LOG	
6:56:24.3668767 PM	electron.exe	7624	Write	CreateFile	C:\src\electron_test_apps\start_crash\chrome_user_data\Local Storage\leveldb\LOCK	
6:56:24.3677877 PM	electron.exe	7624	Write	CreateFile	C:\src\electron_test_apps\start_crash\chrome_user_data\Local Storage\leveldb\MANIFEST-000001	
6:56:24.3690609 PM	electron.exe	7624	Write	WriteFile	C:\src\electron_test_apps\start_crash\chrome_user_data\Local Storage\leveldb\MANIFEST-000001	
6:56:24.3691502 PM	electron.exe	7624	Write	WriteFile	C:\src\electron_test_apps\start_crash\chrome_user_data\Local Storage\leveldb\MANIFEST-000001	
6:56:24.3693444 PM	electron.exe	7624	Write	CreateFile	C:\src\electron_test_apps\start_crash\chrome_user_data\Code Cache	
6:56:24.3693903 PM	electron.exe	7624	Write	CreateFile	C:\src\electron_test_apps\start_crash\chrome_user_data\Local Storage\leveldb\000001.dbtmp	
6:56:24.3699456 PM	electron.exe	7624	Write	CreateFile	C:\src\electron_test_apps\start_crash\chrome_user_data\Code Cache\js	
6:56:24.3701963 PM	electron.exe	7624	Write	WriteFile	C:\src\electron_test_apps\start_crash\chrome_user_data\Local Storage\leveldb\000001.dbtmp	
6:56:24.3703091 PM	electron.exe	7624	Write	WriteFile	C:\src\electron_test_apps\start_crash\chrome_user_data\Local Storage\leveldb\000001.dbtmp	
6:56:24.3719080 PM	electron.exe	7624	Write	CreateFile	C:\src\electron_test_apps\start_crash\chrome_user_data\Code Cache\wasm	
6:56:24.3738669 PM	electron.exe	7624	Write	CreateFile	C:\src\electron_test_apps\start_crash\chrome_user_data\Code Cache\wasm\index	
6:56:24.3739064 PM	electron.exe	7624	Write	CreateFile	C:\src\electron_test_apps\start_crash\chrome_user_data\Code Cache\js\index	
6:56:24.3752255 PM	electron.exe	7624	Write	SetRenameInformationFile	C:\src\electron_test_apps\start_crash\chrome_user_data\Local Storage\leveldb\000001.dbtmp	
6:56:24.3759430 PM	electron.exe	7624	Write	WriteFile	C:\src\electron_test_apps\start_crash\chrome_user_data\Code Cache\js\index	
6:56:24.3762444 PM	electron.exe	7624	Write	WriteFile	C:\src\electron_test_apps\start_crash\chrome_user_data\Code Cache\wasm\index	
6:56:24.3793089 PM	electron.exe	7624	Write	WriteFile	C:\src\electron_test_apps\start_crash\chrome_user_data\Local Storage\leveldb\LOG	
6:56:24.3801179 PM	electron.exe	7624	Write	CreateFile	C:\src\electron_test_apps\start_crash\chrome_user_data\Local Storage\leveldb\000003.log	
6:56:24.4152386 PM	electron.exe	7624	Write	CreateFile	C:\src\electron_test_apps\start_crash\chrome_user_data\FontLookupTableCache	
6:56:24.4372853 PM	electron.exe	7624	Write	CreateFile	C:\src\electron_test_apps\start_crash\chrome_user_data\blob_storage	
6:56:24.4401104 PM	electron.exe	7624	Write	CreateFile	C:\src\electron_test_apps\start_crash\chrome_user_data\blob_storage\20399d0c-a5e0-4c6d-8777-87723a04b9c5	
6:56:24.4623401 PM	electron.exe	7624	Write	CreateFile	C:\src\electron_test_apps\start_crash\chrome_user_data\Code Cache\wasm\index-dir	
6:56:24.4624150 PM	electron.exe	7624	Write	CreateFile	C:\src\electron_test_apps\start_crash\chrome_user_data\Code Cache\js\index-dir	
6:56:24.4668419 PM	electron.exe	7624	Write	CreateFile	C:\src\electron_test_apps\start_crash\chrome_user_data\Code Cache\wasm\index-dir\temp-index	
6:56:24.4675323 PM	electron.exe	7624	Write	CreateFile	C:\src\electron_test_apps\start_crash\chrome_user_data\Code Cache\js\index-dir\temp-index	
6:56:24.4678371 PM	electron.exe	7624	Write	WriteFile	C:\src\electron_test_apps\start_crash\chrome_user_data\Code Cache\wasm\index-dir\temp-index	
6:56:24.4686223 PM	electron.exe	7624	Write	SetRenameInformationFile	C:\src\electron_test_apps\start_crash\chrome_user_data\Code Cache\wasm\index-dir\temp-index	
6:56:24.4686618 PM	electron.exe	7624	Write	WriteFile	C:\src\electron_test_apps\start_crash\chrome_user_data\Code Cache\js\index-dir\temp-index	
6:56:24.4729793 PM	electron.exe	7624	Write	SetRenameInformationFile	C:\src\electron_test_apps\start_crash\chrome_user_data\Code Cache\js\index-dir\temp-index	
6:56:24.4871992 PM	electron.exe	7624	Write	CreateFile	C:\src\electron_test_apps\start_crash\chrome_user_data\FontLookupTableCache\font_unique_name_table.pb	
6:56:24.4888344 PM	electron.exe	7624	Write	WriteFile	C:\src\electron_test_apps\start_crash\chrome_user_data\FontLookupTableCache\font_unique_name_table.pb	
6:56:24.4893837 PM	electron.exe	7624	Write	WriteFile	C:\src\electron_test_apps\start_crash\chrome_user_data\FontLookupTableCache\font_unique_name_table.pb	
6:56:24.6615181 PM	electron.exe	6300	Write	CreateFile	C:\src\electron_test_apps\start_crash\chrome_user_data\Cache	
6:56:24.6630549 PM	electron.exe	6300	Write	CreateFile	C:\src\electron_test_apps\start_crash\chrome_user_data\Cache\index	
6:56:24.6643207 PM	electron.exe	6300	Write	WriteFile	C:\src\electron_test_apps\start_crash\chrome_user_data\Cache\index	
6:56:24.6676773 PM	electron.exe	6300	Write	CreateFile	C:\src\electron_test_apps\start_crash\chrome_user_data\Cache\data_0	
6:56:24.6685239 PM	electron.exe	6300	Write	WriteFile	C:\src\electron_test_apps\start_crash\chrome_user_data\Cache\data_0	
6:56:24.6693022 PM	electron.exe	6300	Write	CreateFile	C:\src\electron_test_apps\start_crash\chrome_user_data\Cache\data_1	
6:56:24.6697802 PM	electron.exe	6300	Write	WriteFile	C:\src\electron_test_apps\start_crash\chrome_user_data\Cache\data_1	
6:56:24.6708353 PM	electron.exe	6300	Write	CreateFile	C:\src\electron_test_apps\start_crash\chrome_user_data\Cache\data_2	
6:56:24.6717552 PM	electron.exe	6300	Write	WriteFile	C:\src\electron_test_apps\start_crash\chrome_user_data\Cache\data_2	
6:56:24.6725234 PM	electron.exe	6300	Write	CreateFile	C:\src\electron_test_apps\start_crash\chrome_user_data\Cache\data_3	
6:56:24.6732632 PM	electron.exe	6300	Write	WriteFile	C:\src\electron_test_apps\start_crash\chrome_user_data\Cache\data_3	
6:56:24.6748630 PM	electron.exe	6300	Write	WriteFile	C:\src\electron_test_apps\start_crash\chrome_user_data\Cache\data_1	
6:56:24.6749909 PM	electron.exe	6300	Write	WriteFile	C:\src\electron_test_apps\start_crash\chrome_user_data\Cache\data_0	
6:56:24.6750554 PM	electron.exe	6300	Write	WriteFile	C:\src\electron_test_apps\start_crash\chrome_user_data\Cache\data_0	
6:56:24.9973814 PM	electron.exe	6300	Write	WriteFile	C:\src\electron_test_apps\start_crash\chrome_user_data\Cache\data_1	
6:56:24.9974064 PM	electron.exe	6300	Write	WriteFile	C:\src\electron_test_apps\start_crash\chrome_user_data\Cache\data_3	
6:56:24.9974435 PM	electron.exe	6300	Write	WriteFile	C:\src\electron_test_apps\start_crash\chrome_user_data\Cache\data_0	
6:56:24.9976137 PM	electron.exe	6300	Write	WriteFile	C:\src\electron_test_apps\start_crash\chrome_user_data\Cache\data_1	
6:56:24.9998967 PM	electron.exe	6300	Write	WriteFile	C:\src\electron_test_apps\start_crash\chrome_user_data\Cache\data_0	
6:56:24.9999776 PM	electron.exe	6300	Write	WriteFile	C:\src\electron_test_apps\start_crash\chrome_user_data\Cache\data_0	
6:56:25.0000331 PM	electron.exe	6300	Write	WriteFile	C:\src\electron_test_apps\start_crash\chrome_user_data\Cache\data_0	
6:56:25.2202132 PM	electron.exe	7624	Write	CreateFile	C:\src\electron_test_apps\start_crash\chrome_user_data\Dictionaries\en-US-9-0.bdic	
6:56:25.2207295 PM	electron.exe	7624	Write	WriteFile	C:\src\electron_test_apps\start_crash\chrome_user_data\Dictionaries\en-US-9-0.bdic	
6:56:25.2320184 PM	electron.exe	6300	Write	WriteFile	C:\src\electron_test_apps\start_crash\chrome_user_data\Cache\data_1	
6:56:25.2320563 PM	electron.exe	6300	Write	WriteFile	C:\src\electron_test_apps\start_crash\chrome_user_data\Cache\data_3	
6:56:25.2341299 PM	electron.exe	6300	Write	CreateFile	C:\src\electron_test_apps\start_crash\chrome_user_data\Cache\f_000001	
6:56:25.2349635 PM	electron.exe	7624	Write	CreateFile	C:\src\electron_test_apps\start_crash\chrome_user_data\Dictionaries\en-US-9-0.bdic
6:56:25.2349772 PM	electron.exe	6300	Write	WriteFile	C:\src\electron_test_apps\start_crash\chrome_user_data\Cache\data_1	
6:56:25.2350842 PM	electron.exe	7624	Write	CreateFile	C:\src\electron_test_apps\start_crash\chrome_user_data\en-US-9-0.bdic	
6:56:25.2352752 PM	electron.exe	6300	Write	WriteFile	C:\src\electron_test_apps\start_crash\chrome_user_data\Cache\f_000001	
6:56:25.2355163 PM	electron.exe	6300	Write	WriteFile	C:\src\electron_test_apps\start_crash\chrome_user_data\Cache\data_0	
6:56:25.2360866 PM	electron.exe	7624	Write	WriteFile	C:\src\electron_test_apps\start_crash\chrome_user_data\en-US-9-0.bdic	
6:56:34.3624166 PM	electron.exe	7624	Write	CreateFile	C:\src\electron_test_apps\start_crash\chrome_user_data\66c10975-431d-4c22-8496-5cc819ce9b68.tmp	
6:56:34.3652618 PM	electron.exe	7624	Write	WriteFile	C:\src\electron_test_apps\start_crash\chrome_user_data\66c10975-431d-4c22-8496-5cc819ce9b68.tmp	
6:56:34.3653794 PM	electron.exe	7624	Write	WriteFile	C:\src\electron_test_apps\start_crash\chrome_user_data\66c10975-431d-4c22-8496-5cc819ce9b68.tmp	
6:56:34.3678524 PM	electron.exe	7624	Write	SetRenameInformationFile	C:\src\electron_test_apps\start_crash\chrome_user_data\66c10975-431d-4c22-8496-5cc819ce9b68.tmp	
6:56:34.3802212 PM	electron.exe	7624	Write	CreateFile	C:\src\electron_test_apps\start_crash\chrome_user_data\4ae30b76-14d0-4738-891c-5f1fbddf4a7a.tmp	
6:56:34.3817802 PM	electron.exe	7624	Write	WriteFile	C:\src\electron_test_apps\start_crash\chrome_user_data\4ae30b76-14d0-4738-891c-5f1fbddf4a7a.tmp	
6:56:34.3818740 PM	electron.exe	7624	Write	WriteFile	C:\src\electron_test_apps\start_crash\chrome_user_data\4ae30b76-14d0-4738-891c-5f1fbddf4a7a.tmp	
6:56:34.3834764 PM	electron.exe	7624	Write	SetRenameInformationFile	C:\src\electron_test_apps\start_crash\chrome_user_data\4ae30b76-14d0-4738-891c-5f1fbddf4a7a.tmp
6:56:34.3844087 PM	electron.exe	7624	Write	CreateFile	C:\src\electron_test_apps\start_crash\chrome_user_data\Preferences~RF2999ebb.TMP	
6:56:34.3854539 PM	electron.exe	7624	Write	SetRenameInformationFile	C:\src\electron_test_apps\start_crash\chrome_user_data\Preferences	
6:56:34.3863501 PM	electron.exe	7624	Write	SetRenameInformationFile	C:\src\electron_test_apps\start_crash\chrome_user_data\4ae30b76-14d0-4738-891c-5f1fbddf4a7a.tmp	
6:56:34.3874649 PM	electron.exe	7624	Write	SetDispositionInformationFile	C:\src\electron_test_apps\start_crash\chrome_user_data\Preferences~RF2999ebb.TMP	
6:56:34.6567804 PM	electron.exe	6300	Write	CreateFile	C:\src\electron_test_apps\start_crash\chrome_user_data\c8fe231a-1242-4e94-9570-37b98bb0428f.tmp	
6:56:34.6579051 PM	electron.exe	6300	Write	WriteFile	C:\src\electron_test_apps\start_crash\chrome_user_data\c8fe231a-1242-4e94-9570-37b98bb0428f.tmp	
6:56:34.6579809 PM	electron.exe	6300	Write	WriteFile	C:\src\electron_test_apps\start_crash\chrome_user_data\c8fe231a-1242-4e94-9570-37b98bb0428f.tmp	
6:56:34.7592163 PM	electron.exe	6300	Write	SetRenameInformationFile	C:\src\electron_test_apps\start_crash\chrome_user_data\c8fe231a-1242-4e94-9570-37b98bb0428f.tmp	
6:57:24.3457955 PM	electron.exe	6300	Write	WriteFile	C:\src\electron_test_apps\start_crash\chrome_user_data\Cache\data_1	
6:57:24.3493841 PM	electron.exe	6300	Write	CreateFile	C:\src\electron_test_apps\start_crash\chrome_user_data\f091f18a-4019-4e1a-99b2-3a27a9344a04.tmp	
6:57:24.3506746 PM	electron.exe	6300	Write	WriteFile	C:\src\electron_test_apps\start_crash\chrome_user_data\f091f18a-4019-4e1a-99b2-3a27a9344a04.tmp	
6:57:24.3507898 PM	electron.exe	6300	Write	WriteFile	C:\src\electron_test_apps\start_crash\chrome_user_data\f091f18a-4019-4e1a-99b2-3a27a9344a04.tmp	
6:57:24.4535771 PM	electron.exe	6300	Write	SetRenameInformationFile	C:\src\electron_test_apps\start_crash\chrome_user_data\f091f18a-4019-4e1a-99b2-3a27a9344a04.tmp
6:57:24.4558891 PM	electron.exe	6300	Write	CreateFile	C:\src\electron_test_apps\start_crash\chrome_user_data\Network Persistent State~RF29a6248.TMP	
6:57:24.4569007 PM	electron.exe	6300	Write	SetRenameInformationFile	C:\src\electron_test_apps\start_crash\chrome_user_data\Network Persistent State	
6:57:24.4575626 PM	electron.exe	6300	Write	SetRenameInformationFile	C:\src\electron_test_apps\start_crash\chrome_user_data\f091f18a-4019-4e1a-99b2-3a27a9344a04.tmp	
6:57:24.4583792 PM	electron.exe	6300	Write	SetDispositionInformationFile	C:\src\electron_test_apps\start_crash\chrome_user_data\Network Persistent State~RF29a6248.TMP	
  • that's a lot of writing to a lot of files
  • some at the beginning, some later, some on exit

Does this test capture what your defaultSession creation will do? If so, I can't imagine this is multi-instance safe. If you believe it is, please explain, otherwise please continue supporting runing without a persistent defaultSession.

@bughit
Copy link
Contributor

bughit commented Apr 7, 2020

@nornagon Regardless of how this shakes out, it's important to understand the ramifications, so to that end, could you (or others in this thread) please comment on my previous two posts?

@nornagon
Copy link
Contributor

nornagon commented Apr 7, 2020

@bughit I agree that we should be sure not to break multiple instances of Electron running at the same time. I don't have enough context right now to say for sure how Chromium's internals would handle multiple processes accessing that directory, or whether this PR would break that use case.

@jkleinsc jkleinsc requested review from nornagon and deepak1556 April 9, 2020 14:47
Copy link
Contributor

@nornagon nornagon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

see above, we need to confirm that the use-case for multiple instances of electron isn't broken.

@bughit
Copy link
Contributor

bughit commented Apr 9, 2020

Here's a confirmation from chromium docs
https://chromium.googlesource.com/chromium/src/+/master/docs/user_data_dir.md

two running Chrome instances cannot share the same user data directory

also an internal bug report mentions it

WebView should make sure it's not used multiple times at once from the same data dir

This will cause both instances to open the same database/cache/etc files at the same time, which will probably malfunction and/or corrupt data

@MarshallOfSound MarshallOfSound changed the title fix: create default session if it does not exist before creating in-memory session fix: do not initialize extension system in in-memory sessions May 8, 2020
Comment on lines +141 to +142
// Guard usages of extension_system() with !IsOffTheRecord()
// There is no extension system for in-memory sessions
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

DCHECK perhaps?

Comment on lines +33 to +54
describe('crash cases', () => {
afterEach(() => {
for (const child of children) {
child.kill()
}
expect(children).to.have.lengthOf(0, 'all child processes should have exited cleanly')
children.length = 0
})
const cases = fs.readdirSync(fixturePath)

for (const crashCase of cases) {
it(`the "${crashCase}" case should not crash`, () => {
const fixture = path.resolve(fixturePath, crashCase)
const argsFile = path.resolve(fixture, 'electron.args')
const args = [fixture]
if (fs.existsSync(argsFile)) {
args.push(...fs.readFileSync(argsFile, 'utf8').trim().split('\n'))
}
return runFixtureAndEnsureCleanExit(args)
})
}
})
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this should go in the extensions spec file

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was starting a new thing / easy way to add "this used to crash" style specs instead of scattering them around with re-implementation of the bootstrapping logic. Now you can just add fixtures to the crash cases folder and assert they no longer crash

@MarshallOfSound MarshallOfSound merged commit 21900fe into master May 8, 2020
@release-clerk
Copy link

release-clerk bot commented May 8, 2020

Release Notes Persisted

fixed crash that could occur when calling session.fromPartition inside the ready event

@MarshallOfSound MarshallOfSound deleted the fix-in-memory-session-creation-crash branch May 8, 2020 18:17
@trop
Copy link
Contributor

trop bot commented May 8, 2020

I have automatically backported this PR to "9-x-y", please check out #23472

@bughit
Copy link
Contributor

bughit commented Apr 7, 2022

@nornagon

see above, we need to confirm that the use-case for multiple instances of electron isn't broken.

I took that to mean that you would to avoid a persistent defaultSession which is not multi-instance safe, unless the app chose to use it.

two running Chrome instances cannot share the same user data directory

However, looking at v18 it's created by default and it doesn't appear possible to avoid it.

So can this be considered a bug and be addressed? I am comparing with v4.2 which did not create a persistent default session unless a BrowserWindows was configured to use it.

@bughit
Copy link
Contributor

bughit commented Apr 8, 2022

@nornagon filed a bug for this: #33663

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

session.fromPartition crashes the app since 9.x
4 participants
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy