You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
import 'express';
import 'socket.io';
import deasync from 'deasync';
import cp from 'child_process';
console.log(deasync(cp.exec)('ls -la'));
Looking through the other issues I have not been able to find any other reports of this error. Digging around elsewhere, this seems to be coming from some low level C area, but that is beyond me.
It only occurs with ES6 modules, using commonjs' require works fine. It also only occurs when I import both socket.io and express, commenting out either import allows the deasync call to run. Furthermore, not every module causes this. Of those I tested only these 2 cause the bug to occur, which I'd imagine has something to do with their dependencies.
But the plot thickens, if you wrap the deasync call in a setTimeout, even of 0ms, it runs fine. This of course defeats the entire purpose of deasync, but I had a sneaky suspicion this would work and to me it indicates a deeper origin of the issue within Node's execution scheduling.
Environment:
deasync: v0.1.29
node: v20.10.0
OS: Ubuntu 22.04
architecture: x86_64
I'm not really expecting a solution that will allow me to use deasync for my project but I thought I'd post this here as it appears to be indicative of a much deeper problem. Love the idea of deasync by the way!
The text was updated successfully, but these errors were encountered:
MushyShaman
changed the title
Peculiar low level bug with ES6 modules, namely Socket.IO and Express
"uv__has_active_reqs(loop) failed" when using ES6 modules, namely Socket.IO and Express
Dec 1, 2023
If you use deasync then all javascript in your NodeJS will stop. So e.g. if SocketIO uses heartbeat pings then your app gets infarct if deasync takes too long. :-D At the same time your app won't be able to accept requests while in deasync.
If you use deasync then all javascript in your NodeJS will stop. So e.g. if SocketIO uses heartbeat pings then your app gets infarct if deasync takes too long. :-D At the same time your app won't be able to accept requests while in deasync.
Yes I am aware of this and whilst it does not relate to the bug I will state my use case.
I have another module which requires a call to an async init method to set up.
I would like that initialised instance to be available as an import to all other areas of my code.
I wrap the init call in deasync, allowing me to subsequently export the objects it creates.
After importing this wrapper module where required, I call the start methods on my networking modules as usual.
Receiving this error whilst trying to run the example from the main readme.
Here is the minimum code to reproduce:
Looking through the other issues I have not been able to find any other reports of this error. Digging around elsewhere, this seems to be coming from some low level C area, but that is beyond me.
It only occurs with ES6 modules, using commonjs' require works fine. It also only occurs when I import both socket.io and express, commenting out either import allows the deasync call to run. Furthermore, not every module causes this. Of those I tested only these 2 cause the bug to occur, which I'd imagine has something to do with their dependencies.
But the plot thickens, if you wrap the deasync call in a setTimeout, even of 0ms, it runs fine. This of course defeats the entire purpose of deasync, but I had a sneaky suspicion this would work and to me it indicates a deeper origin of the issue within Node's execution scheduling.
Environment:
I'm not really expecting a solution that will allow me to use deasync for my project but I thought I'd post this here as it appears to be indicative of a much deeper problem. Love the idea of deasync by the way!
The text was updated successfully, but these errors were encountered: