Skip to content

Adding a non-returning command to a shell will trigger terminated timeout exception, even though it's not actually terminated.  #45

Description

@GoogleCodeExporter
What steps will reproduce the problem?
1. make a custom command:

            Command command = new Command(0, "tcpdump -nw /sdcard/test.cap") {

                @Override
                public void commandOutput(int id, String line)
                {
                }

                @Override
                public void commandCompleted(int id, int exitcode) {
                }

                @Override
                public void commandTerminated(int id, String reason) {
                    Toast.makeText(getApplicationContext(), "TCPdump was terminated. Reason:\n" + reason, Toast.LENGTH_LONG).show();
                }

            };

2. Make sure we don't have a custom shell running, then make custom shell (also 
happens with root shell btw), with infinite timeout (or say 99999999), and run 
it:

RootTools.closeCustomShell();
RootTools.getCustomShell("su", 0).add(command);


3. and wait..


What is the expected output? What do you see instead?

- Expected output: to not have the commandTerminated handler be called with a 
Timeout Exception.

- seen instead: the commandTerminated handler was called with a Timeout 
Exception. Exactly 20 seconds after the above code was called.


What is more, the tcpdump process wasn't actually killed:

# before running the above code:
shell@android:/ # ps | grep tcpdump
<no output>

# running code, before timeout exception:
root      31082 31072 3248   876   c0435ed4 40124b2c S 
/data/data/net.teclo.NeTrace/app_bins/tcpdump

# running code, after timeout exception:
shell@android:/ # ps | grep tcpdump
root      31082 31072 3248   876   c0435ed4 40124b2c S 
/data/data/net.teclo.NeTrace/app_bins/tcpdump


And handily I could also verify the resulting captures, and they showed the 
same data as the control capture.


What version of the product are you using? On what operating system?

This was on CyanogenMod, Android 4.2.2, roottools 3.0 and 3.1.


Cheers!

Original issue reported on code.google.com by cjst...@gmail.com on 30 Jul 2013 at 2:49

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions