Skip to content

Commit 6b652ef

Browse files
plexusbbatsov
authored andcommitted
When running test-cljs, after 5 minutes print stacktraces and exit
A successful ClojureScript build takes 2~3 minutes, however sometimes it will block until CI times out, and we're not sure yet why. To further diagnose this issue we now start a background shell which after five minutes will print the stacktraces of all threads of all active JVMs using jcmd/jstack. Hopefully this provides some insight in what/where the tests get stuck. Additionally this kills all Java processes after five minutes so CI finishes a little quicker.
1 parent 2586344 commit 6b652ef

File tree

2 files changed

+49
-2
lines changed

2 files changed

+49
-2
lines changed

Makefile

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
.PHONY: test-clj test-cljs eastwood cljfmt cloverage install smoketest release deploy clean check_node
1+
.PHONY: test-clj test-cljs eastwood cljfmt cloverage install smoketest release deploy clean check_node detect_timeout
22

33
CLOJURE_VERSION ?= 1.9
44
export CLOVERAGE_VERSION = 1.0.13
@@ -16,7 +16,7 @@ source-deps: .source-deps
1616
test-clj: .source-deps smoketest
1717
lein with-profile +$(CLOJURE_VERSION),+plugin.mranderson/config,+test-clj test
1818

19-
test-cljs: .source-deps check_node
19+
test-cljs: .source-deps check_node detect_timeout
2020
lein with-profile +$(CLOJURE_VERSION),+plugin.mranderson/config,+test-cljs test
2121

2222
eastwood:
@@ -50,6 +50,12 @@ smoketest: install
5050
check_node:
5151
which node
5252

53+
# Run a background process that prints all JVM stacktraces after five minutes,
54+
# then kills all JVMs, to help diagnose issues with ClojureScript tests getting
55+
# stuck.
56+
detect_timeout:
57+
(bin/ci_detect_timeout &)
58+
5359
# When releasing, the BUMP variable controls which field in the
5460
# version string will be incremented in the *next* snapshot
5561
# version. Typically this is either "major", "minor", or "patch".

bin/ci_detect_timeout

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
#!/bin/bash
2+
3+
# A successful ClojureScript build takes 2~3 minutes, however sometimes it will
4+
# block until CI times out, and we're not sure yet why.
5+
#
6+
# To further diagnose this issue we now start a background shell which after five
7+
# minutes will print the stacktraces of all threads of all active JVMs using
8+
# jcmd/jstack. Hopefully this provides some insight in what/where the tests get
9+
# stuck.
10+
#
11+
# Additionally this kills all Java processes after five minutes so CI finishes a
12+
# little quicker.
13+
14+
sleep 300 # 5 minutes
15+
16+
function hr() {
17+
echo '━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━'
18+
}
19+
20+
echo
21+
hr
22+
echo " TIMEOUT, PRINTING STACK TRACES."
23+
hr
24+
25+
jcmd | grep -v jcmd | while read pid cmd
26+
do
27+
echo "---> " $cmd
28+
echo
29+
jstack $pid 2>&1
30+
hr
31+
echo
32+
done
33+
34+
echo "KILLING JAVA PROCESSES"
35+
echo
36+
37+
jcmd | grep -v jcmd | while read pid cmd
38+
do
39+
echo "kill -9 ${pid} # ${cmd}"
40+
kill -9 $pid
41+
done

0 commit comments

Comments
 (0)