Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

urllib.error.URLError when running minimal_task_runner.py #206

Open
easonyang1996 opened this issue Jan 9, 2025 · 4 comments
Open

urllib.error.URLError when running minimal_task_runner.py #206

easonyang1996 opened this issue Jan 9, 2025 · 4 comments

Comments

@easonyang1996
Copy link

My Android Emulator was setup according to the given video.
When I started it via ~/Library/Android/sdk/emulator/emulator -avd $EMULATOR_NAME -no-snapshot -grpc 8554, the terminal showed:

(base) ➜  ~ ~/Library/Android/sdk/emulator/emulator -avd $EMULATOR_NAME -no-snapshot -grpc 8554
INFO    | Android emulator version 35.2.10.0 (build_id 12414864) (CL:N/A)
INFO    | Graphics backend: gfxstream
INFO    | Found systemPath /Users/easonyang/Library/Android/sdk/system-images/android-33/google_apis/x86_64/
INFO    | Duplicate loglines will be removed, if you wish to see each individual line launch with the -log-nofilter flag.
WARNING | Running on a system with less than 6 logical cores. Setting number of virtual cores to 1
INFO    | Warning: QMetaObject::connectSlotsByName: No matching signal for on_new_posture_requested(int) ((null):0, (null))

INFO    | Warning: QMetaObject::connectSlotsByName: No matching signal for on_dismiss_posture_selection_dialog() ((null):0, (null))

INFO    | Warning: QMetaObject::connectSlotsByName: No matching signal for on_new_resizable_requested(PresetEmulatorSizeType) ((null):0, (null))

INFO    | Warning: QMetaObject::connectSlotsByName: No matching signal for on_dismiss_resizable_dialog() ((null):0, (null))

INFO    | Warning: QMetaObject::connectSlotsByName: No matching signal for on_sleep_timer_done() ((null):0, (null))

INFO    | Warning: QMetaObject::connectSlotsByName: No matching signal for on_unfold_timer_done() ((null):0, (null))

INFO    | Storing crashdata in: /tmp/android-easonyang/emu-crash-35.2.10.db, detection is enabled for process: 8119
INFO    | Crash reports will be automatically uploaded to: https://clients2.google.com/cr/report
library_mode host gpu mode host
INFO    | Initializing hardware OpenGLES emulation support
android_startOpenglesRenderer: gpu infoGPU #1
  Make: 8086
  Model: 5927
  Device ID: 5927
GPU #2
  Make: 8086
  Model: 5927
  Device ID: 5927
