<h3 dir="auto">Version Info</h3>
<p dir="auto">electron: 4.0.0<br>
OS: Windows 10   x64 10.0.17134.472</p>
<h3 dir="auto">Expected Behavior</h3>
<div class="highlight highlight-source-js notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="require('crypto').createCipheriv('rc4', 'asdasd', null)
require('crypto').createCipheriv('rc4', 'asdasd', '')"><pre class="notranslate"><span class="pl-en">require</span><span class="pl-kos">(</span><span class="pl-s">'crypto'</span><span class="pl-kos">)</span><span class="pl-kos">.</span><span class="pl-en">createCipheriv</span><span class="pl-kos">(</span><span class="pl-s">'rc4'</span><span class="pl-kos">,</span> <span class="pl-s">'asdasd'</span><span class="pl-kos">,</span> <span class="pl-c1">null</span><span class="pl-kos">)</span>
<span class="pl-en">require</span><span class="pl-kos">(</span><span class="pl-s">'crypto'</span><span class="pl-kos">)</span><span class="pl-kos">.</span><span class="pl-en">createCipheriv</span><span class="pl-kos">(</span><span class="pl-s">'rc4'</span><span class="pl-kos">,</span> <span class="pl-s">'asdasd'</span><span class="pl-kos">,</span> <span class="pl-s">''</span><span class="pl-kos">)</span></pre></div>
<p dir="auto">work well as  node v10.15.0</p>
<h3 dir="auto">Actual behavior</h3>
<div class="highlight highlight-source-js notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="require('crypto').createCipheriv('rc4', 'asdasd', null)"><pre class="notranslate"><span class="pl-en">require</span><span class="pl-kos">(</span><span class="pl-s">'crypto'</span><span class="pl-kos">)</span><span class="pl-kos">.</span><span class="pl-en">createCipheriv</span><span class="pl-kos">(</span><span class="pl-s">'rc4'</span><span class="pl-kos">,</span> <span class="pl-s">'asdasd'</span><span class="pl-kos">,</span> <span class="pl-c1">null</span><span class="pl-kos">)</span></pre></div>
<p dir="auto">cause renderer process crash</p>
<div class="highlight highlight-source-js notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="require('crypto').createCipheriv('rc4', 'asdasd', '')"><pre class="notranslate"><span class="pl-en">require</span><span class="pl-kos">(</span><span class="pl-s">'crypto'</span><span class="pl-kos">)</span><span class="pl-kos">.</span><span class="pl-en">createCipheriv</span><span class="pl-kos">(</span><span class="pl-s">'rc4'</span><span class="pl-kos">,</span> <span class="pl-s">'asdasd'</span><span class="pl-kos">,</span> <span class="pl-s">''</span><span class="pl-kos">)</span></pre></div>
<p dir="auto">throw</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="Invalid IV length
    at Cipheriv.createCipherBase (internal/crypto/cipher.js:79)
    at Cipheriv.createCipherWithIV (internal/crypto/cipher.js:119)
    at new Cipheriv (internal/crypto/cipher.js:225)
    at Object.createCipheriv (crypto.js:105)
    at &lt;anonymous&gt;:1:19
createCipherBase @ internal/crypto/cipher.js:79
createCipherWithIV @ internal/crypto/cipher.js:119
Cipheriv @ internal/crypto/cipher.js:225
createCipheriv @ crypto.js:105"><pre class="notranslate"><code class="notranslate">Invalid IV length
    at Cipheriv.createCipherBase (internal/crypto/cipher.js:79)
    at Cipheriv.createCipherWithIV (internal/crypto/cipher.js:119)
    at new Cipheriv (internal/crypto/cipher.js:225)
    at Object.createCipheriv (crypto.js:105)
    at &lt;anonymous&gt;:1:19
createCipherBase @ internal/crypto/cipher.js:79
createCipherWithIV @ internal/crypto/cipher.js:119
Cipheriv @ internal/crypto/cipher.js:225
createCipheriv @ crypto.js:105
</code></pre></div>
<h3 dir="auto">To Reproduce</h3>
<p dir="auto">exec code above in devTools</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> 9.0.5</li>
<li><strong>Operating System:</strong> Windows 10</li>
<li><strong>Last Known Working Electron version:</strong> I didn't work with electron for a long time, but last time I played with it the app had similar runtime reloading stuff going on and I don't remember it ever causing issues. That was Electron 1.6.2</li>
</ul>
<h3 dir="auto">Expected Behavior</h3>
<p dir="auto">Reloading window with any of (renderer process) <code class="notranslate">location.reload()</code>, or (main process) <code class="notranslate">window.reload()</code>, <code class="notranslate">window.webContents.reload()</code>, <code class="notranslate">window.webContents.reloadIgnoringCache()</code>, should reload the process and work just as initial load of the same file.</p>
<h3 dir="auto">Actual Behavior</h3>
<p dir="auto">Whenever I try reloading window (no matter the method, as described above), my app initialization process hangs as soon as it touches <code class="notranslate">fs.readdir()</code> call, despite it working just fine on initial load. No errors or any indication or clue anywhere as to what might be happening.</p>
<p dir="auto">Here is the snippet from the isolated example below:</p>
<div class="highlight highlight-source-js notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="const FS = require('fs');
const {promisify} = require('util');
const readdir = promisify(FS.readdir);

