android-perf-testing icon indicating copy to clipboard operation
android-perf-testing copied to clipboard

Windows - Error running systrace: close_fds is not supported on Windows platforms if you redirect stdin/stdout/stderr

Open kashban opened this issue 7 years ago • 7 comments

This happens when I try to run the command given in Step 5:

python %ANDROID_HOME%/platform-tools/systrace/systrace.py --time=10 -o %userprofile%/trace.html gfx view res

Full stacktrace:

CRITICAL:root:(TimeoutThread-1-for-MainThread) Exception on _RunAdbCmd(<class 'devil.android.sdk.adb_wrapper.AdbWrapper'>, ['devices'], retries=2, timeout=30), attempt 1 of 3: ValueError('close_fds is not supported on Windows platforms if you redirect stdin/stdout/stderr',)
CRITICAL:root:(TimeoutThread-2-for-MainThread) Exception on _RunAdbCmd(<class 'devil.android.sdk.adb_wrapper.AdbWrapper'>, ['devices'], retries=2, timeout=30), attempt 2 of 3: ValueError('close_fds is not supported on Windows platforms if you redirect stdin/stdout/stderr',)
Traceback (most recent call last):
  File "C:\Users\jwahlmann\android-sdks/platform-tools/systrace/systrace.py", line 49, in <module>
    sys.exit(run_systrace.main())
  File "C:\Users\jwahlmann\android-sdks\platform-tools\systrace\catapult\systrace\systrace\run_systrace.py", line 194, in main
    main_impl(sys.argv)
  File "C:\Users\jwahlmann\android-sdks\platform-tools\systrace\catapult\systrace\systrace\run_systrace.py", line 155, in main_impl
    devices = [a.GetDeviceSerial() for a in adb_wrapper.AdbWrapper.Devices()]
  File "C:\Users\jwahlmann\android-sdks\platform-tools\systrace\catapult\systrace\systrace\..\..\devil\devil\android\sdk\adb_wrapper.py", line 363, in Devices
    retries=retries)
  File "C:\Users\jwahlmann\android-sdks\platform-tools\systrace\catapult\systrace\systrace\..\..\devil\devil\android\sdk\adb_wrapper.py", line 383, in _RawDevices
    output = cls._RunAdbCmd(cmd, timeout=timeout, retries=retries)
  File "C:\Users\jwahlmann\android-sdks\platform-tools\systrace\catapult\systrace\systrace\..\..\devil\devil\android\decorators.py", line 57, in timeout_retry_wrapper
    retry_if_func=retry_if_func)
  File "C:\Users\jwahlmann\android-sdks\platform-tools\systrace\catapult\systrace\systrace\..\..\devil\devil\utils\timeout_retry.py", line 159, in Run
    error_log_func=error_log_func)
  File "C:\Users\jwahlmann\android-sdks\platform-tools\systrace\catapult\systrace\systrace\..\..\devil\devil\utils\reraiser_thread.py", line 186, in JoinAll
    self._JoinAll(watcher, timeout)
  File "C:\Users\jwahlmann\android-sdks\platform-tools\systrace\catapult\systrace\systrace\..\..\devil\devil\utils\reraiser_thread.py", line 158, in _JoinAll
    thread.ReraiseIfException()
  File "C:\Users\jwahlmann\android-sdks\platform-tools\systrace\catapult\systrace\systrace\..\..\devil\devil\utils\reraiser_thread.py", line 81, in run
    self._ret = self._func(*self._args, **self._kwargs)
  File "C:\Users\jwahlmann\android-sdks\platform-tools\systrace\catapult\systrace\systrace\..\..\devil\devil\utils\timeout_retry.py", line 152, in <lambda>
    child_thread = reraiser_thread.ReraiserThread(lambda: func(*args, **kwargs),
  File "C:\Users\jwahlmann\android-sdks\platform-tools\systrace\catapult\systrace\systrace\..\..\devil\devil\android\decorators.py", line 47, in impl
    return f(*args, **kwargs)
  File "C:\Users\jwahlmann\android-sdks\platform-tools\systrace\catapult\systrace\systrace\..\..\devil\devil\android\sdk\adb_wrapper.py", line 249, in _RunAdbCmd
    timeout_retry.CurrentTimeoutThreadGroup().GetRemainingTime())
  File "C:\Users\jwahlmann\android-sdks\platform-tools\systrace\catapult\systrace\systrace\..\..\devil\devil\utils\cmd_helper.py", line 313, in GetCmdStatusAndOutputWithTimeout
    stderr=subprocess.STDOUT)
  File "C:\Users\jwahlmann\android-sdks\platform-tools\systrace\catapult\systrace\systrace\..\..\devil\devil\utils\cmd_helper.py", line 105, in Popen
    shell=shell, close_fds=True, env=env, preexec_fn=preexec_fn)
  File "C:\Python27\lib\subprocess.py", line 668, in __init__
    raise ValueError("close_fds is not supported on Windows "
ValueError: close_fds is not supported on Windows platforms if you redirect stdin/stdout/stderr

Any hint on how to solve this?

kashban avatar Jul 05 '17 08:07 kashban

Addendum: It's working when run from Android Studio's device monitor.

kashban avatar Jul 06 '17 07:07 kashban

I am too getting the same scenario. Any help will be appreciated.

barbieshaily avatar Aug 17 '17 08:08 barbieshaily

I ran it from Android Studio Terminal, but still it fails File "C:\Users\padhy\AppData\Local\Android\sdk1\platform-tools\systrace\catapult\systrace\systrace....\devil\devil\utils\cmd_helper.py", line 105, in Popen shell=shell, close_fds=True, env=env, preexec_fn=preexec_fn) File "C:\Python27\lib\subprocess.py", line 347, in init raise ValueError("close_fds is not supported on Windows " ValueError: close_fds is not supported on Windows platforms if you redirect stdin/stdout/stderr

brajabasi avatar Aug 26 '17 13:08 brajabasi

I don't remember exactly but it is related to the python version you use

jgiraudel-regie avatar Sep 26 '17 16:09 jgiraudel-regie

any update here? or is the systrace not usable on windows?

bhosle-git avatar Dec 11 '17 19:12 bhosle-git

any update?

bhavincb avatar Apr 09 '18 09:04 bhavincb

I have the same problem . anyone fixed it ?

tangyong3g avatar Oct 30 '18 12:10 tangyong3g