Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate to github actions #11

Merged
merged 1 commit into from
Apr 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 52 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
---
name: jvmquake-ci
on:
push:
branches:
- master
- main
tags:
- v'*'
pull_request:
jobs:
centos:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: "Set nproc limits to control threads"
run: |
sudo prlimit --pid $$ --nofile=32768:32768 --nproc=32768:32768
ulimit -n -u
- name: "Test Java 8 for centos7 in Docker"
run: make test_centos7_openjdk8
ubuntu-jammy:
runs-on: ubuntu-22.04
strategy:
matrix:
java: [ '8', '11']
steps:
- uses: actions/checkout@v2
- name: "Set nproc limits to control threads"
run: |
sudo prlimit --pid $$ --nofile=32768:32768 --nproc=32768:32768
ulimit -n -u
- name: "Setup python for tox"
uses: actions/setup-python@v4
with:
python-version: "3.11"
- name: "Install tox for test suite"
run: pip install tox
- uses: actions/setup-java@v4
with:
distribution: 'zulu'
java-version: |
8
${{ matrix.java }}
- name: "Build jvmquake .so with Java 8"
run: JAVA_HOME=$JAVA_HOME_8_X64 make -C src
- name: Build jvmquake tests against JVM ${{ matrix.java }}
run: env | grep JAVA && make -C tests
- name: Run jvmquake tests against JVM ${{ matrix.java }}
env:
JAVA_MAJOR_VERSION: ${{ matrix.java }}
run: tox -e test,test_jvm
33 changes: 0 additions & 33 deletions .travis.yml

This file was deleted.

26 changes: 13 additions & 13 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -68,35 +68,35 @@ test_bionic_openjdk11: JAVA_VERSION=11
test_bionic_openjdk11: TEST_NAME=test_bionic_openjdk11
test_bionic_openjdk11: test_ubuntu_with_openjdk

test_focal_openjdk8: UBUNTU_VERSION=20.04
test_focal_openjdk8: JAVA_VERSION=8
test_focal_openjdk8: TEST_NAME=test_focal_openjdk8
test_focal_openjdk8: test_ubuntu_with_openjdk
test_jammy_openjdk8: UBUNTU_VERSION=22.04
test_jammy_openjdk8: JAVA_VERSION=8
test_jammy_openjdk8: TEST_NAME=test_jammy_openjdk8
test_jammy_openjdk8: test_ubuntu_with_openjdk

test_focal_openjdk11: UBUNTU_VERSION=20.04
test_focal_openjdk11: JAVA_VERSION=11
test_focal_openjdk11: TEST_NAME=test_focal_openjdk11
test_focal_openjdk11: test_ubuntu_with_openjdk
test_jammy_openjdk11: UBUNTU_VERSION=22.04
test_jammy_openjdk11: JAVA_VERSION=11
test_jammy_openjdk11: TEST_NAME=test_jammy_openjdk11
test_jammy_openjdk11: test_ubuntu_with_openjdk

test_ubuntu_with_openjdk: build_deb_in_docker
docker build -f dockerfiles/test/Dockerfile.ubuntu --build-arg UBUNTU_VERSION=$(UBUNTU_VERSION) --build-arg JAVA_VERSION=$(JAVA_VERSION) . -t jolynch/jvmquake:$(TEST_NAME)
docker build -f dockerfiles/test/Dockerfile.ubuntu.minimal --build-arg UBUNTU_VERSION=$(UBUNTU_VERSION) --build-arg JAVA_VERSION=$(JAVA_VERSION) . -t jolynch/jvmquake:$(TEST_NAME)_minimal
# Check that the .so works
docker run -e JAVA_MAJOR_VERSION=$(JAVA_VERSION) --rm -v $(shell pwd)/build/:/work/build/ jolynch/jvmquake:$(TEST_NAME)
docker run -e JAVA_MAJOR_VERSION=$(JAVA_VERSION) --ulimit nproc=32768:32768 --rm -v $(shell pwd)/build/:/work/build/ jolynch/jvmquake:$(TEST_NAME)
# Check that the debian works
docker run -e JAVA_MAJOR_VERSION=$(JAVA_VERSION) --rm -v $(shell pwd)/dist/:/work/dist/ jolynch/jvmquake:$(TEST_NAME)_minimal
docker run -e JAVA_MAJOR_VERSION=$(JAVA_VERSION) --ulimit nproc=32768:32768 --rm -v $(shell pwd)/dist/:/work/dist/ jolynch/jvmquake:$(TEST_NAME)_minimal

