<div dir="ltr"><div class="gmail_quote">(forwarding for posterity as I didn't reply all)</div><div class="gmail_quote"><br><div dir="ltr">Hi Brian,<div><br></div><div>I filed an enhancement issue with internal review ID 9076868.</div><div><br></div><div>I would consider introducing a system property that, if set, is used to populate the limit, with the default remaining at 512. This is because:</div><div>* File system watching often already requires user configuration (e.g. bumping the default inotify limits on Linux).</div><div>* The end user of a JVM-based application knows which scale they operate the application on and what the IO/CPU capabilities of the machine running the application are.</div><div><br></div><div>An alternative could be to make this configurable on a per-WatchService basis, but that would also require code changes before end users get to benefit from the ability to increase the limit.</div><div><br></div><div>(This is my first enhancement request, so I apologize for not knowing the processes that well. Thanks for the link!)</div><div><br></div><div>Best,</div><div>Fabian</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, Apr 10, 2024 at 6:07 PM Brian Burkhalter <<a href="mailto:brian.burkhalter@oracle.com" target="_blank">brian.burkhalter@oracle.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">



<div>
Hello Fabian,
<div><br>
</div>
<div>Do you have any idea of how you might want to implement this or of how we might do it if we were to pick up the task? In any case, an enhancement issue should be filed [1].</div>
<div><br>
</div>
<div>Thanks,</div>
<div><br>
</div>
<div>Brian</div>
<div><br>
</div>
<div>[1] <a href="https://openjdk.org/guide/#filing-an-issue" target="_blank">https://openjdk.org/guide/#filing-an-issue</a><br id="m_3593098605502477107m_-2924196772204114828lineBreakAtBeginningOfMessage">
<div><br>
<blockquote type="cite">
<div>On Apr 10, 2024, at 8:35 AM, Fabian Meumertzheim <<a href="mailto:fabian@buildbuddy.io" target="_blank">fabian@buildbuddy.io</a>> wrote:</div>
<br>
<div><span style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;text-decoration:none;float:none;display:inline">When
 using WatchService to watch a directory, the AbstractWatchKey#MAX_EVENT_LIST_SIZE constant (value: 512) makes it so that e.g. creating 1000 files in a single watched directory inevitably results in an OVERFLOW event.</span>
<div style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;text-decoration:none">
<br>
</div>
<div style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;text-decoration:none">
The build system Bazel (<a href="https://github.com/bazelbuild/bazel" target="_blank">https://github.com/bazelbuild/bazel</a>) relies on the JVM's WatchService mechanism for all its file system watches on Linux. Since many Bazel users work with big monorepos, they tend to
 get into situations where switching Git branches causes the hard-coded limit to be hit frequently.</div>
<div style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;text-decoration:none">
<br>
</div>
<div style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;text-decoration:none">
The constant comes with a comment saying "(in the future this may be tunable)". Would a contribution be welcome that makes this limit tunable via a system property (or some other mechanism)?</div>
</div>
</blockquote>
</div>
<br>
</div>
</div>

</blockquote></div>
</div></div>