dweiss commented on code in PR #12223:
URL: https://github.com/apache/lucene/pull/12223#discussion_r1156766765
##########
lucene/core/src/test/org/apache/lucene/index/TestDocumentsWriterDeleteQueue.java:
##########
@@ -30,10 +30,13 @@
import org.apache.lucene.tests.util.LuceneTestCase;
import org.apache.lucene.util.BytesRefBuilder;
import org.apache.lucene.util.ThreadInterruptedException;
+import org.junit.Ignore;
/** Unit test for {@link DocumentsWriterDeleteQueue} */
public class TestDocumentsWriterDeleteQueue extends LuceneTestCase {
+ /* Ignored because System.gc() is not reliable */
Review Comment:
System.gc() is reliable: its contract says it does not have to be
synchronous (or may not invoke garbage collector at all). :)
Perhaps a better way than to ignore the test would be to write the test so
that it's aware of the number of times the gc ran? There are JMX beans that may
be helpful here - you could invoke gc and then check the number of objects
pending finalization; once it's dropped, proceed to check the test's
assumptions.
https://docs.oracle.com/javase/7/docs/api/java/lang/management/MemoryMXBean.html
This said, I don't think any test will be 100% reliable because of the very
nature of weak references and the liberty the JVM has in wiping them out, so
perhaps it's a good idea to remove the test altogether (rather than marking it
ignored)?
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]