stf icon indicating copy to clipboard operation
stf copied to clipboard

error: device not found

Open tadesushilgithub opened this issue 10 years ago • 12 comments

We are consuming remote device id as android device id after doing adb connect. It works for some test then it get disconnected.

What is the issue or idea you have?

  • Device is getting disconnected frequently.

Does it only happen on a specific device? Please run adb devices -l and paste the corresponding row.

  • It's not about specific device.

Please provide the steps to reproduce the issue. Steps: 1- open stf 2- adb connect x.x.x.x:xxxx (Remote debug) 3- adb devices (this get listed) 4- We ran automated test which took 7 hours to complete some test suites take 15 hr to complete 5- Did multiple run facing error : device not found 6- adb devices (no entry found under this)

What is the expected behavior?

  • This should not get disconnected. Is it wireless adb? Is this not reliable?

Do you see errors or warnings in the stf local output? If so, please paste them or the full log here. Not sure I am user of stf

Please run stf doctor and paste the output here.

tadesushilgithub avatar Nov 25 '16 08:11 tadesushilgithub

Maybe it's timing out? If the adb socket doesn't see traffic going into the device for a while, it'll disconnect. The timeout can't be disabled completely, but you can use a ridiculously large value for the same effect. Try stf local -t 86400 for a 24h timeout.

sorccu avatar Nov 25 '16 08:11 sorccu

By default device will disconnect in 15 mins if kept idle (No UI activity). You will have to set timeout more than 15 mins while asking for device i.e calling reserve device endpoint.

curl -X POST --header "Content-Type: application/json" --data '{"serial":"xxx", "timeout": 900000}' -H "Authorization: Bearer YOUR-TOKEN-HERE" https://stf.example.org/api/v1/user/devices

vbanthia-zz avatar Nov 25 '16 08:11 vbanthia-zz

@vbanthia Is this web session timeout? or adb timeout? Because I ran automated test cases for 4 hr 42 min that time device was alive. But adb disconnect is sporadic. let me check while reserving device if I configure maximum timeout how it helps?

tadesushilgithub avatar Nov 25 '16 12:11 tadesushilgithub

@vbanthia getting exception {"message":"Unexpected token '","body":"'{serial:c8ee0c840836f31a,timeout:86400} '","status":400}

tadesushilgithub avatar Nov 25 '16 14:11 tadesushilgithub

This is not web session or user session timeout. It is device timeout, meaning user will not be able to use that device if kept idle for timeout period.

If disconnections are sporadic then it may be because of network issue or something else. Logs can help in diagnosis. Also, will not suggest to run long test suites in one go. Better to divide into smaller one.

Regarding error, can you write what request you used to reserve device?

vbanthia-zz avatar Nov 25 '16 15:11 vbanthia-zz

@vbanthia Can I override the timeout while reserving the device?

Please find below request :

curl -X POST --header "Content-Type:application/json" --data '{"serial":"c8ee0c840836f31a","timeout":"86400"}' -H "Authorization: Bearer MY_TOKEN" http://stfurl/api/v1/user/devices

tadesushilgithub avatar Nov 25 '16 16:11 tadesushilgithub

yes, you can override timeout while requesting for a device. timeout is in msec, so take care about that.

vbanthia-zz avatar Nov 25 '16 16:11 vbanthia-zz

thanks @vbanthia is above request correct to reserve device?

tadesushilgithub avatar Nov 25 '16 16:11 tadesushilgithub

You need to replace MY_TOKEN with your stf api access token.

vbanthia-zz avatar Nov 25 '16 16:11 vbanthia-zz

@vbanthia is timeout in millsec?

tadesushilgithub avatar Nov 29 '16 14:11 tadesushilgithub

CLI is in seconds, @vbanthia said that the API is in ms.

sorccu avatar Nov 29 '16 14:11 sorccu

Seems like this was solved.

sorccu avatar Sep 05 '17 14:09 sorccu