I0109 18:00:59.026335 fe4e780 HealthMonitor.cpp:279] HealthMonitor disabled.
I0109 18:00:59.079269 fe4e780 FrameBuffer.cpp:522] Graphics Adapter Vendor Google (Intel Inc.)
I0109 18:00:59.079290 fe4e780 FrameBuffer.cpp:523] Graphics Adapter Android Emulator OpenGL ES Translator (Intel(R) Iris(TM) Plus Graphics 650)
I0109 18:00:59.079294 fe4e780 FrameBuffer.cpp:524] Graphics API Version OpenGL ES 3.0 (4.1 INTEL-20.6.4)
I0109 18:00:59.079297 fe4e780 FrameBuffer.cpp:525] Graphics API Extensions GL_OES_EGL_sync GL_OES_EGL_image GL_OES_EGL_image_external GL_OES_depth24 GL_OES_depth32 GL_OES_element_index_uint GL_OES_texture_float GL_OES_texture_float_linear GL_OES_compressed_paletted_texture GL_OES_compressed_ETC1_RGB8_texture GL_OES_depth_texture GL_OES_texture_npot GL_OES_rgb8_rgba8 GL_EXT_color_buffer_float GL_EXT_color_buffer_half_float GL_EXT_texture_format_BGRA8888 GL_APPLE_texture_format_BGRA8888 
I0109 18:00:59.079301 fe4e780 FrameBuffer.cpp:526] Graphics Device Extensions N/A
INFO    | Sending adb public key [QAAAAKvQKmD9VTWhd1ZHwyHWOoQpKscfTG2h/5CrV72OcMwQaRQizTlM6AIgIwB+UnWh2+Fo/I2gOGW816ELw+RMtEqzba17urIypxfrhH4DArhZNt8eqt8C8+QM47UhVnQKP3PLFq2NCMXUuCDo7AlQyd/CgnLajJIg2QRoMJIZeSbHEMELGQNqG+aqF1LHt/+ZQwe375mKJ/pLkak58C8TR7kMIUaaYte74suxPMv34VksmSZF5szFXPOTeVw1S3vJRk6BA7H2Z0D7T5YF1o2M8XqSJOip/Py75aunfEk9uIIvkSEZXnttr2awrM7JPUQpWvdzTCPjOXkpcq1EfHodPSCjhZibcyh8vvvi9lDbqGa7X5pYtTH91SFOCVEqelxVhEbPE6IxegoUbGz2iUi/GfPEs2I4BGzd43cbraTgaYFMu02BDW0YGHl+4BoCgUe8LRYENTAWIffdrd7eX0Zk6ku8GhTXfgabVoaTfkGQO+h8lpDyjanFhFR3JRSIp7C9u2BisBJQWJ0Gy47bBrFd/cBwDHjLinZ1VdyovCyUtTCpQYi+6sEhzhpW+eweo/iK7a54ZPrsmG4PRSSk7hSJ6nxX2dyzKw+RudE3xSAPpCQouUDeGPQoW5quEjQNqK1kztja1lSB2j7qzwsnpJ4Css8pNcRfulr2HwfxEDI9aXoyroEFYQEAAQA= easonyang@unknown]
INFO    | Monitoring duration of emulator setup.
INFO    | Using security allow list from: /Users/easonyang/Library/Android/sdk/emulator/lib/emulator_access.json
WARNING | *** No gRPC protection active, consider launching with the -grpc-use-jwt flag.***
INFO    | Started GRPC server at [::]:8554, security: Insecure, auth: none
INFO    | Advertising in: /Users/easonyang/Library/Caches/TemporaryItems/avd/running/pid_8119.ini
INFO    | Qemu slirp is disabled.
I0109 18:00:59.352364 cc5f000 FrameBuffer.cpp:2894] Setting display: 0 configuration to: 1080x2400, dpi: 420x420 
I0109 18:00:59.352397 cc5f000 FrameBuffer.cpp:2907] setDisplayActiveConfig 0
INFO    | Activated packet streamer for bluetooth emulation
INFO    | Boot completed in 88597 ms
INFO    | Increasing screen off timeout, logcat buffer size to 2M.
INFO    | Warning: Window position QRect(835,-72 460x972) outside any known screen, using primary screen ((null):0, (null))

INFO    | Warning: QMetaObject::connectSlotsByName: No matching signal for on_rgbcSensorValueWidget_valueChanged() ((null):0, (null))

INFO    | Warning: QMetaObject::connectSlotsByName: No matching signal for on_posture_valueChanged(int) ((null):0, (null))

INFO    | Did not find a vhal json

The emulator UI popped up “System UI isn't responding” repeatedly.
Then, I ran python minimal_task_runner.py --task=ContactsAddContact, I got:

