TeamFightTacticsBots / Alune

Mobile TFT Bot - Automate Teamfight Tactics in the mobile version through emulators, to farm pass exp and event tokens.
GNU Affero General Public License v3.0
45 stars 5 forks source link

Connecting Timeout Error #33

Closed Haonan-Jiang closed 1 month ago

Haonan-Jiang commented 1 month ago

I am using bluestacks and made sure to enable adb with port 5555, however, I got the following error message: Traceback (most recent call last): File "C:\Users\Haonan\AppData\Local\Programs\Python\Python312\Lib\site-packages\adb_shell\transport\tcp_transport_async.py", line 79, in connect self._reader, self._writer = await asyncio.open_connection(self._host, self._port) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\Haonan\AppData\Local\Programs\Python\Python312\Lib\asyncio\streams.py", line 48, in openconnection transport, = await loop.create_connection( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\Haonan\AppData\Local\Programs\Python\Python312\Lib\asyncio\base_events.py", line 1103, in create_connection sock = await self._connect_sock( ^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\Haonan\AppData\Local\Programs\Python\Python312\Lib\asyncio\base_events.py", line 1006, in _connect_sock await self.sock_connect(sock, address) File "C:\Users\Haonan\AppData\Local\Programs\Python\Python312\Lib\asyncio\proactor_events.py", line 729, in sock_connect return await self._proactor.connect(sock, address) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ asyncio.exceptions.CancelledError

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "C:\Users\Haonan\AppData\Local\Programs\Python\Python312\Lib\site-packages\adb_shell\transport\tcp_transport_async.py", line 78, in connect async with async_timeout.timeout(transport_timeout_s): File "C:\Users\Haonan\AppData\Local\Programs\Python\Python312\Lib\site-packages\async_timeout__init.py", line 141, in aexit self._do_exit(exc_type) File "C:\Users\Haonan\AppData\Local\Programs\Python\Python312\Lib\site-packages\async_timeout\init__.py", line 228, in _do_exit raise asyncio.TimeoutError TimeoutError

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

Traceback (most recent call last): File "C:\Users\Haonan\Desktop\Alune-main\Alune-main\main.py", line 450, in asyncio.run(main()) File "C:\Users\Haonan\AppData\Local\Programs\Python\Python312\Lib\asyncio\runners.py", line 194, in run return runner.run(main) ^^^^^^^^^^^^^^^^ File "C:\Users\Haonan\AppData\Local\Programs\Python\Python312\Lib\asyncio\runners.py", line 118, in run return self._loop.run_until_complete(task) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\Haonan\AppData\Local\Programs\Python\Python312\Lib\asyncio\base_events.py", line 687, in run_until_complete return future.result() ^^^^^^^^^^^^^^^ File "C:\Users\Haonan\Desktop\Alune-main\Alune-main\main.py", line 436, in main await adb_instance.load(config.get_adb_port()) File "C:\Users\Haonan\Desktop\Alune-main\Alune-main\alune\adb.py", line 47, in load await self._connect_to_device(port) File "C:\Users\Haonan\Desktop\Alune-main\Alune-main\alune\adb.py", line 75, in _connect_to_device connection = await device.connect(rsa_keys=[self._rsa_signer], auth_timeout_s=1) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\Haonan\AppData\Local\Programs\Python\Python312\Lib\site-packages\adb_shell\adb_device_async.py", line 714, in connect self._available, self._maxdata = await self._io_manager.connect(self._banner, rsa_keys, auth_timeout_s, auth_callback, adb_info) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\Haonan\AppData\Local\Programs\Python\Python312\Lib\site-packages\adb_shell\adb_device_async.py", line 258, in connect await self._transport.connect(adb_info.transport_timeout_s) File "C:\Users\Haonan\AppData\Local\Programs\Python\Python312\Lib\site-packages\adb_shell\transport\tcp_transport_async.py", line 82, in connect raise TcpTimeoutException(msg) from exc adb_shell.exceptions.TcpTimeoutException: Connecting to localhost:5555 timed out (9 seconds)

Could you help with identifying where could go wrong?

akshualy commented 1 month ago

If you go to your BlueStacks settings (three lines top right), then to advanced, the second option should be about ADB. Are you sure it's turned on and stating that it's listening on port 5555? BlueStacks tends to have it disabled by default and listen to a different port.

Haonan-Jiang commented 1 month ago

Hi, thank you for your reply. The adb is on and on port 5555. image PS C:\Users\Haonan\Desktop> netstat -fnao | findstr 5555 TCP 127.0.0.1:5555 0.0.0.0:0 LISTENING 103896 I also verified that it is listening on port 5555

Haonan-Jiang commented 1 month ago

Update: After reinstalling bluestacks, the error disappears. Not sure what went wrong though.

akshualy commented 1 month ago

Yeah, ADB can be a bit iffy sometimes. I'm glad it fixed itself, I'll be adding some form of automated diagnostic in the near future for easier trouble shooting.