test_ubuntu_with_zulu: build_deb_in_docker
docker build -f dockerfiles/test/Dockerfile.ubuntu.zulu --build-arg UBUNTU_VERSION=$(UBUNTU_VERSION) --build-arg JAVA_VERSION=$(JAVA_VERSION) . -t jolynch/jvmquake:$(TEST_NAME)
docker build -f dockerfiles/test/Dockerfile.ubuntu.zulu.minimal --build-arg UBUNTU_VERSION=$(UBUNTU_VERSION) --build-arg JAVA_VERSION=$(JAVA_VERSION) . -t jolynch/jvmquake:$(TEST_NAME)_minimal
# Check that the .so works
docker run -e JAVA_MAJOR_VERSION=$(JAVA_VERSION) --rm -v $(shell pwd)/build/:/work/build/ jolynch/jvmquake:$(TEST_NAME)
docker run -e JAVA_MAJOR_VERSION=$(JAVA_VERSION) --ulimit nproc=32768:32768 --rm -v $(shell pwd)/build/:/work/build/ jolynch/jvmquake:$(TEST_NAME)
# Check that the debian works
docker run -e JAVA_MAJOR_VERSION=$(JAVA_VERSION) --rm -v $(shell pwd)/dist/:/work/dist/ jolynch/jvmquake:$(TEST_NAME)_minimal
docker run -e JAVA_MAJOR_VERSION=$(JAVA_VERSION) --ulimit nproc=32768:32768 --rm -v $(shell pwd)/dist/:/work/dist/ jolynch/jvmquake:$(TEST_NAME)_minimal


# CentOS builds just test with the .so file

