client.trackDevices() occur ECONNRESET error after unplug, then plug in phone again.
My source code like bellow: var adb = require('adbkit') var client = adb.createClient('localhost', '5037', adbbinarytool )
client.trackDevices() .then(function(tracker) { tracker.on('add', function(device) { console.log('Device %s was plugged in', device.id) }) tracker.on('remove', function(device) { console.log('Device %s was unplugged', device.id) }) tracker.on('end', function() { console.log('Tracking stopped') }) }) .catch(function(err) { console.error('Something went wrong:', err.stack) })
Step1: Plug in a phone; Step2: Start above code project; Step3: Log 'Device %s was plugged in' is shown on console; Step4: Unplug the phone, log Device %s was unplugged is shown on console; Step5: Plugin the phone again, error occurs:
Not 100% issue, but often.
read ECONNRESET: Error: read ECONNRESET at exports._errnoException (util.js:1050:11) at TCP.onread (net.js:581:26)
Supplement:
- Huawei Phones;
- Nodejs version: v8.9.3
- Win7 64bits.
Sounds like an issue with ADB itself. Seems to me like it’s dying when that happens.
Hi Sorccu, yes, the adb client is dead when this error occurs. The adb version: Android Debug Bridge version 1.0.39 Version 27.0.0-4455170.
By the way, I run adbkit in Eelectron process.
Sorry, correct the version information, it is "Revision 3db08f2c6889-android" in fact.
You should try to figure out why your adb process dies. Perhaps the ADB_TRACE environment variable will help.
Hi Sorccu, there is no ADB_TRACE var in my environment when this error occurs.
That's not what I meant. Start your adb with ADB_TRACE (Google the value you should use) and try to figure out why it's dying. I really don't think this is an issue with adbkit.
I also had the same problem on window.
Error: read ECONNRESET
at TCP.onStreamRead (internal/stream_base_commons.js:209:20)
Emitted 'error' event on Connection instance at:
at Connection._handleError (C:\Program Files\xxxxxx\node_modules\adbkit\lib\adb\connection.js:99:12)
at Socket.
My opinion is even tough adb server is killed, electron app shoud be alive. Can you have any idea to save electron app even if adb server is killed??