admin管理员组文章数量:1187304
I am banging my head against the wall trying to debug an inexplicable behavior in my codebase.
I am using Electron 27.3.11.
The following code is just the example I have isolated at the moment.
async init({ items } = {}) {
// This logs
if (Game.config.debug) console.log("[CharacterBase] Initializing...");
if (!this.skills) this.createSkills();
// this.talents === null
if (!this._talents) await this.createTalents("silent");
if (!this.attributes) this.createAttributes();
if (!this.subtitle) this.createSubtitle();
if (!this.doll) this.createDoll();
if (!this.filepath) this.createFilepath();
return super.init({ items });
}
// ...
async createTalents(option) {
// This does not log.
if (Game.config.debug) console.log("[CharacterBase] Creating talents...");
this._talents = [];
for (const key of ["raceObject", "secondaryObject", "tradeObject"])
for (const k of this[key]?.talents ?? [])
await this.createTalent(k, option);
for (const talent of Object.values(Game.TALENTS).filter(
(talent) => !talent.requirements,
))
await this.createTalent(talent.key, option);
return this._talents;
}
All of my code used to run fine. It still runs fine in unit tests. However, it fails to run in process. It fails to run because after an arbitrary amount of code runs, it stops processing promises. As a result, when it hits an await, it hangs forever because the promise never stops pending. In the above code, that happens at await this.createTalents("silent");
I have no idea why this is happening. My code is not even heavy. When I investigate memoryInfo using performance.memory
immediately before the hang, I do not have any memory problem. I got:
{
jsHeapSizeLimit: 3760000000,
totalJSHeapSize: 68000000,
usedJSHeapSize: 56800000,
]
The exact point in my code that the hang occurs depends on my code. If I bloat it with console logs or big closures, it hangs on an earlier promise. If I remove console logs, it hangs on a later promise. Yet when it hangs, it never resolves into an out of memory error or anything that might help me understand what is wrong.
I've never encountered anything like this before and I have no idea what to guess is wrong.
本文标签: ElectronChromium stops executing promisesStack Overflow
版权声明:本文标题:ElectronChromium stops executing promises - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1738323559a2074611.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论