test_centos7_openjdk8: build_in_docker
docker build -f dockerfiles/test/Dockerfile.centos --build-arg CENTOS_VERSION=7 --build-arg JAVA_VERSION=1.8.0 . -t jolynch/jvmquake:$@
docker run --rm -v $(shell pwd)/build/:/work/build/ jolynch/jvmquake:$@
docker run -e JAVA_MAJOR_VERSION=8 --ulimit nproc=32768:32768 --rm -v $(shell pwd)/build/:/work/build/ jolynch/jvmquake:$@
11 changes: 5 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[![Build Status](https://travis-ci.com/Netflix-Skunkworks/jvmquake.svg?branch=master)](https://travis-ci.com/Netflix-Skunkworks/jvmquake)
![Build Status](https://github.com/Netflix-Skunkworks/jvmquake/actions/workflows/ci.yml/badge.svg)

# `jvmquake`
A JVMTI agent that attaches to your JVM and automatically signals and kills it
Expand Down Expand Up @@ -185,8 +185,7 @@ specification. In practice I find the same `.so` works fine with Java 8, 9, 11
and I imagine it will work until Java changes the spec.

See [Testing](#Testing) for the full set of platforms that we test against.

[![Build Status](https://travis-ci.org/Netflix-Skunkworks/jvmquake.svg?branch=master)](https://travis-ci.org/Netflix-Skunkworks/jvmquake)
![Build Status](https://github.com/Netflix-Skunkworks/jvmquake/actions/workflows/ci.yml/badge.svg)

## How to Use the Agent
Once you have the agent library, run your java program with `agentpath` or `agentlib`
Expand Down Expand Up @@ -273,8 +272,8 @@ handles.

## Automated Tests

We currently [test](.travis.yml) every commit and the released `.so` generated
with OpenJDK 8 against the following platforms:
We currently [test](.github/workflows/ci.yml) every commit and the released
`.so` generated with OpenJDK 8 against the following platforms:

* Ubuntu Xenial with OpenJDK8
* Ubuntu Bionic with OpenJDK8
Expand All @@ -285,4 +284,4 @@ with OpenJDK 8 against the following platforms:
* Ubuntu Focal with OpenJDK11
* Centos7 with OpenJDK8

[![Build Status](https://travis-ci.org/Netflix-Skunkworks/jvmquake.svg?branch=master)](https://travis-ci.org/Netflix-Skunkworks/jvmquake)
![Build Status](https://github.com/Netflix-Skunkworks/jvmquake/actions/workflows/ci.yml/badge.svg)
20 changes: 10 additions & 10 deletions dockerfiles/test/Dockerfile.ubuntu.zulu
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@ FROM ubuntu:$UBUNTU_VERSION as builder
ARG JAVA_VERSION=8

RUN apt-get update
RUN apt-get install -y software-properties-common
RUN apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 0xB1998361219BD9C9
RUN apt-add-repository 'deb http://repos.azulsystems.com/ubuntu stable main'
RUN apt-get install -y gnupg ca-certificates curl
RUN curl -s https://repos.azul.com/azul-repo.key | gpg --dearmor -o /usr/share/keyrings/azul.gpg
RUN echo "deb [signed-by=/usr/share/keyrings/azul.gpg] https://repos.azul.com/zulu/deb stable main" | tee /etc/apt/sources.list.d/zulu.list
RUN apt-get update
RUN apt-get install -y zulu-$JAVA_VERSION
RUN apt-get install -y zulu$JAVA_VERSION-jdk
RUN apt-get install -y make

ENV JAVA_HOME /usr/lib/jvm/zulu-$JAVA_VERSION-amd64
ENV JAVA_HOME /usr/lib/jvm/zulu$JAVA_VERSION
WORKDIR /work

COPY . /work
Expand All @@ -21,11 +21,11 @@ FROM ubuntu:$UBUNTU_VERSION
ARG JAVA_VERSION=8

RUN apt-get update
RUN apt-get install -y software-properties-common
RUN apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 0xB1998361219BD9C9
RUN apt-add-repository 'deb http://repos.azulsystems.com/ubuntu stable main'
RUN apt-get install -y gnupg ca-certificates curl
RUN curl -s https://repos.azul.com/azul-repo.key | gpg --dearmor -o /usr/share/keyrings/azul.gpg
RUN echo "deb [signed-by=/usr/share/keyrings/azul.gpg] https://repos.azul.com/zulu/deb stable main" | tee /etc/apt/sources.list.d/zulu.list
RUN apt-get update
RUN apt-get install -y zre-$JAVA_VERSION
RUN apt-get install -y zulu$JAVA_VERSION-jre
RUN apt-get install -y make
RUN apt-get install -y python3-minimal python3-pip

Expand All @@ -39,7 +39,7 @@ COPY --from=builder /work/Makefile /work/Makefile
COPY --from=builder /work/tox.ini /work/tox.ini
COPY tests/run_tests.sh /work/run_tests.sh

ENV JAVA_HOME /usr/lib/jvm/zre-$JAVA_VERSION-amd64
ENV JAVA_HOME /usr/lib/jvm/zulu$JAVA_VERSION
# This should get mounted in if we want to use it
ENV AGENT_DIR /work/build/

Expand Down
20 changes: 10 additions & 10 deletions dockerfiles/test/Dockerfile.ubuntu.zulu.minimal
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@ FROM ubuntu:$UBUNTU_VERSION as builder
ARG JAVA_VERSION=8

RUN apt-get update
RUN apt-get install -y software-properties-common
RUN apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 0xB1998361219BD9C9
RUN apt-add-repository 'deb http://repos.azulsystems.com/ubuntu stable main'
RUN apt-get install -y gnupg ca-certificates curl
RUN curl -s https://repos.azul.com/azul-repo.key | gpg --dearmor -o /usr/share/keyrings/azul.gpg
RUN echo "deb [signed-by=/usr/share/keyrings/azul.gpg] https://repos.azul.com/zulu/deb stable main" | tee /etc/apt/sources.list.d/zulu.list
RUN apt-get update
RUN apt-get install -y zulu-$JAVA_VERSION
RUN apt-get install -y zulu$JAVA_VERSION-jdk
RUN apt-get install -y make

ENV JAVA_HOME /usr/lib/jvm/zulu-$JAVA_VERSION-amd64
ENV JAVA_HOME /usr/lib/jvm/zulu$JAVA_VERSION
WORKDIR /work

COPY . /work
Expand All @@ -21,16 +21,16 @@ FROM ubuntu:$UBUNTU_VERSION
ARG JAVA_VERSION=8

RUN apt-get update
RUN apt-get install -y software-properties-common
RUN apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 0xB1998361219BD9C9
RUN apt-add-repository 'deb http://repos.azulsystems.com/ubuntu stable main'
RUN apt-get install -y gnupg ca-certificates curl
RUN curl -s https://repos.azul.com/azul-repo.key | gpg --dearmor -o /usr/share/keyrings/azul.gpg
RUN echo "deb [signed-by=/usr/share/keyrings/azul.gpg] https://repos.azul.com/zulu/deb stable main" | tee /etc/apt/sources.list.d/zulu.list
RUN apt-get update
RUN apt-get install -y zre-$JAVA_VERSION
RUN apt-get install -y zulu$JAVA_VERSION-jre

WORKDIR /work

COPY --from=builder /work/tests/. /work/tests
COPY tests/run_smoke_test.sh /work/run_smoke_test.sh

ENV JAVA_HOME /usr/lib/jvm/zre-$JAVA_VERSION-amd64
ENV JAVA_HOME /usr/lib/jvm/zulu$JAVA_VERSION
CMD ["/work/run_smoke_test.sh"]
8 changes: 6 additions & 2 deletions tests/EasyThreadOOM.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,17 +24,21 @@ public static void main(String[] args)
System.out.println("Thread ~fork bombing the JVM ...");
List<Thread> list = new ArrayList<>();
try {
for (int i = 0; i < 16777216; i++) {
for (int i = 0; i < 128 * 1024 * 1024; i++) {
Thread thread = new Thread(() -> {
while (true) {
try {
Thread.sleep(10000);
Thread.sleep(90000);
System.out.println("Done!");
} catch (InterruptedException ign) {}
}
});
thread.start();
// Hold onto the thread
list.add(thread);
if (list.size() % 10000 == 0) {
System.out.println("Spawned [" + list.size() + "] threads ...");
}
}
}
catch (Exception t) {
Expand Down
2 changes: 1 addition & 1 deletion tests/SlowDeathOOM.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public final class SlowDeathOOM
public static void main(String[] args)
{
List<Object> list = new ArrayList<>();
double cmfZone = 0.80 * Runtime.getRuntime().maxMemory();
double cmfZone = 0.90 * Runtime.getRuntime().maxMemory();
System.out.println(String.format(
"triggering OutOfMemory by allocating %.2f bytes",
cmfZone
Expand Down
4 changes: 2 additions & 2 deletions tests/test_basic_ooms.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def thread_ulimit():
(x, y) = resource.getrlimit(resource.RLIMIT_NPROC)
resource.setrlimit(
resource.RLIMIT_NPROC,
(32768, y)
(2048, y)
)
print("\nProcess limit after fixture: {}\n".format(
resource.getrlimit(resource.RLIMIT_NPROC))
Expand Down Expand Up @@ -80,7 +80,7 @@ def test_jvmquake_coredump_oom(core_ulimit):
]
print("Executing simple OOM causing core dump")
print("[{0}]".format(easy_oom))
with easy_oom.bgrun(retcode=-6, timeout=10) as proc:
with easy_oom.bgrun(retcode=-6, timeout=30) as proc:
pid = proc.pid

heapdump_path = Path.cwd().joinpath("java_pid{0}.hprof".format(pid))
Expand Down
16 changes: 8 additions & 8 deletions tests/test_hard_ooms.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ def test_jvmquake_cms_slow_death_oom():
]
print("Executing Complex CMS Slow Death OOM")
print("[{0}]".format(cms_slow_death))
with cms_slow_death.bgrun(retcode=-9, timeout=10) as proc:
with cms_slow_death.bgrun(retcode=-9, timeout=30) as proc:
pid = proc.pid

heapdump_path = Path.cwd().joinpath("java_pid{0}.hprof".format(pid))
Expand Down Expand Up @@ -157,7 +157,7 @@ def test_jvmquake_cms_slow_death_core(core_ulimit):
]
print("Executing Complex CMS Slow Death OOM")
print("[{0}]".format(cms_slow_death))
with cms_slow_death.bgrun(retcode=-6, timeout=10) as proc:
with cms_slow_death.bgrun(retcode=-6, timeout=30) as proc:
pid = proc.pid

heapdump_path = Path.cwd().joinpath("java_pid{0}.hprof".format(pid))
Expand Down Expand Up @@ -194,7 +194,7 @@ def test_jvmquake_cms_touch_warning():
cms_slow_death_warn_only = java_cmd[
'-Xmx100m',
'-XX:+UseConcMarkSweepGC',
'-XX:CMSInitiatingOccupancyFraction=75',
'-XX:CMSInitiatingOccupancyFraction=70',
agent_path + "=3,1,9,warn=1",
'-cp', class_path,
'SlowDeathOOM'
Expand All @@ -204,15 +204,15 @@ def test_jvmquake_cms_touch_warning():
'-Xmx100m',
'-XX:+UseParNewGC',
'-XX:+UseConcMarkSweepGC',
'-XX:CMSInitiatingOccupancyFraction=75',
'-XX:CMSInitiatingOccupancyFraction=70',
agent_path + "=3,1,9,warn=1",
'-cp', class_path,
'SlowDeathOOM'
]

print("Executing Complex CMS Slow Death OOM")
print("[{0}]".format(cms_slow_death_warn_only))
with cms_slow_death_warn_only.bgrun(retcode=-9, timeout=10) as proc:
with cms_slow_death_warn_only.bgrun(retcode=-9, timeout=30) as proc:
pid = proc.pid

print("Ran pid {}".format(pid))
Expand All @@ -239,7 +239,7 @@ def test_jvmquake_cms_touch_warning_custom_path():
cms_slow_death_warn_only = java_cmd[
'-Xmx100m',
'-XX:+UseConcMarkSweepGC',
'-XX:CMSInitiatingOccupancyFraction=75',
'-XX:CMSInitiatingOccupancyFraction=70',
agent_path + "=5,1,9,warn=2,touch=" + str(jvmquake_warn_path),
'-cp', class_path,
'SlowDeathOOM'
Expand All @@ -249,15 +249,15 @@ def test_jvmquake_cms_touch_warning_custom_path():
'-Xmx100m',
'-XX:+UseParNewGC',
'-XX:+UseConcMarkSweepGC',
'-XX:CMSInitiatingOccupancyFraction=75',
'-XX:CMSInitiatingOccupancyFraction=70',
agent_path + "=5,1,9,warn=2,touch=" + str(jvmquake_warn_path),
'-cp', class_path,
'SlowDeathOOM'
]

print("Executing Complex CMS Slow Death OOM")
print("[{0}]".format(cms_slow_death_warn_only))
with cms_slow_death_warn_only.bgrun(retcode=-9, timeout=20) as proc:
with cms_slow_death_warn_only.bgrun(retcode=-9, timeout=30) as proc:
pid = proc.pid

print("Ran pid {}".format(pid))
Expand Down
5 changes: 4 additions & 1 deletion tests/test_java_opts.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,10 @@ def thread_ulimit():
(x, y) = resource.getrlimit(resource.RLIMIT_NPROC)
resource.setrlimit(
resource.RLIMIT_NPROC,
(x - 1000, y)
(2048, y)
)
print("\nProcess limit after fixture: {}\n".format(
resource.getrlimit(resource.RLIMIT_NPROC))
)
yield
resource.setrlimit(resource.RLIMIT_NPROC, (x, y))
Expand Down
Loading