profilo icon indicating copy to clipboard operation
profilo copied to clipboard

Can not get trace.log on Lolipop devices?

Open Quang0309 opened this issue 8 years ago • 8 comments

I encounter error "run-as: exec failed for find Error:Permission denied was moved. Retrying..." when using real devices running lolipop. Does profilo only support 6.0 and above?

Quang0309 avatar Jul 27 '18 10:07 Quang0309

Profilo should work fine for versions < 6.

This error happens because the find command found a trace in /data/data/<your_app>/cache but it was moved to /data/data/<your_app>/cache/upload (or vice versa) by the time we actually tried to use it. However, the number of times it can move from one directory to another is finite (just once or twice), so we retry in a loop until we succeed.

This is what should happen:

python -m profilo.profilo pull_last_trace com.facebook.profilo.sample
File /data/data/com.facebook.profilo.sample/./cache/upload/override-xxxxxxx.log was moved. Retrying...
override-xxxxxxx.log  <---- This means the file was successfully downloaded from the device

Basically, we retry a few times (just once in this case) and eventually succeed and download the trace from the device.

Is this not what happened in your case? Did you not eventually get the trace?

ricardorey10 avatar Jul 27 '18 18:07 ricardorey10

screenshot from 2018-07-30 11-52-48 It keeps looping forever

Quang0309 avatar Jul 28 '18 01:07 Quang0309

The problem because these devices i have dont have find command, so i try to modify _GET_TRACES_CMD in device.py screenshot from 2018-07-30 18-23-46

And the result is that it keeps retrying forever screenshot from 2018-07-30 18-35-02

Quang0309 avatar Jul 30 '18 11:07 Quang0309

Ugh, I had never seen find fail. Anyway...

I just made a change so that we'll default to using find and then fall back to ls -R if find fails. You should see it in a little while.

Note that what you're doing is almost correct: the problem is that you're using ls -lR, and the -l flag causes a bunch of metadata about the file (permissions, ownership, etc.) to be printed as part of the output. So, instead of getting just the file name, you get something like -rw------- <file_name>, which we can't cat. Also, if the file is not in the current directory, you need to prepend the full path name, which is also missing from what you're doing here.

I'll update this again once my fix lands here.

ricardorey10 avatar Jul 30 '18 23:07 ricardorey10

There you go. You should now be able to download traces using ls -R if your device doesn't support find.

ricardorey10 avatar Jul 31 '18 00:07 ricardorey10

Thank you for your help, i get the newest release and try to run it but the exception you just added except subprocess.CalledProcessError as e can not catch the error find command not found,.

If i run _GET_TRACES_CMD_LS as default, it works well but then i find that the stat command is also like the find command, it do not appear on every devices, so i got the error screenshot from 2018-08-01 14-50-44 I test on three different real devices running on 5.1.1, so i am surprised that you didnt meet these errors. Anyway i very appreciate your quick response.

Quang0309 avatar Aug 01 '18 07:08 Quang0309

i managed to fix this error using date -r <path> +%s instead, but i meet strange error in the pwd command. screenshot from 2018-08-01 18-30-42 screenshot from 2018-08-01 18-31-18 Do def _get_data_dir_full_path(package) always return **/data/data/ ?

Quang0309 avatar Aug 01 '18 11:08 Quang0309

Do def _get_data_dir_full_path(package) always return **/data/data/ ?

It does in every device I've tested this - though, as you're already noticing, there's way too many combinations of models/versions to try them all -. We even hardcode this assumption:

full_path = "/data/data/{package}/{path}".format(

ricardorey10 avatar Aug 01 '18 15:08 ricardorey10