(android_world) ➜  android_world-main python minimal_task_runner.py --task=ContactsAddContact
WARNING: All log messages before absl::InitializeLog() is called are written to STDERR
E0000 00:00:1736417786.251959  120671 trace.cc:89] Unknown tracer: none
Traceback (most recent call last):
  File "/Users/easonyang/anaconda3/envs/android_world/lib/python3.11/urllib/request.py", line 1348, in do_open
    h.request(req.get_method(), req.selector, req.data, headers,
  File "/Users/easonyang/anaconda3/envs/android_world/lib/python3.11/http/client.py", line 1298, in request
    self._send_request(method, url, body, headers, encode_chunked)
  File "/Users/easonyang/anaconda3/envs/android_world/lib/python3.11/http/client.py", line 1344, in _send_request
    self.endheaders(body, encode_chunked=encode_chunked)
  File "/Users/easonyang/anaconda3/envs/android_world/lib/python3.11/http/client.py", line 1293, in endheaders
    self._send_output(message_body, encode_chunked=encode_chunked)
  File "/Users/easonyang/anaconda3/envs/android_world/lib/python3.11/http/client.py", line 1052, in _send_output
    self.send(msg)
  File "/Users/easonyang/anaconda3/envs/android_world/lib/python3.11/http/client.py", line 990, in send
    self.connect()
  File "/Users/easonyang/anaconda3/envs/android_world/lib/python3.11/http/client.py", line 1470, in connect
    self.sock = self._context.wrap_socket(self.sock,
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/easonyang/anaconda3/envs/android_world/lib/python3.11/ssl.py", line 517, in wrap_socket
    return self.sslsocket_class._create(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/easonyang/anaconda3/envs/android_world/lib/python3.11/ssl.py", line 1104, in _create
    self.do_handshake()
  File "/Users/easonyang/anaconda3/envs/android_world/lib/python3.11/ssl.py", line 1382, in do_handshake
    self._sslobj.do_handshake()
ConnectionResetError: [Errno 54] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/easonyang/CMCC/Agent/AndroidWorld/android_world-main/minimal_task_runner.py", line 130, in <module>
    app.run(main)
  File "/Users/easonyang/anaconda3/envs/android_world/lib/python3.11/site-packages/absl_py-2.1.0-py3.11.egg/absl/app.py", line 308, in run
    _run_main(main, args)
  File "/Users/easonyang/anaconda3/envs/android_world/lib/python3.11/site-packages/absl_py-2.1.0-py3.11.egg/absl/app.py", line 254, in _run_main
    sys.exit(main(argv))
             ^^^^^^^^^^
  File "/Users/easonyang/CMCC/Agent/AndroidWorld/android_world-main/minimal_task_runner.py", line 126, in main
    _main()
  File "/Users/easonyang/CMCC/Agent/AndroidWorld/android_world-main/minimal_task_runner.py", line 88, in _main
    env = env_launcher.load_and_setup_env(
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/easonyang/CMCC/Agent/AndroidWorld/android_world-main/android_world/env/env_launcher.py", line 114, in load_and_setup_env
    env = _get_env(console_port, adb_path, grpc_port)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/easonyang/CMCC/Agent/AndroidWorld/android_world-main/android_world/env/env_launcher.py", line 35, in _get_env
    controller = android_world_controller.get_controller(
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/easonyang/CMCC/Agent/AndroidWorld/android_world-main/android_world/env/android_world_controller.py", line 322, in get_controller
    return AndroidWorldController(android_env_instance)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/easonyang/CMCC/Agent/AndroidWorld/android_world-main/android_world/env/android_world_controller.py", line 165, in __init__
    self._env = apply_a11y_forwarder_app_wrapper(
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/easonyang/CMCC/Agent/AndroidWorld/android_world-main/android_world/env/android_world_controller.py", line 138, in apply_a11y_forwarder_app_wrapper
    return a11y_grpc_wrapper.A11yGrpcWrapper(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/easonyang/anaconda3/envs/android_world/lib/python3.11/site-packages/android_env-1.2.2-py3.11.egg/android_env/wrappers/a11y_grpc_wrapper.py", line 121, in __init__
  File "/Users/easonyang/anaconda3/envs/android_world/lib/python3.11/site-packages/android_env-1.2.2-py3.11.egg/android_env/wrappers/a11y_grpc_wrapper.py", line 190, in _install_a11y_forwarding_apk
  File "/Users/easonyang/anaconda3/envs/android_world/lib/python3.11/site-packages/android_env-1.2.2-py3.11.egg/android_env/wrappers/a11y_grpc_wrapper.py", line 41, in _get_accessibility_forwarder_apk
  File "/Users/easonyang/anaconda3/envs/android_world/lib/python3.11/urllib/request.py", line 216, in urlopen
    return opener.open(url, data, timeout)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/easonyang/anaconda3/envs/android_world/lib/python3.11/urllib/request.py", line 519, in open
    response = self._open(req, data)
               ^^^^^^^^^^^^^^^^^^^^^
  File "/Users/easonyang/anaconda3/envs/android_world/lib/python3.11/urllib/request.py", line 536, in _open
    result = self._call_chain(self.handle_open, protocol, protocol +
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/easonyang/anaconda3/envs/android_world/lib/python3.11/urllib/request.py", line 496, in _call_chain
    result = func(*args)
             ^^^^^^^^^^^
  File "/Users/easonyang/anaconda3/envs/android_world/lib/python3.11/urllib/request.py", line 1391, in https_open
    return self.do_open(http.client.HTTPSConnection, req,
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/easonyang/anaconda3/envs/android_world/lib/python3.11/urllib/request.py", line 1351, in do_open
    raise URLError(err)
urllib.error.URLError: <urlopen error [Errno 54] Connection reset by peer>

Could you please help me solve above problem? Thanks a lot!

@easonyang1996
Copy link
Author

it seems like the program cannot visit https://storage.googleapis.com/android_env-tasks/2024.05.13-accessibility_forwarder.apk.
I will try to solve it by myself.

@easonyang1996
Copy link
Author

urllib.error.URLError is solved by setting https_proxy.
After that, I met a new error. Failed to connect to the emulator.

(android_world) ➜  android_world-main python minimal_task_runner.py --task=ContactsAddContact
WARNING: All log messages before absl::InitializeLog() is called are written to STDERR
E0000 00:00:1736420840.168693  156056 trace.cc:89] Unknown tracer: none

E0109 19:09:00.171226 140704737453952 emulator_simulator.py:351] Failed to connect to the emulator.
Traceback (most recent call last):
  File "/Users/easonyang/anaconda3/envs/android_world/lib/python3.11/site-packages/android_env-1.2.2-py3.11.egg/android_env/components/simulators/emulator/emulator_simulator.py", line 349, in _connect_to_emulator
    grpc.channel_ready_future(self._channel).result(timeout=timeout_sec)
  File "/Users/easonyang/CMCC/Agent/AndroidWorld/android_env-main/.eggs/grpcio-1.69.0-py3.11-macosx-10.9-x86_64.egg/grpc/_utilities.py", line 162, in result
    self._block(timeout)
  File "/Users/easonyang/CMCC/Agent/AndroidWorld/android_env-main/.eggs/grpcio-1.69.0-py3.11-macosx-10.9-x86_64.egg/grpc/_utilities.py", line 106, in _block
    raise grpc.FutureTimeoutError()
grpc.FutureTimeoutError
E0109 19:09:00.173593 140704737453952 base_simulator.py:81] Logfile does not exist: None.
Traceback (most recent call last):
  File "/Users/easonyang/anaconda3/envs/android_world/lib/python3.11/site-packages/android_env-1.2.2-py3.11.egg/android_env/components/simulators/emulator/emulator_simulator.py", line 349, in _connect_to_emulator
  File "/Users/easonyang/CMCC/Agent/AndroidWorld/android_env-main/.eggs/grpcio-1.69.0-py3.11-macosx-10.9-x86_64.egg/grpc/_utilities.py", line 162, in result
    self._block(timeout)
  File "/Users/easonyang/CMCC/Agent/AndroidWorld/android_env-main/.eggs/grpcio-1.69.0-py3.11-macosx-10.9-x86_64.egg/grpc/_utilities.py", line 106, in _block
    raise grpc.FutureTimeoutError()
grpc.FutureTimeoutError

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/Users/easonyang/anaconda3/envs/android_world/lib/python3.11/site-packages/android_env-1.2.2-py3.11.egg/android_env/components/simulators/base_simulator.py", line 78, in launch
  File "/Users/easonyang/anaconda3/envs/android_world/lib/python3.11/site-packages/android_env-1.2.2-py3.11.egg/android_env/components/simulators/emulator/emulator_simulator.py", line 239, in _launch_impl
  File "/Users/easonyang/anaconda3/envs/android_world/lib/python3.11/site-packages/android_env-1.2.2-py3.11.egg/android_env/components/simulators/emulator/emulator_simulator.py", line 352, in _connect_to_emulator
android_env.components.simulators.emulator.emulator_simulator.EmulatorBootError: Failed to connect to the emulator.

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/Users/easonyang/CMCC/Agent/AndroidWorld/android_world-main/minimal_task_runner.py", line 130, in <module>
    app.run(main)
  File "/Users/easonyang/anaconda3/envs/android_world/lib/python3.11/site-packages/absl_py-2.1.0-py3.11.egg/absl/app.py", line 308, in run
    _run_main(main, args)
  File "/Users/easonyang/anaconda3/envs/android_world/lib/python3.11/site-packages/absl_py-2.1.0-py3.11.egg/absl/app.py", line 254, in _run_main
    sys.exit(main(argv))
             ^^^^^^^^^^
  File "/Users/easonyang/CMCC/Agent/AndroidWorld/android_world-main/minimal_task_runner.py", line 126, in main
    _main()
  File "/Users/easonyang/CMCC/Agent/AndroidWorld/android_world-main/minimal_task_runner.py", line 88, in _main
    env = env_launcher.load_and_setup_env(
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/easonyang/CMCC/Agent/AndroidWorld/android_world-main/android_world/env/env_launcher.py", line 114, in load_and_setup_env
    env = _get_env(console_port, adb_path, grpc_port)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/easonyang/CMCC/Agent/AndroidWorld/android_world-main/android_world/env/env_launcher.py", line 35, in _get_env
    controller = android_world_controller.get_controller(
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/easonyang/CMCC/Agent/AndroidWorld/android_world-main/android_world/env/android_world_controller.py", line 320, in get_controller
    android_env_instance = loader.load(config)
                           ^^^^^^^^^^^^^^^^^^^
  File "/Users/easonyang/anaconda3/envs/android_world/lib/python3.11/site-packages/android_env-1.2.2-py3.11.egg/android_env/loader.py", line 63, in load
  File "/Users/easonyang/anaconda3/envs/android_world/lib/python3.11/site-packages/android_env-1.2.2-py3.11.egg/android_env/components/coordinator.py", line 82, in __init__
  File "/Users/easonyang/anaconda3/envs/android_world/lib/python3.11/site-packages/android_env-1.2.2-py3.11.egg/android_env/components/coordinator.py", line 141, in _launch_simulator
  File "/Users/easonyang/anaconda3/envs/android_world/lib/python3.11/site-packages/android_env-1.2.2-py3.11.egg/android_env/components/simulators/base_simulator.py", line 82, in launch
android_env.components.errors.SimulatorError: Exception caught in simulator. Please see the simulator logs above for more details.

@easonyang1996 easonyang1996 reopened this Jan 9, 2025
@crawles
Copy link
Collaborator

crawles commented Jan 10, 2025

This looks like an issue with the accessibility app connecting to the GRPC server running on python. If you use UI Automator instead, are you able to run the code and get observations? You can run UI Automator by using this enum in the constructor


If this works, it may be some connection issue regarding GRPC with your setup. Perhaps some ports are not allowed

@Incredible61
Copy link

This looks like an issue with the accessibility app connecting to the GRPC server running on python. If you use UI Automator instead, are you able to run the code and get observations? You can run UI Automator by using this enum in the constructor 这看起来像是连接到在 python 上运行的 GRPC 服务器的辅助功能应用程序存在问题。如果您改用 UI Automator,是否能够运行代码并获取观察结果?您可以通过在构造函数中使用此枚举来运行 UI Automator

android_world/android_world/env/android_world_controller.py

Line 132 in ef5cfc7

UIAUTOMATOR = 'uiautomator'

If this works, it may be some connection issue regarding GRPC with your setup. Perhaps some ports are not allowed
如果这有效,则可能是您的 GRPC 与你的设置存在一些连接问题。也许某些端口是不允许的

Hello, after I switched to using UI Automator, I only managed to run python minimal_task_runner.py --task=ContactsAddContact successfully for the first time. After that, running it again still gives the same error log. Here is what I changed in android_world_controller.py
Appreciate for any help~

Image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants