-
Notifications
You must be signed in to change notification settings - Fork 199
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
Add smoke test showing OOM due to recursive log capture on Wildfly #3796
Merged
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
plugins { | ||
id("ai.smoke-test-war") | ||
} |
18 changes: 18 additions & 0 deletions
18
...evel/src/main/java/com/microsoft/applicationinsights/smoketestapp/HealthCheckServlet.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
// Copyright (c) Microsoft Corporation. All rights reserved. | ||
// Licensed under the MIT License. | ||
|
||
package com.microsoft.applicationinsights.smoketestapp; | ||
|
||
import java.io.IOException; | ||
import javax.servlet.annotation.WebServlet; | ||
import javax.servlet.http.HttpServlet; | ||
import javax.servlet.http.HttpServletRequest; | ||
import javax.servlet.http.HttpServletResponse; | ||
|
||
// this is used by the test infra in order to know when it's ok to start running the tests | ||
@WebServlet("") | ||
public class HealthCheckServlet extends HttpServlet { | ||
|
||
@Override | ||
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOException {} | ||
} |
25 changes: 25 additions & 0 deletions
25
...java/com/microsoft/applicationinsights/smoketestapp/OutOfMemoryWithDebugLevelServlet.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
// Copyright (c) Microsoft Corporation. All rights reserved. | ||
// Licensed under the MIT License. | ||
|
||
package com.microsoft.applicationinsights.smoketestapp; | ||
|
||
import java.io.IOException; | ||
import java.util.logging.Logger; | ||
import javax.servlet.ServletException; | ||
import javax.servlet.annotation.WebServlet; | ||
import javax.servlet.http.HttpServlet; | ||
import javax.servlet.http.HttpServletRequest; | ||
import javax.servlet.http.HttpServletResponse; | ||
|
||
@WebServlet("/*") | ||
public class OutOfMemoryWithDebugLevelServlet extends HttpServlet { | ||
|
||
private static final Logger logger = Logger.getLogger("smoketestapp"); | ||
|
||
@Override | ||
protected void doGet(HttpServletRequest req, HttpServletResponse resp) | ||
throws ServletException, IOException { | ||
|
||
logger.info("hello"); | ||
} | ||
} |
72 changes: 72 additions & 0 deletions
72
...eTest/java/com/microsoft/applicationinsights/smoketest/OutOfMemoryWithDebugLevelTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
// Copyright (c) Microsoft Corporation. All rights reserved. | ||
// Licensed under the MIT License. | ||
|
||
package com.microsoft.applicationinsights.smoketest; | ||
|
||
import static com.microsoft.applicationinsights.smoketest.EnvironmentValue.TOMCAT_8_JAVA_11; | ||
import static com.microsoft.applicationinsights.smoketest.EnvironmentValue.TOMCAT_8_JAVA_11_OPENJ9; | ||
import static com.microsoft.applicationinsights.smoketest.EnvironmentValue.TOMCAT_8_JAVA_17; | ||
import static com.microsoft.applicationinsights.smoketest.EnvironmentValue.TOMCAT_8_JAVA_21; | ||
import static com.microsoft.applicationinsights.smoketest.EnvironmentValue.TOMCAT_8_JAVA_8; | ||
import static com.microsoft.applicationinsights.smoketest.EnvironmentValue.TOMCAT_8_JAVA_8_OPENJ9; | ||
import static com.microsoft.applicationinsights.smoketest.EnvironmentValue.WILDFLY_13_JAVA_8; | ||
import static com.microsoft.applicationinsights.smoketest.EnvironmentValue.WILDFLY_13_JAVA_8_OPENJ9; | ||
import static java.util.concurrent.TimeUnit.NANOSECONDS; | ||
import static java.util.concurrent.TimeUnit.SECONDS; | ||
import static org.assertj.core.api.Assertions.assertThat; | ||
|
||
import com.microsoft.applicationinsights.smoketest.schemav2.MessageData; | ||
import java.util.List; | ||
import org.junit.jupiter.api.Test; | ||
import org.junit.jupiter.api.extension.RegisterExtension; | ||
|
||
@UseAgent | ||
abstract class OutOfMemoryWithDebugLevelTest { | ||
|
||
@RegisterExtension | ||
static final SmokeTestExtension testing = | ||
SmokeTestExtension.builder() | ||
.setSelfDiagnosticsLevel( | ||
"debug") // intentionally running with selfDiagnosticLevel "debug" | ||
.build(); | ||
|
||
private static final int COUNT = 100; | ||
|
||
@Test | ||
@TargetUri(value = "/test", callCount = COUNT) | ||
void test() throws Exception { | ||
long start = System.nanoTime(); | ||
while (testing.mockedIngestion.getCountForType("RequestData") < COUNT | ||
&& NANOSECONDS.toSeconds(System.nanoTime() - start) < 10) {} | ||
// wait ten more seconds before checking that we didn't receive too many | ||
Thread.sleep(SECONDS.toMillis(10)); | ||
|
||
List<MessageData> messages = testing.mockedIngestion.getMessageDataInRequest(COUNT); | ||
|
||
assertThat(messages).hasSize(COUNT); | ||
} | ||
|
||
@Environment(TOMCAT_8_JAVA_8) | ||
static class Tomcat8Java8Test extends OutOfMemoryWithDebugLevelTest {} | ||
|
||
@Environment(TOMCAT_8_JAVA_8_OPENJ9) | ||
static class Tomcat8Java8OpenJ9Test extends OutOfMemoryWithDebugLevelTest {} | ||
|
||
@Environment(TOMCAT_8_JAVA_11) | ||
static class Tomcat8Java11Test extends OutOfMemoryWithDebugLevelTest {} | ||
|
||
@Environment(TOMCAT_8_JAVA_11_OPENJ9) | ||
static class Tomcat8Java11OpenJ9Test extends OutOfMemoryWithDebugLevelTest {} | ||
|
||
@Environment(TOMCAT_8_JAVA_17) | ||
static class Tomcat8Java17Test extends OutOfMemoryWithDebugLevelTest {} | ||
|
||
@Environment(TOMCAT_8_JAVA_21) | ||
static class Tomcat8Java21Test extends OutOfMemoryWithDebugLevelTest {} | ||
|
||
@Environment(WILDFLY_13_JAVA_8) | ||
static class Wildfly13Java8Test extends OutOfMemoryWithDebugLevelTest {} | ||
|
||
@Environment(WILDFLY_13_JAVA_8_OPENJ9) | ||
static class Wildfly13Java8OpenJ9Test extends OutOfMemoryWithDebugLevelTest {} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is it necessary to use CallDepth here? Log makes sense. BatchItemProcessor is used for span and metrics too.
we passed a copy of BatchItemProcessor into AgentLogExporter.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this method is run in a different thread (so the thread local doesn't carry over to here)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we add it as comment?