Jack server failed to (re)start - android

I am trying a build of Android N, but I am constantly getting this error :
15:37:13 FAILED: /bin/bash -c "(prebuilts/sdk/tools/jack-admin install-server prebuilts/sdk/tools/jack-launcher.jar prebuilts/sdk/tools/jack-server-4.8.ALPHA.jar 2>&1 || (exit 0) ) && (JACK_SERVER_VM_ARGUMENTS=\"-Dfile.encoding=UTF-8 -XX:+TieredCompilation\" prebuilts/sdk/tools/jack-admin start-server 2>&1 || exit 0 ) && (prebuilts/sdk/tools/jack-admin update server prebuilts/sdk/tools/jack-server-4.8.ALPHA.jar 4.8.ALPHA 2>&1 || exit 0 ) && (prebuilts/sdk/tools/jack-admin update jack prebuilts/sdk/tools/jacks/jack-2.28.RELEASE.jar 2.28.RELEASE || exit 47; prebuilts/sdk/tools/jack-admin update jack prebuilts/sdk/tools/jacks/jack-3.36.CANDIDATE.jar 3.36.CANDIDATE || exit 47; prebuilts/sdk/tools/jack-admin update jack prebuilts/sdk/tools/jacks/jack-4.7.BETA.jar 4.7.BETA || exit 47 )"
15:37:13 Jack server already installed in "/srv/jenkins/.jack-server"
15:37:13 Launching Jack server java -XX:MaxJavaStackTraceDepth=-1 -Djava.io.tmpdir=/tmp -Dfile.encoding=UTF-8 -XX:+TieredCompilation -cp /srv/jenkins/.jack-server/launcher.jar com.android.jack.launcher.ServerLauncher
15:37:13 Jack server failed to (re)start, try 'jack-diagnose' or see Jack server log
15:37:13 No Jack server running. Try 'jack-admin start-server'
15:37:13 No Jack server running. Try 'jack-admin start-server'
I put some logs in the jack-admin code and I am getting the following error, when I do ./jack-admin start-server.
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0curl: (7) Failed to connect to 127.0.0.1 port 8077: No route to host
isServerRunning : Curl code : 7
Launching Jack server java -XX:MaxJavaStackTraceDepth=-1 -Djava.io.tmpdir=/tmp -Dfile.encoding=UTF-8 -XX:+TieredCompilation -cp /srv/jenkins/.jack-server/launcher.jar com.android.jack.launcher.ServerLauncher
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0curl: (7) Failed to connect to 127.0.0.1 port 8077: No route to host
waitServerStarted : curl code : 7
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0curl: (7) Failed to connect to 127.0.0.1 port 8077: No route to host
waitServerStarted : curl code : 7
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0curl: (7) Failed to connect to 127.0.0.1 port 8077: No route to host
Can someone please help?
EDIT
Jack server logs are clean, there are no exceptions or errors.
The default ports 8076 and 8077 get blocked as seen in netstat -nlp, which indicates the server is indeed started.
tcp6 0 0 127.0.0.1:8076 :::* LISTEN 19180/java
tcp6 0 0 127.0.0.1:8077 :::* LISTEN 19180/java
The machine I am building the code upon, is behind a proxy.

When I was getting Curl error 7 it was accompanied by an SSL error when running jack-diagnose. The following solution worked for me:
Edit java.security file under /etc/java-8-openjdk/security/
Remove TLSv1, TLSv1.1 from jdk.tls.disabledAlgorithms
Restart the jack server:
cd <your-aosp-home-dir>/prebuilts/sdk/tools/
./jack-admin kill-server
./jack-admin start-server

Try changing service and admin ports both in .jack-settings and .jack-server/config.properties and make sure they match.
Jack server may not be able to use the default ports, especially if you are on a server machine where there are more than one user trying to use Jack.

Related

Rebuild android code with error “SSL error when connecting to the Jack server. Try 'jack-diagnose”

