Skip to content

Commit ac76d8d

Browse files
committedFeb 28, 2025
8350824: New async logging gtest StallingModePreventsDroppedMessages fails
Reviewed-by: mbaesken, dholmes
1 parent eada1ea commit ac76d8d

File tree

2 files changed

+12
-19
lines changed

2 files changed

+12
-19
lines changed
 

‎test/hotspot/gtest/logging/test_asynclog.cpp

+4-14
Original file line numberDiff line numberDiff line change
@@ -253,26 +253,15 @@ TEST_VM_F(AsyncLogTest, droppingMessage) {
253253
EXPECT_TRUE(file_contains_substring(TestLogFileName, "messages dropped due to async logging"));
254254
}
255255

256-
TEST_VM_F(AsyncLogTest, StallingModePreventsDroppedMessages) {
257-
if (AsyncLogWriter::instance() == nullptr) {
258-
return;
259-
}
260-
set_log_config(TestLogFileName, "logging=debug");
261-
LogConfiguration::AsyncMode prev_mode = LogConfiguration::async_mode();
262-
LogConfiguration::set_async_mode(LogConfiguration::AsyncMode::Off);
263-
test_asynclog_drop_messages();
264-
EXPECT_FALSE(file_contains_substring(TestLogFileName, "messages dropped due to async logging"));
265-
LogConfiguration::set_async_mode(prev_mode);
266-
}
267-
268256
TEST_VM_F(AsyncLogTest, stdoutOutput) {
269257
testing::internal::CaptureStdout();
270258

271259
if (!set_log_config("stdout", "logging=debug")) {
272260
return;
273261
}
274262

275-
bool async = AsyncLogWriter::instance() != nullptr;
263+
bool async = AsyncLogWriter::instance() != nullptr
264+
&& LogConfiguration::async_mode() == LogConfiguration::AsyncMode::Drop;
276265
if (async) {
277266
test_asynclog_drop_messages();
278267
AsyncLogWriter::flush();
@@ -301,7 +290,8 @@ TEST_VM_F(AsyncLogTest, stderrOutput) {
301290
return;
302291
}
303292

304-
bool async = AsyncLogWriter::instance() != nullptr;
293+
bool async = AsyncLogWriter::instance() != nullptr
294+
&& LogConfiguration::async_mode() == LogConfiguration::AsyncMode::Drop;
305295
if (async) {
306296
test_asynclog_drop_messages();
307297
AsyncLogWriter::flush();

‎test/hotspot/jtreg/runtime/logging/StressAsyncUL.java

+8-5
Original file line numberDiff line numberDiff line change
@@ -35,19 +35,22 @@
3535
import jdk.test.lib.process.ProcessTools;
3636

3737
public class StressAsyncUL {
38-
static void analyze_output(String... args) throws Exception {
38+
static void analyze_output(boolean stalling_mode, String... args) throws Exception {
3939
ProcessBuilder pb =
4040
ProcessTools.createLimitedTestJavaProcessBuilder(args);
4141
OutputAnalyzer output = new OutputAnalyzer(pb.start());
4242
output.shouldHaveExitValue(0);
43+
if (stalling_mode) {
44+
output.shouldNotContain("messages dropped due to async logging");
45+
}
4346
}
4447
public static void main(String[] args) throws Exception {
45-
analyze_output("-Xlog:async:drop", "-Xlog:all=trace", InnerClass.class.getName());
46-
analyze_output("-Xlog:async:stall", "-Xlog:all=trace", InnerClass.class.getName());
48+
analyze_output(false, "-Xlog:async:drop", "-Xlog:all=trace", InnerClass.class.getName());
49+
analyze_output(true, "-Xlog:async:stall", "-Xlog:all=trace", InnerClass.class.getName());
4750
// Stress test with a very small buffer. Note: Any valid buffer size must be able to hold a flush token.
4851
// Therefore the size of the buffer cannot be zero.
49-
analyze_output("-Xlog:async:drop", "-Xlog:all=trace", "-XX:AsyncLogBufferSize=192", InnerClass.class.getName());
50-
analyze_output("-Xlog:async:stall", "-Xlog:all=trace", "-XX:AsyncLogBufferSize=192", InnerClass.class.getName());
52+
analyze_output(false, "-Xlog:async:drop", "-Xlog:all=trace", "-XX:AsyncLogBufferSize=192", InnerClass.class.getName());
53+
analyze_output(true, "-Xlog:async:stall", "-Xlog:all=trace", "-XX:AsyncLogBufferSize=192", InnerClass.class.getName());
5154
}
5255

5356
public static class InnerClass {

1 commit comments

Comments
 (1)

openjdk-notifier[bot] commented on Feb 28, 2025

@openjdk-notifier[bot]
Please sign in to comment.