Stf: error: device not found

Created on 25 Nov 2016  路  12Comments  路  Source: openstf/stf


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.

Most helpful comment

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

All 12 comments

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.

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 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?

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

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 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

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

thanks @vbanthia is above request correct to reserve device?

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

@vbanthia is timeout in millsec?

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

Seems like this was solved.

Was this page helpful?
0 / 5 - 0 ratings