Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Socket is not closed after running IsInstalledCommand #526

Open
verakruhliakova opened this issue Feb 6, 2024 · 0 comments
Open

Socket is not closed after running IsInstalledCommand #526

verakruhliakova opened this issue Feb 6, 2024 · 0 comments

Comments

@verakruhliakova
Copy link

Calling device.isInstalled(pkg) leads to a socket leak.

If application calls this command in a loop, eventually app crashes with EMFILE: too many open files.

Checking occupied sockets shows that they hang in CLOSED state, but never actually released by the machine.

% lsof -i -l | grep "5037"
...
node    33919      503  188u  IPv4 0x359a2e226d9499af      0t0  TCP localhost:49446->localhost:5037 (CLOSED)
node    33919      503  189u  IPv4 0x359a2e226d6259af      0t0  TCP localhost:49364->localhost:5037 (CLOSED)
node    33919      503  190u  IPv4 0x359a2e226d8d8457      0t0  TCP localhost:49501->localhost:5037 (CLOSED)
node    33919      503  191u  IPv4 0x359a2e226d539457      0t0  TCP localhost:49648->localhost:5037 (CLOSED)
node    33919      503  192u  IPv4 0x359a2e226d2fef07      0t0  TCP localhost:49479->localhost:5037 (CLOSED)
node    33919      503  193u  IPv4 0x359a2e226d59ef07      0t0  TCP localhost:49400->localhost:5037 (CLOSED)
node    33919      503  194u  IPv4 0x359a2e226d63ff07      0t0  TCP localhost:49502->localhost:5037 (CLOSED)
node    33919      503  195u  IPv4 0x359a2e226d84d457      0t0  TCP localhost:49503->localhost:5037 (CLOSED)
node    33919      503  196u  IPv4 0x359a2e226d84c9af      0t0  TCP localhost:49450->localhost:5037 (CLOSED)
node    33919      503  197u  IPv4 0x359a2e226d0a3457      0t0  TCP localhost:49546->localhost:5037 (CLOSED)
...

Environment:
Node: v20.11.0
OS: MacOS 12.6.5

The reason to this issue is that command calls parser.readAscii() and never finishes reading the socket stream, which prevents socket from being closed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant