You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucenenet.apache.org by ni...@apache.org on 2021/11/23 04:41:51 UTC

[lucenenet] branch master updated (54c9a76 -> a7725fc)

This is an automated email from the ASF dual-hosted git repository.

nightowl888 pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/lucenenet.git.


    from 54c9a76  Patch for BlendedInfixSuggester to solve ArgumentNullException (#548) (fixes #527)
     new b613ad4  Cleaned up calls to UninterruptableMonitor.RestoreInterrupt(), which has already been removed.
     new 7097cb3  Lucene.Net.Index.TestIndexWriter, Lucene.Net.Support.Threading.TestUninterruptableMonitor: Ignore tests that call Thread.Interrupt(), as this is not supportable in .NET. Closes #544.
     new a7725fc  docs: Changed info about Thread.Interrupt() to indicate it is not supported in Lucene.NET due to the high likelihood it could break a Commit() or cause a deadlock. Closes #526.

The 3 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 src/Lucene.Net.TestFramework/Util/TestUtil.cs           |  1 -
 src/Lucene.Net.Tests/Index/TestIndexWriter.cs           |  4 ++--
 src/Lucene.Net.Tests/Index/TestIndexWriterOnJRECrash.cs |  1 -
 .../Support/Threading/TestUninterruptableMonitor.cs     |  2 ++
 src/Lucene.Net/Index/IndexWriter.cs                     | 17 +++++++++++------
 src/Lucene.Net/Store/FSDirectory.cs                     | 17 ++++++-----------
 src/Lucene.Net/Store/NIOFSDirectory.cs                  |  2 +-
 7 files changed, 22 insertions(+), 22 deletions(-)

[lucenenet] 03/03: docs: Changed info about Thread.Interrupt() to indicate it is not supported in Lucene.NET due to the high likelihood it could break a Commit() or cause a deadlock. Closes #526.

Posted by ni...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

nightowl888 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/lucenenet.git

commit a7725fc9b2890d6e41ee83c6a728aec2bc8bc302
Author: Shad Storhaug <sh...@shadstorhaug.com>
AuthorDate: Tue Nov 23 11:16:45 2021 +0700

    docs: Changed info about Thread.Interrupt() to indicate it is not supported in Lucene.NET due to the high likelihood it could break a Commit() or cause a deadlock. Closes #526.
---
 src/Lucene.Net/Index/IndexWriter.cs    | 17 +++++++++++------
 src/Lucene.Net/Store/FSDirectory.cs    | 17 ++++++-----------
 src/Lucene.Net/Store/NIOFSDirectory.cs |  2 +-
 3 files changed, 18 insertions(+), 18 deletions(-)

diff --git a/src/Lucene.Net/Index/IndexWriter.cs b/src/Lucene.Net/Index/IndexWriter.cs
index ff205c9..f0f5461 100644
--- a/src/Lucene.Net/Index/IndexWriter.cs
+++ b/src/Lucene.Net/Index/IndexWriter.cs
@@ -155,12 +155,17 @@ namespace Lucene.Net.Index
     /// this may cause deadlock; use your own (non-Lucene) objects
     /// instead. </para>
     ///
-    /// <para><b>NOTE</b>: If you call
-    /// <see cref="Thread.Interrupt()"/> on a thread that's within
-    /// <see cref="IndexWriter"/>, <see cref="IndexWriter"/> will try to catch this (eg, if
-    /// it's in a <see cref="Monitor.Wait(object)"/> or <see cref="Thread.Sleep(int)"/>), and will then throw
-    /// the unchecked exception <see cref="Util.ThreadInterruptedException"/>
-    /// and <b>clear</b> the interrupt status on the thread.</para>
+    /// <para><b>NOTE</b>:
+    /// Do not use <see cref="Thread.Interrupt()"/> on a thread that's within
+    /// <see cref="IndexWriter"/>, as .NET will throw <see cref="ThreadInterruptedException"/> on any
+    /// wait, sleep, or join including any lock statement with contention on it.
+    /// As a result, it is not practical to try to support <see cref="Thread.Interrupt()"/> due to the
+    /// chance <see cref="ThreadInterruptedException"/> could potentially be thrown in the middle of a
+    /// <see cref="Commit()"/> or somewhere in the application that will cause a deadlock.</para>
+    /// <para>
+    /// We recommend using another shutdown mechanism to safely cancel a parallel operation.
+    /// See: <a href="https://github.com/apache/lucenenet/issues/526">https://github.com/apache/lucenenet/issues/526</a>.
+    /// </para>
     /// </remarks>
 
     /*
diff --git a/src/Lucene.Net/Store/FSDirectory.cs b/src/Lucene.Net/Store/FSDirectory.cs
index b8bd548..2acf2e9 100644
--- a/src/Lucene.Net/Store/FSDirectory.cs
+++ b/src/Lucene.Net/Store/FSDirectory.cs
@@ -48,16 +48,12 @@ namespace Lucene.Net.Store
     ///         synchronizes when multiple threads read from the
     ///         same file.</description></item>
     ///
-    ///     <item><description> <see cref="NIOFSDirectory"/> uses java.nio's
-    ///         FileChannel's positional io when reading to avoid
-    ///         synchronization when reading from the same file.
-    ///         Unfortunately, due to a Windows-only <a
-    ///         href="http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6265734">Sun
-    ///         JRE bug</a> this is a poor choice for Windows, but
-    ///         on all other platforms this is the preferred
-    ///         choice. Applications using <see cref="Thread.Interrupt()"/> or
+    ///     <item><description> <see cref="NIOFSDirectory"/>
+    ///         uses <see cref="FileStream"/>'s positional read,
+    ///         which allows multiple threads to read from the same
+    ///         file without synchronizing. Applications using
     ///         <see cref="Task{TResult}"/> should use
-    ///         <see cref="SimpleFSDirectory"/> instead. See <see cref="NIOFSDirectory"/> java doc
+    ///         <see cref="SimpleFSDirectory"/> instead. See <see cref="NIOFSDirectory"/> documentation
     ///         for details.</description></item>
     ///
     ///     <item><description> <see cref="MMapDirectory"/> uses memory-mapped IO when
@@ -67,8 +63,7 @@ namespace Lucene.Net.Store
     ///         running on a 32 bit runtime but your index sizes are
     ///         small enough to fit into the virtual memory space.
     ///         <para/>
-    ///         Applications using <see cref="Thread.Interrupt()"/> or
-    ///         <see cref="Task{TResult}"/> should use
+    ///         Applications using <see cref="Task{TResult}"/> should use
     ///         <see cref="SimpleFSDirectory"/> instead. See <see cref="MMapDirectory"/>
     ///         doc for details.</description></item>
     /// </list>
diff --git a/src/Lucene.Net/Store/NIOFSDirectory.cs b/src/Lucene.Net/Store/NIOFSDirectory.cs
index e99b11b..d254baf 100644
--- a/src/Lucene.Net/Store/NIOFSDirectory.cs
+++ b/src/Lucene.Net/Store/NIOFSDirectory.cs
@@ -43,7 +43,7 @@ namespace Lucene.Net.Store
     /// underlying file descriptor immediately if at the same time the thread is
     /// blocked on IO. The file descriptor will remain closed and subsequent access
     /// to <see cref="NIOFSDirectory"/> will throw a <see cref="ObjectDisposedException"/>. If
-    /// your application uses either <see cref="System.Threading.Thread.Interrupt()"/> or
+    /// your application uses
     /// <see cref="System.Threading.Tasks.Task"/> you should use <see cref="SimpleFSDirectory"/> in
     /// favor of <see cref="NIOFSDirectory"/>.</font>
     /// </para>

[lucenenet] 02/03: Lucene.Net.Index.TestIndexWriter, Lucene.Net.Support.Threading.TestUninterruptableMonitor: Ignore tests that call Thread.Interrupt(), as this is not supportable in .NET. Closes #544.

Posted by ni...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

nightowl888 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/lucenenet.git

commit 7097cb318e28bd98675935bab8e13a11df08f7f5
Author: Shad Storhaug <sh...@shadstorhaug.com>
AuthorDate: Tue Nov 23 10:36:37 2021 +0700

    Lucene.Net.Index.TestIndexWriter, Lucene.Net.Support.Threading.TestUninterruptableMonitor: Ignore tests that call Thread.Interrupt(), as this is not supportable in .NET. Closes #544.
---
 src/Lucene.Net.Tests/Index/TestIndexWriter.cs                        | 4 ++--
 src/Lucene.Net.Tests/Support/Threading/TestUninterruptableMonitor.cs | 2 ++
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/Lucene.Net.Tests/Index/TestIndexWriter.cs b/src/Lucene.Net.Tests/Index/TestIndexWriter.cs
index 7b2f2a2..a165016 100644
--- a/src/Lucene.Net.Tests/Index/TestIndexWriter.cs
+++ b/src/Lucene.Net.Tests/Index/TestIndexWriter.cs
@@ -1476,7 +1476,7 @@ namespace Lucene.Net.Index
 
         [Test]
         [Slow]
-        [AwaitsFix(BugUrl = "https://github.com/apache/lucenenet/issues/544")] // LUCENENET TODO: This test occasionally fails
+        [Ignore("Lucene.NET does not support Thread.Interrupt(). See https://github.com/apache/lucenenet/issues/526.")]
         public virtual void TestThreadInterruptDeadlock()
         {
             IndexerThreadInterrupt t = new IndexerThreadInterrupt(this);
@@ -1517,7 +1517,7 @@ namespace Lucene.Net.Index
         /// testThreadInterruptDeadlock but with 2 indexer threads </summary>
         [Test]
         [Slow]
-        [AwaitsFix(BugUrl = "https://github.com/apache/lucenenet/issues/544")] // LUCENENET TODO: This test occasionally fails
+        [Ignore("Lucene.NET does not support Thread.Interrupt(). See https://github.com/apache/lucenenet/issues/526.")]
         public virtual void TestTwoThreadsInterruptDeadlock()
         {
             IndexerThreadInterrupt t1 = new IndexerThreadInterrupt(this);
diff --git a/src/Lucene.Net.Tests/Support/Threading/TestUninterruptableMonitor.cs b/src/Lucene.Net.Tests/Support/Threading/TestUninterruptableMonitor.cs
index 8da4b04..1a28eae 100644
--- a/src/Lucene.Net.Tests/Support/Threading/TestUninterruptableMonitor.cs
+++ b/src/Lucene.Net.Tests/Support/Threading/TestUninterruptableMonitor.cs
@@ -237,6 +237,7 @@ namespace Lucene.Net.Support
 
         [Test, LuceneNetSpecific]
         [Slow]
+        [Ignore("Lucene.NET does not support Thread.Interrupt(). See https://github.com/apache/lucenenet/issues/526.")]
         public virtual void TestThreadInterrupt()
         {
             TransactionlThreadInterrupt t = new TransactionlThreadInterrupt();
@@ -270,6 +271,7 @@ namespace Lucene.Net.Support
 
         [Test, LuceneNetSpecific]
         [Slow]
+        [Ignore("Lucene.NET does not support Thread.Interrupt(). See https://github.com/apache/lucenenet/issues/526.")]
         public virtual void TestTwoThreadsInterrupt()
         {
             TransactionlThreadInterrupt t1 = new TransactionlThreadInterrupt();

[lucenenet] 01/03: Cleaned up calls to UninterruptableMonitor.RestoreInterrupt(), which has already been removed.

Posted by ni...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

nightowl888 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/lucenenet.git

commit b613ad427e6ba939fa8d5452096b683f7a57fdfa
Author: Shad Storhaug <sh...@shadstorhaug.com>
AuthorDate: Tue Nov 23 10:34:23 2021 +0700

    Cleaned up calls to UninterruptableMonitor.RestoreInterrupt(), which has already been removed.
---
 src/Lucene.Net.TestFramework/Util/TestUtil.cs           | 1 -
 src/Lucene.Net.Tests/Index/TestIndexWriterOnJRECrash.cs | 1 -
 2 files changed, 2 deletions(-)

diff --git a/src/Lucene.Net.TestFramework/Util/TestUtil.cs b/src/Lucene.Net.TestFramework/Util/TestUtil.cs
index c159b15..1802d1f 100644
--- a/src/Lucene.Net.TestFramework/Util/TestUtil.cs
+++ b/src/Lucene.Net.TestFramework/Util/TestUtil.cs
@@ -864,7 +864,6 @@ namespace Lucene.Net.Util
         //    {
         //      try
         //      {
-        //        UninterruptableMonitor.RestoreInterrupt();
         //        ex.shutdown();
         //        ex.awaitTermination(1, TimeUnit.SECONDS);
         //      }
diff --git a/src/Lucene.Net.Tests/Index/TestIndexWriterOnJRECrash.cs b/src/Lucene.Net.Tests/Index/TestIndexWriterOnJRECrash.cs
index 60d5268..4263748 100644
--- a/src/Lucene.Net.Tests/Index/TestIndexWriterOnJRECrash.cs
+++ b/src/Lucene.Net.Tests/Index/TestIndexWriterOnJRECrash.cs
@@ -106,7 +106,6 @@
 //            {
 //                try
 //                {
-//                    UninterruptableMonitor.RestoreInterrupt();
 //                    Thread.Sleep(CrashTime);
 //                }
 //                catch (Exception e) when (e.IsInterruptedException())