System: ubuntu 18.04
environment:VirtualBox
The first time I compiled the AOSP source code on Ubuntu 18.04, it passed, and the second time I compiled it failed.
Here is an error message.
[ 10% 538/4980] Ensuring Jack server is installed and started
FAILED: setup-jack-server
/bin/bash -c "(prebuilts/sdk/tools/jack-admin install-server prebuilts/sdk/tools/jack-launcher.jar prebuilts/sdk/tools/jack-server-4.11.ALPHA.jar 2>&1 || (exit 0) ) && (JACK_SERVER_VM_ARGUMENTS=\"-Dfile.encoding=UTF-8 -XX:+TieredCompilation\" prebuilts/sdk/tools/jack-admin start-server 2>&1 || exit 0 ) && (prebuilts/sdk/tools/jack-admin update server prebuilts/sdk/tools/jack-server-4.11.ALPHA.jar 4.11.ALPHA 2>&1 || exit 0 ) && (prebuilts/sdk/tools/jack-admin update jack prebuilts/sdk/tools/jacks/jack-4.32.CANDIDATE.jar 4.32.CANDIDATE || exit 47 )"
Jack server already installed in "/home/user/.jack-server"
Communication error with Jack server (35), try 'jack-diagnose' or see Jack server log
SSL error when connecting to the Jack server. Try 'jack-diagnose'
SSL error when connecting to the Jack server. Try 'jack-diagnose'
[ 10% 541/4980] build out/target/product/rk3399_mid/obj/ETC/precompiled_sepolicy_intermediates/precompiled_sepolicy
ninja: build stopped: subcommand failed.
22:32:18 ninja failed with: exit status 1
#### failed to build some targets (01:11 (mm:ss)) ####
Build android failed!
Generate error reports
/prebuilts/sdk/tools/report/18577$ unzip jack-report.18557.zip
Archive: jack-report.18557.zip
inflating: report.18557.txt
inflating: launcher.jar
inflating: config.properties
creating: logs/
inflating: logs/outputs.txt
inflating: logs/jack-server-0-2.log
inflating: logs/jack-server-1-0.log
inflating: logs/jack-server-0-0.log
extracting: logs/jack-server-0-0.log.lck
inflating: logs/jack-server-0-1.log
inflating: server-1.jar
creating: jack/
report.18557.txt :
ps -o "pid args" | grep com.android.jack.launcher.ServerLauncher | grep -v grep | awk '{print dump-report}' | xargs kill -3
$ id -u
1000
$ ps -A -o "uid pid args" | grep com.android.jack.launcher.ServerLauncher | grep -v grep
1000 6708 java -XX:MaxJavaStackTraceDepth=-1 -Djava.io.tmpdir=/tmp -Dfile.encoding=UTF-8 -XX:+TieredCompilation -cp /home/zhangying/.jack-server/launcher.jar com.android.jack.launcher.ServerLauncher
$ lsof -i TCP:8376 -l
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
java 6708 1000 21u IPv6 58493 0t0 TCP localhost:8376 (LISTEN)
$ lsof -i TCP:8377 -l
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
java 6708 1000 23u IPv6 58499 0t0 TCP localhost:8377 (LISTEN)
$ cat "$JACK_CLIENT_SETTING"
# Server settings
SERVER_HOST=localhost
SERVER_PORT_SERVICE=8376
SERVER_PORT_ADMIN=8377
# Internal, do not touch
SETTING_VERSION=4
$ cd "$JACK_HOME"; ls -l -R -n .
.:
total 10412
-rw------- 1 1000 1000 2097 May 2 10:04 client.jks
-rw------- 1 1000 1000 2814 May 2 21:48 client.pem
-rw------- 1 1000 1000 356 May 2 10:12 config.properties
drwxr-xr-x 2 1000 1000 4096 May 2 10:04 jack
-rw------- 1 1000 1000 5102506 May 2 10:04 launcher.jar
drwx------ 2 1000 1000 4096 May 2 21:48 logs
-rw------- 1 1000 1000 982 May 2 22:39 report.18557.txt
-rw------- 1 1000 1000 5522186 May 2 10:04 server-1.jar
-rw------- 1 1000 1000 2066 May 2 10:04 server.jks
-rw------- 1 1000 1000 1042 May 2 21:48 server.pem
./jack:
total 0
./logs:
total 32
-rw-r--r-- 1 1000 1000 689 May 2 22:03 jack-server-0-0.log
-rw-r--r-- 1 1000 1000 0 May 2 10:20 jack-server-0-0.log.lck
-rw-r--r-- 1 1000 1000 585 May 2 10:23 jack-server-0-1.log
-rw-r--r-- 1 1000 1000 689 May 2 10:19 jack-server-0-2.log
-rw-r--r-- 1 1000 1000 585 May 2 10:16 jack-server-1-0.log
-rw------- 1 1000 1000 13411 May 2 22:39 outputs.txt
$ curl --version
curl 7.58.0 (x86_64-pc-linux-gnu) libcurl/7.58.0 OpenSSL/1.1.1 zlib/1.2.11 libidn2/2.0.4 libpsl/0.19.1 (+libidn2/2.0.4) nghttp2/1.30.0 librtmp/2.3
Release-Date: 2018-01-24
Protocols: dict file ftp ftps gopher http https imap imaps ldap ldaps pop3 pop3s rtmp rtsp smb smbs smtp smtps telnet tftp
Features: AsynchDNS IDN IPv6 Largefile GSS-API Kerberos SPNEGO NTLM NTLM_WB SSL libz TLS-SRP HTTP2 UnixSockets HTTPS-proxy PSL
$ JACK_EXTRA_CURL_OPTIONS=-v jack-admin list server
* Trying 127.0.0.1...
* TCP_NODELAY set
* Connected to localhost (127.0.0.1) port 8377 (#0)
* ALPN, offering h2
* ALPN, offering http/1.1
* successfully set certificate verify locations:
* CAfile: /home/zhangying/.jack-server/server.pem
CApath: /etc/ssl/certs
} [5 bytes data]
* TLSv1.3 (OUT), TLS handshake, Client hello (1):
} [512 bytes data]
* OpenSSL SSL_connect: SSL_ERROR_SYSCALL in connection to localhost:8377
* Closing connection 0
SSL error when connecting to the Jack server. Try 'jack-diagnose'
$ jack-admin server-stat
Getting statistic from background server
SSL error when connecting to the Jack server. Try 'jack-diagnose'
$ base64 --version
base64 (GNU coreutils) 8.28
Copyright (C) 2017 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Written by Simon Josefsson.
$ (echo amFjaw==;echo LXNlcnZlcg==) | base64 --decode
I get the same error when I switch to Ubuntu 16.04.Below is a list of the installed Curl versions of Ubuntu 18.04.
WARNING: apt does not have a stable CLI interface. Use with caution in scripts.
curl/bionic-updates,bionic-security,now 7.58.0-2ubuntu3.13 amd64 [installed]
libcurl3-gnutls/bionic-updates,bionic-security,now 7.58.0-2ubuntu3.13 amd64 [installed,automatic]
libcurl4/bionic-updates,bionic-security,now 7.58.0-2ubuntu3.13 amd64 [installed,automatic]
libcurl4-openssl-dev/bionic-updates,bionic-security,now 7.58.0-2ubuntu3.13 amd64 [installed]
I have tried many ways, but I can't solve it. Please help me,thanks.
After the two steps below were applied, the AOSP was successfully built.
Remove TLSv1, TLSv1.1 from jdk.tls.disabledAlgorithms in /etc/java-8-openjdk/security/java.security file
Restart the jack server:
cd /prebuilts/sdk/tools/
./jack-admin kill-server
./jack-admin start-server
I just found the answer, see the link below
enter link description here
Change the code to this,
from /etc/java-8-openjdk/security/java.security remove TLSv1, TLSv1.1.
jdk.tls.disabledAlgorithms=SSLv3, RC4, DES, MD5withRSA,
DH keySize < 1024, EC keySize < 224, 3DES_EDE_CBC, anon, NULL,
include jdk.disabled.namedCurves
I just want to give all the different ways to solve the problem.
There are few ways to overcome this problem, one may work for someone -
Try to simply restart the jack server by below command at your android root folder
./prebuilts/sdk/tools/jack-admin kill-server
./prebuilts/sdk/tools/jack-admin start-server
Try to reduce the number of concurrent services in file $HOME/.jack-server/config.properties
Code:
jack.server.max-service=4
Try to make this value 2 or 1.
If jack server is not running or it hangs when try to run. Than try removing TLSv1, TLSv1.1 from rom /etc/java-8-openjdk/security/java.security
Solution 3 Worked for me.
A way to fix that in your Dockerfile :
USER root
# Fix jack server SSL issue during build
RUN perl -0777 -i -p -e 's/(jdk.tls.disabledAlgorithms=.*?), TLSv1, TLSv1\.1/$1/g' \
/etc/java-8-openjdk/security/java.security