async function load() {
	console.log('load(): start');
	try {
		await readdir('.'); // &lt;= it hangs here on reload
		document.body.innerHTML = 'success! press F5 to reload';
	} catch (error) {
		document.body.innerHTML = `&lt;pre&gt;${error.message || error.stack}&lt;/pre&gt;`;
	}
	console.log('load(): end');
}

load().then(console.log, console.error);"><pre class="notranslate"><span class="pl-k">const</span> <span class="pl-c1">FS</span> <span class="pl-c1">=</span> <span class="pl-en">require</span><span class="pl-kos">(</span><span class="pl-s">'fs'</span><span class="pl-kos">)</span><span class="pl-kos">;</span>
<span class="pl-k">const</span> <span class="pl-kos">{</span>promisify<span class="pl-kos">}</span> <span class="pl-c1">=</span> <span class="pl-en">require</span><span class="pl-kos">(</span><span class="pl-s">'util'</span><span class="pl-kos">)</span><span class="pl-kos">;</span>
<span class="pl-k">const</span> <span class="pl-s1">readdir</span> <span class="pl-c1">=</span> <span class="pl-en">promisify</span><span class="pl-kos">(</span><span class="pl-c1">FS</span><span class="pl-kos">.</span><span class="pl-c1">readdir</span><span class="pl-kos">)</span><span class="pl-kos">;</span>

<span class="pl-k">async</span> <span class="pl-k">function</span> <span class="pl-en">load</span><span class="pl-kos">(</span><span class="pl-kos">)</span> <span class="pl-kos">{</span>
	<span class="pl-smi">console</span><span class="pl-kos">.</span><span class="pl-en">log</span><span class="pl-kos">(</span><span class="pl-s">'load(): start'</span><span class="pl-kos">)</span><span class="pl-kos">;</span>
	<span class="pl-k">try</span> <span class="pl-kos">{</span>
		<span class="pl-k">await</span> <span class="pl-s1">readdir</span><span class="pl-kos">(</span><span class="pl-s">'.'</span><span class="pl-kos">)</span><span class="pl-kos">;</span> <span class="pl-c">// &lt;= it hangs here on reload</span>
		<span class="pl-smi">document</span><span class="pl-kos">.</span><span class="pl-c1">body</span><span class="pl-kos">.</span><span class="pl-c1">innerHTML</span> <span class="pl-c1">=</span> <span class="pl-s">'success! press F5 to reload'</span><span class="pl-kos">;</span>
	<span class="pl-kos">}</span> <span class="pl-k">catch</span> <span class="pl-kos">(</span><span class="pl-s1">error</span><span class="pl-kos">)</span> <span class="pl-kos">{</span>
		<span class="pl-smi">document</span><span class="pl-kos">.</span><span class="pl-c1">body</span><span class="pl-kos">.</span><span class="pl-c1">innerHTML</span> <span class="pl-c1">=</span> <span class="pl-s">`&lt;pre&gt;<span class="pl-s1"><span class="pl-kos">${</span><span class="pl-s1">error</span><span class="pl-kos">.</span><span class="pl-c1">message</span> <span class="pl-c1">||</span> <span class="pl-s1">error</span><span class="pl-kos">.</span><span class="pl-c1">stack</span><span class="pl-kos">}</span></span>&lt;/pre&gt;`</span><span class="pl-kos">;</span>
	<span class="pl-kos">}</span>
	<span class="pl-smi">console</span><span class="pl-kos">.</span><span class="pl-en">log</span><span class="pl-kos">(</span><span class="pl-s">'load(): end'</span><span class="pl-kos">)</span><span class="pl-kos">;</span>
<span class="pl-kos">}</span>

<span class="pl-en">load</span><span class="pl-kos">(</span><span class="pl-kos">)</span><span class="pl-kos">.</span><span class="pl-en">then</span><span class="pl-kos">(</span><span class="pl-smi">console</span><span class="pl-kos">.</span><span class="pl-c1">log</span><span class="pl-kos">,</span> <span class="pl-smi">console</span><span class="pl-kos">.</span><span class="pl-c1">error</span><span class="pl-kos">)</span><span class="pl-kos">;</span></pre></div>
<h3 dir="auto">To Reproduce</h3>
<div class="highlight highlight-source-shell notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="git clone https://gist.github.com/aa794ac2dc3662fee5d800da420a4813.git reloadbug
cd reloadbug
npm install
npm start"><pre class="notranslate">git clone https://gist.github.com/aa794ac2dc3662fee5d800da420a4813.git reloadbug
<span class="pl-c1">cd</span> reloadbug
npm install
npm start</pre></div>
<p dir="auto">Hit F5 until it happens. On my app it happens almost 100% of the time. In the reproduction example around 50% of the time.</p>
<h3 dir="auto">Screenshots</h3>
<p dir="auto"><a target="_blank" rel="noopener noreferrer nofollow" href="https://user-images.githubusercontent.com/538801/85945881-e6d53780-b940-11ea-83c9-92e81aa80efd.gif"><img src="https://user-images.githubusercontent.com/538801/85945881-e6d53780-b940-11ea-83c9-92e81aa80efd.gif" alt="test" data-animated-image="" style="max-width: 100%;"></a></p>