Skip to content

[Bug]: persistent defaultSession is created and written when not needed, making the app multi-instance unsafe #33663

@bughit

Description

@bughit

Preflight Checklist

Electron Version

18.0.1 x64

What operating system are you using?

Windows

Operating System Version

win7 sp1 x64

What arch are you using?

x64

Last Known Working Electron version

4.2

Expected Behavior

since user_data_dir is not multi-instance safe

#22772 (comment)

and per the intent expressed here:

#22772 (comment)
#22772 (review)

if the defaultSession is not needed by the app (when it uses a memory or persisted partition) the defaultSession should not be created, but more importantly persisted (which makes the app multi-instance unsafe)

Actual Behavior

the defaultSession is always created and persisted

run the following app

'use strict';

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

let win;

app.setPath('userData', path.join(__dirname, `user_data_${process.versions.chrome.split('.')[0]}`));

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

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

});

the user_data dir is filled with the persisted defaultSession not used by the app

Testcase Gist URL

No response

Additional Information

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      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