Bash ping script file in android terminal

I have small code for ping in a loop:
#!/system/bin/sh
_count=0
_target="dns.google.com"
echo "target :: $_target"
while true;
do
_time="$(date +%H%M%S)"
_count=$((_count + 1))
echo "::::::::::::::::::LOOP"
echo "time :: $_time"
echo "counter :: $_count"
ping -w 1 -c 1 $_target >/dev/null 2>&1 &&
echo "$? ... is reachable" ||
echo "$? ... is down"
done
I'm calling this from android terminal (using SManager).
It should check host availability with a ping in a loop.
The problem is that I get a real response only for the first ping and all the others are bad (output):
$ /system/bin/sh /storage/emulated/0/pinger.sh
target :: dns.google.com
::::::::::::::::::LOOP
time :: 174912
counter :: 1
0 ... is reachable
::::::::::::::::::LOOP
time :: 174912
counter :: 2
1 ... is down
::::::::::::::::::LOOP
time :: 174913
counter :: 3
1 ... is down
::::::::::::::::::LOOP
time :: 174914
counter :: 4
1 ... is down
.
..
...etc.
What is the reason for this behavior?
Lukas
EDIT 2:
New script:
#!/system/bin/sh
_count=0
_target="dns.google.com"
echo "target :: $_target"
while true;
do
_time="$(date +%H%M%S)"
_count=$((_count + 1))
echo "::::::::::::::::::LOOP"
echo "time :: $_time"
echo "counter :: $_count"
ping -w 1 -c 1 $_target
done
Output:
$ /system/bin/sh /storage/emulated/0/pinger.sh
target :: dns.google.com
::::::::::::::::::LOOP
time :: 205444
counter :: 1
PING dns.google.com (8.8.4.4) 56(84) bytes of data.
64 bytes from dns.google (8.8.4.4): icmp_seq=1 ttl=64 time=7.40 ms
--- dns.google.com ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 7.404/7.404/7.404/0.000 ms
::::::::::::::::::LOOP
time :: 205445
counter :: 2
PING dns.google.com (8.8.4.4) 56(84) bytes of data.
--- dns.google.com ping statistics ---
2 packets transmitted, 0 received, 100% packet loss, time 999ms
::::::::::::::::::LOOP
time :: 205447
counter :: 3
PING dns.google.com (8.8.4.4) 56(84) bytes of data.
--- dns.google.com ping statistics ---
1 packets transmitted, 0 received, 100% packet loss, time 0ms
.
..
...etc.

