<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> v10.1.1 (also present in v9)</li>
<li><strong>Operating System:</strong> macOS 10.15.5</li>
</ul>
<h3 dir="auto">Actual Behavior</h3>
<p dir="auto">Node.js timers stop working indefinitely after running Electron for a while. This breaks all async Node.js functions like <code class="notranslate">fs.readFile</code>, <code class="notranslate">fs.promises.readFile</code>, and <code class="notranslate">http.get</code>:</p>
<p dir="auto"><a target="_blank" rel="noopener noreferrer nofollow" href="https://user-images.githubusercontent.com/1093313/92156093-196e4580-ee46-11ea-9665-773db9f7ffd6.png"><img width="869" alt="" src="https://user-images.githubusercontent.com/1093313/92156093-196e4580-ee46-11ea-9665-773db9f7ffd6.png" style="max-width: 100%;"></a></p>
<p dir="auto">In case it's not clear in the screenshot, <code class="notranslate">window.setTimeout</code> works but the Node.js version of <code class="notranslate">setTimeout</code> doesn't.</p>
<p dir="auto"><code class="notranslate">fs.readFileSync</code> and synchronous functions continue to work fine:<br>
<a target="_blank" rel="noopener noreferrer nofollow" href="https://user-images.githubusercontent.com/1093313/92156278-5d614a80-ee46-11ea-81b2-4f9d8d67dc96.png"><img width="869" alt="" src="https://user-images.githubusercontent.com/1093313/92156278-5d614a80-ee46-11ea-81b2-4f9d8d67dc96.png" style="max-width: 100%;"></a></p>
<h3 dir="auto">To Reproduce</h3>
<p dir="auto">It's hard to reproduce. This issue happens randomly but frequently enough. It could happen after 10 seconds of launching Electron or after 1 hour.</p>
<h3 dir="auto">Additional Information</h3>
<p dir="auto"><code class="notranslate">allowRendererProcessReuse</code> is set to <code class="notranslate">true</code>. I use 3 native modules in the renderer process: <a href="https://github.com/atom/node-keytar"><code class="notranslate">keytar</code></a>, <a href="https://github.com/codebytere/node-mac-contacts/"><code class="notranslate">node-mac-contacts</code></a> and <a href="https://github.com/codebytere/node-mac-permissions"><code class="notranslate">node-mac-permissions</code></a>. All 3 modules are up to date.</p>
<p dir="auto">Only refreshing (⌘ R) fixes this and gets everything to work again.</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 (1809)</li>
</ul>
</li>
<li><strong>Last Known Working Electron version:</strong>
<ul dir="auto">
<li>
Unknown
</li>
</ul>
</li>
</ul>
<p dir="auto">When setting <code class="notranslate">app.allowRendererProcessReuse = true</code> and after reloading the renderer (<code class="notranslate">Ctrl+R</code> in developer console), Node <code class="notranslate">fs</code> APIs would randomly stop working. Specifically, the callbacks are never called, or if you're using <code class="notranslate">fs.promises</code>, the promises are never resolved.</p>
<p dir="auto">An interesting observation is: when you reload again, for a brief moment before the page is refreshed, the previous <code class="notranslate">fs</code> calls are magically unblocked. This can be observed by <code class="notranslate">console.log</code> lines suddenly printing the moment you hit <code class="notranslate">Ctrl+R</code> which disappears quickly as the whole page reloads.</p>
<p dir="auto">Possibly related: <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="475351669" data-permission-text="Title is private" data-url="https://github.com/electron/electron/issues/19554" data-hovercard-type="issue" data-hovercard-url="/electron/electron/issues/19554/hovercard" href="https://github.com/electron/electron/issues/19554">#19554</a> This issue sounds like the opposite of what's happening here.</p>
<p dir="auto">Also note: issue does not present itself when <code class="notranslate">app.allowRendererProcessReuse = false</code></p>
<h3 dir="auto">Expected Behavior</h3>
<p dir="auto">From the repro steps, expecting to see local files printed in the console:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="...
renderer.js:8 Reading file main.js
renderer.js:8 Reading file package-lock.json
renderer.js:8 Reading file package.json
renderer.js:8 Reading file preload.js
renderer.js:8 Reading file README.md
renderer.js:8 Reading file renderer.js
renderer.js:14 done"><pre class="notranslate"><code class="notranslate">...
renderer.js:8 Reading file main.js
renderer.js:8 Reading file package-lock.json
renderer.js:8 Reading file package.json
renderer.js:8 Reading file preload.js
renderer.js:8 Reading file README.md
renderer.js:8 Reading file renderer.js
renderer.js:14 done
</code></pre></div>
<h3 dir="auto">Actual Behavior</h3>
<p dir="auto">List is printed the first time the app loads. Hit Ctrl+R and observe only a few lines printed, or none at all. Hit Ctrl+R again and observe more lines printed for a split second before renderer reloads.</p>
<h3 dir="auto">To Reproduce</h3>
<p dir="auto">Clone <a href="https://github.com/electron/electron-quick-start">https://github.com/electron/electron-quick-start</a></p>
<p dir="auto">rendereer.js</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="(async () =&gt; {
	const fs = require('fs').promises;

	for (let i = 0; i &lt; 10; i++) {
		let list = await fs.readdir('.', {withFileTypes: true});
		for (let file of list) {
			if (file.isFile()) {
				console.log('Reading file', file.name);
				await fs.readFile(file.name, 'utf-8');
			}
		}
	}

	console.log('done');
})();"><pre class="notranslate"><code class="notranslate">(async () =&gt; {
	const fs = require('fs').promises;

	for (let i = 0; i &lt; 10; i++) {
		let list = await fs.readdir('.', {withFileTypes: true});
		for (let file of list) {
			if (file.isFile()) {
				console.log('Reading file', file.name);
				await fs.readFile(file.name, 'utf-8');
			}
		}
	}

	console.log('done');
})();
</code></pre></div>
<p dir="auto">main.js</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="const {app, BrowserWindow} = require('electron');

