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

Process fails to quit due to issue in opening and ending logcat #22

Open
eliperelman opened this issue Jan 14, 2015 · 4 comments
Open

Comments

@eliperelman
Copy link

Switching over from adbkit-logcat to adbkit, and my Node.js process fails to quit because something in logcat must still be in the stack. Previously this wasn't an issue in adbkit-logcat as it's recommended you kill the stream process upon exit, but I don't see a way to access the logcat process using the mechanisms provided by adbkit. The stream end method does not let the process end. Using the following reduced test case:

var adb = require('adbkit');
var client = adb.createClient();

client.listDevices()
  .then(function(devices) {
    var deviceId = devices[0].id;

    client.openLogcat(deviceId)
      .then(function(logcat) {
        setTimeout(function() {
          console.log('ending logcat');
          logcat.end();
        }, 5000);
      });
  });
@eliperelman
Copy link
Author

Running with DEBUG=* shows nothing in the console when .ending the logcat:

adb:command Send '000Chost:devices' +0ms
adb:command Send '0017host:transport:94fdce73' +3ms
adb:command Send '001Fshell:logcat -B *:I 2>/dev/null' +1ms

@sorccu
Copy link
Member

sorccu commented Jan 14, 2015

Hi,

Thanks for letting me know. I will check this today.

On Wednesday, January 14, 2015, Eli Perelman [email protected]
wrote:

Running with DEBUG=* shows nothing in the console when .ending the logcat:

adb:command Send '000Chost:devices' +0ms
adb:command Send '0017host:transport:94fdce73' +3ms
adb:command Send '001Fshell:logcat -B *:I 2>/dev/null' +1ms


Reply to this email directly or view it on GitHub
#22 (comment).

@eliperelman
Copy link
Author

On OS X, using nettop:

adb.724                                                                                           84 B
    tcp4 127.0.0.1:5037<->localhost:58777                            lo0     Established          62 B
    tcp4 127.0.0.1:56672<->*:*                                       lo0          Listen
    tcp4 127.0.0.1:56522<->*:*                                       lo0          Listen
    tcp4 127.0.0.1:56519<->*:*                                       lo0          Listen
    tcp4 127.0.0.1:5037<->localhost:49616                            lo0     Established          22 B
    tcp4 127.0.0.1:5037<->*:*                                        lo0          Listen

Looks like after killing the Node.js process, the Net connections are still present. Running adb kill-server has cleared them up.

@sorccu
Copy link
Member

sorccu commented Jan 14, 2015

This seems to be due to a misunderstanding on my part. Calling .end() on a pipe target doesn't end the source stream. Will patch soonish.

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

2 participants