Skip to content

Commit

Permalink
Try save core dumps into the existing /tmp/bmq-broker folder
Browse files Browse the repository at this point in the history
Signed-off-by: Dmitrii Petukhov <[email protected]>
  • Loading branch information
bbpetukhov committed Jan 8, 2025
1 parent 4eadb4e commit f35ae43
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 13 deletions.
10 changes: 4 additions & 6 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -83,10 +83,8 @@ jobs:

- name: Setup Core Dumps config
run: |
sudo mkdir /tmp/cores
sudo chmod 777 /tmp/cores
echo "test content" > /tmp/cores/test.txt
echo "/tmp/cores/%e.%p.%s.%t" | sudo tee /proc/sys/kernel/core_pattern
echo "test content" > /tmp/bmq-broker/test.txt
echo "/tmp/bmq-broker/%e.%p.%s.%t" | sudo tee /proc/sys/kernel/core_pattern
- name: Build and run integration tests with Maven
timeout-minutes: 120
Expand All @@ -101,15 +99,15 @@ jobs:

run: |
ls -lah /tmp
ls -lah /tmp/cores
ls -lah /tmp/bmq-broker
- name: Upload broker core dump as artifacts
# if: failure()
if: always()
uses: actions/upload-artifact@v4
with:
name: core_dumps
path: /tmp/cores
path: /tmp/bmq-broker
retention-days: 5

- name: Compress collected broker logs
Expand Down
6 changes: 3 additions & 3 deletions bmq-sdk/src/test/docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ RUN echo "sleep 5" >> /tmp/startup.sh
RUN echo "kill -QUIT $BROKER_PID" >> /tmp/startup.sh
RUN echo "sleep 5" >> /tmp/startup.sh
RUN echo "cat /proc/sys/kernel/core_pattern" >> /tmp/startup.sh
RUN echo "ls -lah /tmp/cores" >> /tmp/startup.sh
RUN echo "cat /proc/sys/kernel/core_pattern > /tmp/cores/sample.txt" >> /tmp/startup.sh
RUN echo "ls -lah /tmp/cores" >> /tmp/startup.sh
RUN echo "ls -lah /tmp/bmq-broker" >> /tmp/startup.sh
RUN echo "cat /proc/sys/kernel/core_pattern > /tmp/bmq-broker/sample.txt" >> /tmp/startup.sh
RUN echo "ls -lah /tmp/bmq-broker" >> /tmp/startup.sh
RUN chmod +x /tmp/startup.sh
CMD ["/tmp/startup.sh"]

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ public class BmqBrokerContainer implements BmqBroker {
private static final Logger logger =
LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
private static final String CONTAINER_TMP_LOGS = "/tmp/logs";
private static final String CONTAINER_CORES = "/tmp/cores";
private static final String IMAGE_NAME = "bmq-broker-java-it";
private static final String OUTPUT_FILENAME = "output.log";

Expand Down Expand Up @@ -88,10 +87,8 @@ public static BmqBrokerContainer createContainer(int port) throws IOException {

final Path tmpDir = makeTempDir(name);
final Path hostLogsPath = tmpDir.resolve("logs");
final Path hostCoresPath = Paths.get("/tmp/cores");

logger.info("Use '{}' directory for broker logs", hostLogsPath);
logger.info("Use '{}' directory for broker cores", hostCoresPath);

final PortBinding portBinding =
PortBinding.parse(opts.brokerUri().getPort() + ":" + BROKER_DEFAULT_PORT);
Expand All @@ -101,7 +98,7 @@ public static BmqBrokerContainer createContainer(int port) throws IOException {
new HostConfig()
.withPortBindings(portBinding)
.withBinds(Bind.parse(hostLogsPath + ":" + CONTAINER_TMP_LOGS))
.withBinds(Bind.parse(hostCoresPath + ":" + CONTAINER_CORES));
;

final String id =
client.createContainerCmd(IMAGE_NAME)
Expand Down

0 comments on commit f35ae43

Please sign in to comment.