function createWindow() {
  const win = new BrowserWindow({
    width: 800,
    height: 600,
    webPreferences: {
      nodeIntegration: true
    }
  });

  win.loadFile('index.html');
  win.webContents.openDevTools();
}

app.whenReady().then(createWindow);

app.allowRendererProcessReuse = true;
app.on('window-all-closed', () =&gt; {
  if (process.platform !== 'darwin') {
    app.quit();
  }
});

app.on('activate', () =&gt; {
  if (BrowserWindow.getAllWindows().length === 0) {
    createWindow();
  }
});"><pre class="notranslate"><code class="notranslate">const {app, BrowserWindow} = require('electron');

function createWindow() {
  const win = new BrowserWindow({
    width: 800,
    height: 600,
    webPreferences: {
      nodeIntegration: true
    }
  });

  win.loadFile('index.html');
  win.webContents.openDevTools();
}

app.whenReady().then(createWindow);

app.allowRendererProcessReuse = true;
app.on('window-all-closed', () =&gt; {
  if (process.platform !== 'darwin') {
    app.quit();
  }
});

app.on('activate', () =&gt; {
  if (BrowserWindow.getAllWindows().length === 0) {
    createWindow();
  }
});
</code></pre></div>
<h3 dir="auto">Screenshots</h3>
<p dir="auto">First boot:<br>
<a target="_blank" rel="noopener noreferrer nofollow" href="https://user-images.githubusercontent.com/609710/74136094-80cb5c00-4bbb-11ea-92fd-c49b87b3a9f3.png"><img src="https://user-images.githubusercontent.com/609710/74136094-80cb5c00-4bbb-11ea-92fd-c49b87b3a9f3.png" alt="image" style="max-width: 100%;"></a><br>
On reload:<br>
<a target="_blank" rel="noopener noreferrer nofollow" href="https://user-images.githubusercontent.com/609710/74136317-cd169c00-4bbb-11ea-8e81-caf0e967bbd9.png"><img src="https://user-images.githubusercontent.com/609710/74136317-cd169c00-4bbb-11ea-8e81-caf0e967bbd9.png" alt="image" style="max-width: 100%;"></a></p>
<h3 dir="auto">Additional Information</h3>