Select tabbed data in adb shell without using awk, as using awk gives `awk not found error` [duplicate]

This question already has answers here:
How to make the 'cut' command treat same sequental delimiters as one?
(5 answers)
Closed 4 years ago.
I can get Receive and Transmit bytes for an android device as follows
130|sailfish:/ $ cat /proc/net/dev
Inter-| Receive | Transmit
face |bytes packets errs drop fifo frame compressed multicast|bytes packets errs drop fifo colls carrier compressed
rmnet_ipa0: 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
r_rmnet_data7: 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
r_rmnet_data4: 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
rmnet_data1: 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
rmnet_data3: 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
wlan0: 6720980481 66560024 0 0 0 0 0 0 355572166 1127583 0 2 0 0 0 0
rmnet_data5: 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
r_rmnet_data1: 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
Further, I am trying to filter the received and transmit bytes for an Android device using
cat /proc/net/dev |grep wlan | awk {'print $1'}
but I get the following error
/system/bin/sh: awk: not found
Any alternative way to select the appropriate columns?
I tried Perl as well as
cat /proc/net/dev | grep wlan | perl -lane 'print $F[1]'
which gave
/system/bin/sh: perl: not found
using cut as
cat /proc/net/dev | grep wlan | cut -d' ' -f3
gives
6720980481
but the issues is that I want to cut the tab instead of space as I want to select other tabs as well
I tried
cat /proc/net/dev | grep wlan | cut -d'\t' -f3
and
cat /proc/net/dev | grep wlan | cut -d' ' -f3
but it gives
cut: the delimiter must be a single character
I guess one of the solutions would be to try and install awk and/or perl, but I guess that can't be done for some reason. Anyway, tab is the default separator character in cut. So this should work
cat /proc/net/dev | grep wlan | cut -f3

