facebook / idb

idb is a flexible command line interface for automating iOS simulators and devices
https://fbidb.io
MIT License
4.51k stars 432 forks source link

Unable to Terminate the launched app using Terminate command #740

Open amygithubrepo opened 2 years ago

amygithubrepo commented 2 years ago

Description

connected using idb connect 4e4021a96195d691814d9b700e6fxxxxab5417d

launched the app idb launch com.xxxxxxx.oxxxshdmobileapp

issued the command to terminate idb terminate com.xxxxxxx.oxxxshdmobileapp

            getting error
            No pid for com.xxxxxxx.oxxxshdmobileapp

Tried idb terminate com.xxxxxxx.oxxxshdmobileapp --udid 4e4021a96195d691814d9b700e6fxxxxab5417d

getting the error Traceback (most recent call last): File "/usr/local/lib/python3.9/site-packages/idb/grpc/client.py", line 188, in func_wrapper return await func(*args, **kwargs) File "/usr/local/lib/python3.9/site-packages/idb/grpc/client.py", line 487, in terminate await self.stub.terminate(TerminateRequest(bundle_id=bundle_id)) File "/usr/local/lib/python3.9/site-packages/grpclib/client.py", line 883, in call reply = await stream.recv_message() File "/usr/local/lib/python3.9/site-packages/grpclib/client.py", line 425, in recv_message await self.recv_initial_metadata() File "/usr/local/lib/python3.9/site-packages/grpclib/client.py", line 393, in recv_initial_metadata self._raise_for_grpc_status(status, message, details) File "/usr/local/lib/python3.9/site-packages/grpclib/client.py", line 345, in _raise_for_grpc_status raise GRPCError(status, message, details) grpclib.exceptions.GRPCError: (<Status.INTERNAL: 13>, 'No pid for com.microsoft.o365shdmobileapp', None)

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

Traceback (most recent call last): File "/usr/local/lib/python3.9/site-packages/idb/grpc/management.py", line 115, in from_udid yield client File "/usr/local/lib/python3.9/site-packages/idb/cli/init.py", line 67, in _get_client yield client File "/usr/local/lib/python3.9/site-packages/idb/cli/init.py", line 129, in _run_impl await self.run_with_client(args=args, client=client) File "/usr/local/lib/python3.9/site-packages/idb/cli/commands/app.py", line 94, in run_with_client await client.terminate(args.bundle_id) File "/usr/local/lib/python3.9/site-packages/idb/common/logging.py", line 113, in _async_wrapper raise ex File "/usr/local/lib/python3.9/site-packages/idb/common/logging.py", line 88, in _async_wrapper value = await function(*args, **kwargs) File "/usr/local/lib/python3.9/site-packages/idb/grpc/client.py", line 190, in func_wrapper raise IdbException(e.message) from e # noqa B306 idb.common.types.IdbException: No pid for com.microsoft.o365shdmobileapp

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/usr/local/lib/python3.9/site-packages/idb/cli/main.py", line 310, in gen_main await root_command.run(args) File "/usr/local/lib/python3.9/site-packages/idb/common/command.py", line 90, in run return await self.resolve_command_from_args(args).run(args) File "/usr/local/lib/python3.9/site-packages/idb/cli/init.py", line 107, in run await self._run_impl(args) File "/usr/local/lib/python3.9/site-packages/idb/cli/init.py", line 129, in _run_impl await self.run_with_client(args=args, client=client) File "/usr/local/Cellar/python@3.9/3.9.7/Frameworks/Python.framework/Versions/3.9/lib/python3.9/contextlib.py", line 199, in aexit await self.gen.athrow(typ, value, traceback) File "/usr/local/lib/python3.9/site-packages/idb/cli/init.py", line 67, in _get_client yield client File "/usr/local/Cellar/python@3.9/3.9.7/Frameworks/Python.framework/Versions/3.9/lib/python3.9/contextlib.py", line 231, in aexit raise RuntimeError("generator didn't stop after athrow()") RuntimeError: generator didn't stop after athrow() 2021-10-14 09:12:58,293 [ERROR] - asyncio - Task was destroyed but it is pending! task: <Task pending name='Task-3' coro=<()>>

Reproduction

connected using idb connect 4e4021a96195d691814d9b700e6fxxxxab5417d

launched the app idb launch com.xxxxxxx.oxxxshdmobileapp

issued the command to terminate idb terminate com.xxxxxxx.oxxxshdmobileapp

            getting error
            No pid for com.microsoft.o365shdmobileapp

Tried idb terminate com.xxxxxxx.oxxxshdmobileapp --udid 4e4021a96195d691814d9b700e6fxxxxab5417d getting the error

Solution

Additional Information

yuedongyin commented 2 years ago

i met the same issue on physical devices, but works on simulator.

amygithubrepo commented 2 years ago

Yes this error happens only on Physical device. For performance testing I need to kill and reopen the app programmatically. Kindly let me know if there is any solution for this.

amygithubrepo commented 2 years ago

I would like to know any solution for this issue.

fearless-taco commented 1 year ago

Same Issue for me today.