You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "olsavmic (via GitHub)" <gi...@apache.org> on 2024/08/29 12:40:46 UTC

[I] Too many JVM options resulting in no-reuse of daemons [maven-mvnd]

olsavmic opened a new issue, #1119:
URL: https://github.com/apache/maven-mvnd/issues/1119

   Given the following artificially constructed `.mvn/jvm.config`, the daemons are NEVER reused.
   
   ```
   --add-opens java.base/java.util.concurrent=ALL-UNNAMED
   --add-opens java.base/java.util.concurrent=ALL-UNNAMED
   --add-opens java.base/java.util.concurrent=ALL-UNNAMED
   --add-opens java.base/java.util.concurrent=ALL-UNNAMED
   --add-opens java.base/java.util.concurrent=ALL-UNNAMED
   --add-opens java.base/java.util.concurrent=ALL-UNNAMED
   --add-opens java.base/java.util.concurrent=ALL-UNNAMED
   --add-opens java.base/java.util.concurrent=ALL-UNNAMED
   --add-opens java.base/java.util.concurrent=ALL-UNNAMED
   --add-opens java.base/java.util.concurrent=ALL-UNNAMED
   --add-opens java.base/java.util.concurrent=ALL-UNNAMED
   --add-opens java.base/java.util.concurrent=ALL-UNNAMED
   --add-opens java.base/java.util.concurrent=ALL-UNNAMED
   --add-opens java.base/java.util.concurrent=ALL-UNNAMED
   --add-opens java.base/java.util.concurrent=ALL-UNNAMED
   --add-opens java.base/java.util.concurrent=ALL-UNNAMED
   --add-opens java.base/java.util.concurrent=ALL-UNNAMED
   --add-opens java.base/java.util.concurrent=ALL-UNNAMED
   --add-opens java.base/java.util.concurrent=ALL-UNNAMED
   
   ```
   
   Removing a single line in this config immediately results in correct daemon reuse.
   We have discovered that it does not matter what JVM options are used, it's only related to the total length of options.  


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] Too many JVM options resulting in no-reuse of daemons [maven-mvnd]

Posted by "ppalaga (via GitHub)" <gi...@apache.org>.
ppalaga commented on issue #1119:
URL: https://github.com/apache/maven-mvnd/issues/1119#issuecomment-2320519142

   > storing a digest of the JVM properties would be sufficient.
   
   That would solve the problem, but I am not sure the perf penalty on every mvnd invocation is worth of it? After all, 99% of builds have none or just a few props. I'd say the memory penalty should be rather paid by folks having many props. 
   
   @olsavmic I wonder, what would be the limit in bytes that would solve this for you?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] Too many JVM options resulting in no-reuse of daemons [maven-mvnd]

Posted by "olsavmic (via GitHub)" <gi...@apache.org>.
olsavmic commented on issue #1119:
URL: https://github.com/apache/maven-mvnd/issues/1119#issuecomment-2317559424

   The root cause is that options are capped at 1024 bytes in `org.mvndaemon.mvnd.common.DaemonRegistry#writeString` and the fact that all JVM options are passed as a single JVM options param.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] Too many JVM options resulting in no-reuse of daemons [maven-mvnd]

Posted by "slachiewicz (via GitHub)" <gi...@apache.org>.
slachiewicz commented on issue #1119:
URL: https://github.com/apache/maven-mvnd/issues/1119#issuecomment-6249609356

   The registry no longer truncates daemon options at 1024 bytes since https://github.com/apache/maven-mvnd/pull/1281 (1.0.3 on 1.x, 2.0.0-rc-3 on 2.x). Please reopen with the daemon version if daemons are still not reused.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] Too many JVM options resulting in no-reuse of daemons [maven-mvnd]

Posted by "gnodet (via GitHub)" <gi...@apache.org>.
gnodet commented on issue #1119:
URL: https://github.com/apache/maven-mvnd/issues/1119#issuecomment-2318225270

   We can raise the limit, but we need to raise the global registry size limit too:
   https://github.com/apache/maven-mvnd/blob/50653ae7d92badef15d42151b7df3f827f9a8678/common/src/main/java/org/mvndaemon/mvnd/common/DaemonRegistry.java#L59
   The registry should be kept small and not used to store random strings, as it's kept in memory.
   That's why the only "long" string was cut I think (it's usually the stop _reason_).  I wonder if storing a digest of the JVM properties would be sufficient...


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] Too many JVM options resulting in no-reuse of daemons [maven-mvnd]

Posted by "olsavmic (via GitHub)" <gi...@apache.org>.
olsavmic commented on issue #1119:
URL: https://github.com/apache/maven-mvnd/issues/1119#issuecomment-2320773035

   > private static final int MAX_LENGTH = 32768; 
   
   Looking at the implementation, it actually seems that the constant is not named correctly. The code already supports resizing of the buffer based on the needs (both up and down). The MAX_LENGTH is just a default value MIN value.
   
   @ppalaga 
   > @olsavmic I wonder, what would be the limit in bytes that would solve this for you?
   From the practical standpoint, I doubt we will ever go over 2x the current limit. We're just slightly over the limit in one of our projects due the `--add-opens` requirements of the static analysis libs we're using.
   
   Given the auto-resizing buffer logic, I'd argue that switching to `Short.MAX_VALUE` is a good solution for all real-world projects. 


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] Too many JVM options resulting in no-reuse of daemons [maven-mvnd]

Posted by "ppalaga (via GitHub)" <gi...@apache.org>.
ppalaga commented on issue #1119:
URL: https://github.com/apache/maven-mvnd/issues/1119#issuecomment-2317960745

   @gnodet do you remember, why we have that limit? I see it is supposed to solve https://github.com/apache/maven-mvnd/issues/433 and https://github.com/apache/maven-mvnd/issues/432 but it is not obvious why the limit is 1024. We could allow up to Short.MAX_VALUE, no? Or even store the length as int. 


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] Too many JVM options resulting in no-reuse of daemons [maven-mvnd]

Posted by "ppalaga (via GitHub)" <gi...@apache.org>.
ppalaga commented on issue #1119:
URL: https://github.com/apache/maven-mvnd/issues/1119#issuecomment-2321099709

   Sounds good to me. Would you like to send a PR with a test?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] Too many JVM options resulting in no-reuse of daemons [maven-mvnd]

Posted by "slachiewicz (via GitHub)" <gi...@apache.org>.
slachiewicz closed issue #1119: Too many JVM options resulting in no-reuse of daemons 
URL: https://github.com/apache/maven-mvnd/issues/1119


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org