creating apk using Kivy showing some error

When after I give the command:
buildozer android debug deploy run
I am getting the following error. Its showing syntax error ?
# Install distribute
# Run 'curl http://python-distribute.org/distribute_setup.py | venv/bin/python'
# Cwd /root/Bt/.buildozer
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 1395 100 1395 0 0 276 0 0:00:05 0:00:05 --:--:-- 276
File "<stdin>", line 1
<HTML><HEAD>
^
SyntaxError: invalid syntax
# Command failed: curl http://python-distribute.org/distribute_setup.py | venv/bin
/python
It looks like this curl failed for some reason. Could you make sure your buildozer is fully up to date with git, delete your .buildozer directory, and try again?
I would try to update your Python version, make sure it is the latest.
Don't use virtual env. I had a similar issue. Just install builddozer and kivy in the default environment

Finding usage of resources (CPU and memory) by threads of a process in Android

I have a multi-threaded application(C++,C and pthread library) and I will like to know how much resources(CPU and memory) each thread uses. Is there a way to find out these details on Android?
I have tried
$ adb shell ps -p -t
But, this gives information in the below format,
USER PID PPID VSIZE RSS PRIO NICE RTPRI SCHED WCHAN PC NAME
root 1 0 476 312 20 0 0 0 c037c0e0 000087bc S /init
root 2 0 0 0 20 0 0 0 c031f114 00000000 S kthreadd
root 3 2 0 0 20 0 0 0 c030e5d0 00000000 S ksoftirqd/0
root 4 2 0 0 -100 0 99 1 c033fc50 00000000 S watchdog/0
root 5 2 0 0 20 0 0 0 c031b4b4 00000000 S events/0
root 6 2 0 0 20 0 0 0 c031b4b4 00000000 S khelper
Any way to know which threads are running along with their parent's id will be really helpful.
using
$ adb logcat -v threadtime
prints info about the running process (PID) and the thread (TID).
But, its not enough for my purpose. I want to know how much resources is a particular thread consuming. Any pointers.
ps command in android seems to be very limited compared to linux.
You could try:
ps -t -c APP_NAME
This will show you threads(-t) and the CPU assigned to the thread (-c)
Example:
ps -t -c -p com.whatsapp
-p is thread priority(linux nice value)

Categories

Resources