This is an automated email from the ASF dual-hosted git repository. rcordier pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/james-project.git
commit aa253c8d7bcf262348e4e7ed4537ef43b4beed3a Author: Tung Van TRAN <[email protected]> AuthorDate: Fri Mar 11 11:06:05 2022 +0700 JAMES-3724 - Document Leak detection mode --- .../sample-configuration/jvm.properties | 9 ++++++ .../docs/modules/ROOT/pages/configure/jvm.adoc | 33 ++++++++++++++++++++++ .../sample-configuration/jvm.properties | 11 +++++++- .../sample-configuration/jvm.properties | 11 +++++++- .../jpa-app/sample-configuration/jvm.properties | 9 ++++++ .../sample-configuration/jvm.properties | 11 +++++++- .../memory-app/sample-configuration/jvm.properties | 9 ++++++ .../org/apache/james/lifecycle/api/Disposable.java | 2 +- src/site/xdoc/server/config-system.xml | 9 ++++++ 9 files changed, 100 insertions(+), 4 deletions(-) diff --git a/server/apps/cassandra-app/sample-configuration/jvm.properties b/server/apps/cassandra-app/sample-configuration/jvm.properties index 0b68f80..ee2f346 100644 --- a/server/apps/cassandra-app/sample-configuration/jvm.properties +++ b/server/apps/cassandra-app/sample-configuration/jvm.properties @@ -16,3 +16,12 @@ # Should MimeMessageWrapper use a copy of the message in memory? Or should bigger message exceeding james.message.memory.threshold # be copied to temporary files? #james.message.usememorycopy=false + +# Mode level of resource leak detection. It is used to detect a resource not be disposed of before it's garbage-collected. +# Example `MimeMessageInputStreamSource` +# Optional. Allowed values are: none, simple, advanced, testing +# - none: Disables resource leak detection. +# - simple: Enables output a simplistic error log if a leak is encountered and would free the resources (default). +# - advanced: Enables output an advanced error log implying the place of allocation of the underlying object and would free resources. +# - testing: Enables output an advanced error log implying the place of allocation of the underlying object and rethrow an error, that action is being taken by the development team. +#james.lifecycle.leak.detection.mode=simple \ No newline at end of file diff --git a/server/apps/distributed-app/docs/modules/ROOT/pages/configure/jvm.adoc b/server/apps/distributed-app/docs/modules/ROOT/pages/configure/jvm.adoc index e4b1aef..9bfddb8 100644 --- a/server/apps/distributed-app/docs/modules/ROOT/pages/configure/jvm.adoc +++ b/server/apps/distributed-app/docs/modules/ROOT/pages/configure/jvm.adoc @@ -7,3 +7,36 @@ Note that in some rare cases this might not work, when a property affects very early JVM start behaviour. For testing purposes, you may specify a different file path via the command line option `-Dextra.props=/some/other/jvm.properties`. + +== Control the threshold memory +This governs the threshold MimeMessageInputStreamSource relies on for storing MimeMessage content on disk. + +In `jvm.properties` +---- +james.message.memory.threshold=12K +---- + +(Optional). String (size, integer + size units, example: `12 KIB`, supported units are bytes KIB MIB GIB TIB). Defaults to 100KIB. + +== Enable the copy of message in memory +Should MimeMessageWrapper use a copy of the message in memory? Or should bigger message exceeding james.message.memory.threshold +be copied to temporary files? + +---- +james.message.usememorycopy=true +---- + +Optional. Boolean. Defaults to false. Recommended value is false. + +== Running resource leak detection +It is used to detect a resource not be disposed of before it's garbage-collected. + +In `jvm.properties` +---- +james.lifecycle.leak.detection.mode=advanced +---- + +Allowed mode values are: none, simple, advanced, testing + +The purpose of each mode is introduced in `config-system.xml` + diff --git a/server/apps/distributed-app/sample-configuration/jvm.properties b/server/apps/distributed-app/sample-configuration/jvm.properties index a3ddab4..ee2f346 100644 --- a/server/apps/distributed-app/sample-configuration/jvm.properties +++ b/server/apps/distributed-app/sample-configuration/jvm.properties @@ -15,4 +15,13 @@ # Optional. Boolean. Defaults to false. Recommended value is false. # Should MimeMessageWrapper use a copy of the message in memory? Or should bigger message exceeding james.message.memory.threshold # be copied to temporary files? -#james.message.usememorycopy=false \ No newline at end of file +#james.message.usememorycopy=false + +# Mode level of resource leak detection. It is used to detect a resource not be disposed of before it's garbage-collected. +# Example `MimeMessageInputStreamSource` +# Optional. Allowed values are: none, simple, advanced, testing +# - none: Disables resource leak detection. +# - simple: Enables output a simplistic error log if a leak is encountered and would free the resources (default). +# - advanced: Enables output an advanced error log implying the place of allocation of the underlying object and would free resources. +# - testing: Enables output an advanced error log implying the place of allocation of the underlying object and rethrow an error, that action is being taken by the development team. +#james.lifecycle.leak.detection.mode=simple \ No newline at end of file diff --git a/server/apps/distributed-pop3-app/sample-configuration/jvm.properties b/server/apps/distributed-pop3-app/sample-configuration/jvm.properties index a3ddab4..ee2f346 100644 --- a/server/apps/distributed-pop3-app/sample-configuration/jvm.properties +++ b/server/apps/distributed-pop3-app/sample-configuration/jvm.properties @@ -15,4 +15,13 @@ # Optional. Boolean. Defaults to false. Recommended value is false. # Should MimeMessageWrapper use a copy of the message in memory? Or should bigger message exceeding james.message.memory.threshold # be copied to temporary files? -#james.message.usememorycopy=false \ No newline at end of file +#james.message.usememorycopy=false + +# Mode level of resource leak detection. It is used to detect a resource not be disposed of before it's garbage-collected. +# Example `MimeMessageInputStreamSource` +# Optional. Allowed values are: none, simple, advanced, testing +# - none: Disables resource leak detection. +# - simple: Enables output a simplistic error log if a leak is encountered and would free the resources (default). +# - advanced: Enables output an advanced error log implying the place of allocation of the underlying object and would free resources. +# - testing: Enables output an advanced error log implying the place of allocation of the underlying object and rethrow an error, that action is being taken by the development team. +#james.lifecycle.leak.detection.mode=simple \ No newline at end of file diff --git a/server/apps/jpa-app/sample-configuration/jvm.properties b/server/apps/jpa-app/sample-configuration/jvm.properties index 0b68f80..ee2f346 100644 --- a/server/apps/jpa-app/sample-configuration/jvm.properties +++ b/server/apps/jpa-app/sample-configuration/jvm.properties @@ -16,3 +16,12 @@ # Should MimeMessageWrapper use a copy of the message in memory? Or should bigger message exceeding james.message.memory.threshold # be copied to temporary files? #james.message.usememorycopy=false + +# Mode level of resource leak detection. It is used to detect a resource not be disposed of before it's garbage-collected. +# Example `MimeMessageInputStreamSource` +# Optional. Allowed values are: none, simple, advanced, testing +# - none: Disables resource leak detection. +# - simple: Enables output a simplistic error log if a leak is encountered and would free the resources (default). +# - advanced: Enables output an advanced error log implying the place of allocation of the underlying object and would free resources. +# - testing: Enables output an advanced error log implying the place of allocation of the underlying object and rethrow an error, that action is being taken by the development team. +#james.lifecycle.leak.detection.mode=simple \ No newline at end of file diff --git a/server/apps/jpa-smtp-app/sample-configuration/jvm.properties b/server/apps/jpa-smtp-app/sample-configuration/jvm.properties index a3ddab4..ee2f346 100644 --- a/server/apps/jpa-smtp-app/sample-configuration/jvm.properties +++ b/server/apps/jpa-smtp-app/sample-configuration/jvm.properties @@ -15,4 +15,13 @@ # Optional. Boolean. Defaults to false. Recommended value is false. # Should MimeMessageWrapper use a copy of the message in memory? Or should bigger message exceeding james.message.memory.threshold # be copied to temporary files? -#james.message.usememorycopy=false \ No newline at end of file +#james.message.usememorycopy=false + +# Mode level of resource leak detection. It is used to detect a resource not be disposed of before it's garbage-collected. +# Example `MimeMessageInputStreamSource` +# Optional. Allowed values are: none, simple, advanced, testing +# - none: Disables resource leak detection. +# - simple: Enables output a simplistic error log if a leak is encountered and would free the resources (default). +# - advanced: Enables output an advanced error log implying the place of allocation of the underlying object and would free resources. +# - testing: Enables output an advanced error log implying the place of allocation of the underlying object and rethrow an error, that action is being taken by the development team. +#james.lifecycle.leak.detection.mode=simple \ No newline at end of file diff --git a/server/apps/memory-app/sample-configuration/jvm.properties b/server/apps/memory-app/sample-configuration/jvm.properties index 0b68f80..ee2f346 100644 --- a/server/apps/memory-app/sample-configuration/jvm.properties +++ b/server/apps/memory-app/sample-configuration/jvm.properties @@ -16,3 +16,12 @@ # Should MimeMessageWrapper use a copy of the message in memory? Or should bigger message exceeding james.message.memory.threshold # be copied to temporary files? #james.message.usememorycopy=false + +# Mode level of resource leak detection. It is used to detect a resource not be disposed of before it's garbage-collected. +# Example `MimeMessageInputStreamSource` +# Optional. Allowed values are: none, simple, advanced, testing +# - none: Disables resource leak detection. +# - simple: Enables output a simplistic error log if a leak is encountered and would free the resources (default). +# - advanced: Enables output an advanced error log implying the place of allocation of the underlying object and would free resources. +# - testing: Enables output an advanced error log implying the place of allocation of the underlying object and rethrow an error, that action is being taken by the development team. +#james.lifecycle.leak.detection.mode=simple \ No newline at end of file diff --git a/server/container/lifecycle-api/src/main/java/org/apache/james/lifecycle/api/Disposable.java b/server/container/lifecycle-api/src/main/java/org/apache/james/lifecycle/api/Disposable.java index bd69789..aa9d971 100644 --- a/server/container/lifecycle-api/src/main/java/org/apache/james/lifecycle/api/Disposable.java +++ b/server/container/lifecycle-api/src/main/java/org/apache/james/lifecycle/api/Disposable.java @@ -86,7 +86,7 @@ public interface Disposable { public static final ReferenceQueue<LeakAware<?>> REFERENCE_QUEUE = new ReferenceQueue<>(); public static final ConcurrentHashMap<LeakAwareFinalizer, Boolean> REFERENCES_IN_USE = new ConcurrentHashMap<>(); - public static final Level LEVEL = Optional.ofNullable(System.getProperty("james.ligecycle.leak.detection.mode")) + public static final Level LEVEL = Optional.ofNullable(System.getProperty("james.lifecycle.leak.detection.mode")) .map(Level::parse).orElse(Level.SIMPLE); public static void track() { diff --git a/src/site/xdoc/server/config-system.xml b/src/site/xdoc/server/config-system.xml index 93e520d..5e85716 100644 --- a/src/site/xdoc/server/config-system.xml +++ b/src/site/xdoc/server/config-system.xml @@ -181,6 +181,15 @@ <dt><strong>james.message.usememorycopy</strong></dt> <dd>Optional. Boolean. Defaults to false. Recommended value is false. <br/> Should MimeMessageWrapper use a copy of the message in memory? Or should bigger message exceeding james.message.memory.threshold be copied to temporary files?</dd> + + <dt><strong>james.lifecycle.leak.detection.mode</strong></dt> + <dd>Optional. Allowed values are: none, simple, advanced, testing. Defaults to simple. <br/> + Mode level of resource leak detection. It is used to detect a resource not be disposed of before it's garbage-collected. Example `MimeMessageInputStreamSource` <br/> + - none: Disables resource leak detection.<br/> + - simple: Enables output a simplistic error log if a leak is encountered and would free the resources (default). <br/> + - advanced: Enables output an advanced error log implying the place of allocation of the underlying object and would free resources. <br/> + - testing: Enables output an advanced error log implying the place of allocation of the underlying object and rethrow an error, that action is being taken by the development team. <br/> + </dd> </dl> </subsection> --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
