Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
Voxera11388316dAsync debugging is always more tricky but its usually worth it during to the better performance of the code :)
-
melezorus343336316dJust await it :p
Yeah, i got no idea how to track it between events/threads too -
melezorus343336316dOr, don't get excited and furious, write unit and runtime tests like a normal maniac writing multithreaded code.
-
lorentz15174315dLast time I had to deal with it, Node.js didn't give me the part of the call stack below an unawaited async call, including the unawaited call site itself. Most annoying debugging session of my life.
-
lorentz15174315dAlso the async call stack is an unbounded heap allocated linked list that isn't tracked as a named user struct so infinite recursion becomes an out-of-memory error where the heap usage report doesn't contain anything unusual.
-
lotd7775315d@melezorus34 got unit tests, in those everything passes, even ran in parallel.
Tracked it down to be due to a race condition where timeout triggers and the last promise resolves before the queue flushes…
new Promise(async (yay, nay) => {
setTimeout(() => nay(“timeout”, 750));
await calculations();
await syncRemoteService();
insertIntoDB().then(yay).catch(nay);
});
Anybody else that low-key hates step debugging async code in nodejs ?
Miss the simplicity of synchronously execution flow… Like debugging php with xdebug ☺️
rant
async is overrated