<h3 dir="auto">Issue Details</h3>
<ul dir="auto">
<li><strong>Electron Version:</strong>
<ul dir="auto">
<li>9.1.0</li>
</ul>
</li>
<li><strong>Operating System:</strong>
<ul dir="auto">
<li>macOS 10.14</li>
</ul>
</li>
<li><strong>Last Known Working Electron version:</strong>
<ul dir="auto">
<li>Maybe Electron &lt;= v7, although maybe I wasn't using localStorage at all back then <g-emoji class="g-emoji" alias="thinking" fallback-src="https://github.githubassets.com/images/icons/emoji/unicode/1f914.png">🤔</g-emoji></li>
</ul>
</li>
</ul>
<h3 dir="auto">Expected Behavior</h3>
<p dir="auto">LocalStorage shouldn't be absurdly slow.</p>
<h3 dir="auto">Actual Behavior</h3>
<p dir="auto">LocalStorage is absurdly slow, requiring about 5 seconds on my machine for this call:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="localStorage.getItem('');"><pre class="notranslate"><code class="notranslate">localStorage.getItem('');
</code></pre></div>
<h3 dir="auto">To Reproduce</h3>
<p dir="auto">This is a weird one, I spent a couple of hours tracking down this one, you might be able to reproduce it with the files provided but I'm not sure.</p>
<ol dir="auto">
<li>Running <code class="notranslate">npx electron app_dummy_slow.asar</code> requires about 5 seconds on my machine for a window to show up.</li>
<li>No need really to unpack the asar, it's essentially the quick-start project with only 2 interesting lines, without either of which I can't reproduce the issue:
<ol dir="auto">
<li><code class="notranslate">localStorage.getItem('');</code>
<ul dir="auto">
<li>Putting this call somewhere in <code class="notranslate">index.html</code> takes about 5 seconds to complete, which sounds absurd to me. Without this call I can't experience any issues.</li>
<li>The same thing happens when using <code class="notranslate">sessionStorage</code>.</li>
</ul>
</li>
<li><code class="notranslate">"name": "notable",</code>
<ul dir="auto">
<li>This is in the <code class="notranslate">package.json</code> file, using a different name I can't reproduce the issue. As "notable" is the name of my Electron app I guess when setting this name its specific local storage and session storage files are getting loaded, which for whatever reason takes forever.</li>
</ul>
</li>
</ol>
</li>
<li>The "Local Storage" and "Session Storage" folders, attached below, found under "~/Library/Application Support/Notable", weigh like less than 50kb each, making this even weirder.</li>
<li>Somewhat surprisingly Notable's appData folder weighs about 20MB on my machine, while the analogous folders for other electron apps on my machine weigh about 500kb each, but its content seems ok to me:</li>
</ol>
<p dir="auto"><a target="_blank" rel="noopener noreferrer nofollow" href="https://user-images.githubusercontent.com/1812093/86703511-dd686100-c00b-11ea-8e0b-f4585fd9caf0.png"><img src="https://user-images.githubusercontent.com/1812093/86703511-dd686100-c00b-11ea-8e0b-f4585fd9caf0.png" alt="image" style="max-width: 100%;"></a></p>
<h3 dir="auto">Resources</h3>
<p dir="auto"><a href="https://github.com/electron/electron/files/4882281/app_dummy_slow.asar.zip">app_dummy_slow.asar.zip</a><br>
<a href="https://github.com/electron/electron/files/4882306/Session.Storage.zip">Session Storage.zip</a><br>
<a href="https://github.com/electron/electron/files/4882307/Local.Storage.zip">Local Storage.zip</a></p>
<h3 dir="auto">Preflight Checklist</h3>
<ul class="contains-task-list">
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> I have read the <a href="https://github.com/electron/electron/blob/master/CONTRIBUTING.md">Contributing Guidelines</a> for this project.</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> I agree to follow the <a href="https://github.com/electron/electron/blob/master/CODE_OF_CONDUCT.md">Code of Conduct</a> that this project adheres to.</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> I have searched the issue tracker for an issue that matches the one I want to file, without success.</li>
</ul>
<h3 dir="auto">Issue Details</h3>
<ul dir="auto">
<li><strong>Electron Version:</strong>
<ul dir="auto">
<li>8.0.0</li>
</ul>
</li>
<li><strong>Operating System:</strong>
<ul dir="auto">
<li>Windows 10</li>
</ul>
</li>
</ul>
<h3 dir="auto">Expected Behavior</h3>
<p dir="auto">Fast startup for multiple application instances and <code class="notranslate">localStorage</code> is synchronized.</p>
<h3 dir="auto">Actual Behavior</h3>
<p dir="auto">Slow startup for multiple application instances and <code class="notranslate">localStorage</code> is not synchronized.</p>
<h3 dir="auto">To Reproduce</h3>
<p dir="auto">Save something into <code class="notranslate">localStorage</code> that will be retrieved on application startup.<br>
Now open a second instance of the application.</p>
<h3 dir="auto">Additional Information</h3>
<p dir="auto"><g-emoji class="g-emoji" alias="warning" fallback-src="https://github.githubassets.com/images/icons/emoji/unicode/26a0.png">⚠️</g-emoji> The issue can be closed. This is just an information for everyone stumbling across the same problem. Hopefully it will appear in search engines.</p>
<p dir="auto">The problem is that the application locks the config files associated with <code class="notranslate">localStorage</code>. When an additional instance starts it will eventually timeout requesting the same lock. The timeout will slow down the application startup by quite a bit.</p>
<p dir="auto">A workaround is not to use <code class="notranslate">localStorage</code>.  For my application I'm using <a href="https://github.com/nathanbuchar/electron-settings">https://github.com/nathanbuchar/electron-settings</a>. This library works great and as far as I can tell there are no locks on the config files. To synchronize settings use a file watcher (also in that library) that notifies file changes.</p>