You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hc.apache.org by ol...@apache.org on 2008/06/15 14:50:40 UTC

svn commit: r667954 - in /httpcomponents/httpcore/trunk: RELEASE_NOTES.txt module-nio/src/main/java/org/apache/http/impl/nio/reactor/AbstractMultiworkerIOReactor.java

Author: olegk
Date: Sun Jun 15 05:50:39 2008
New Revision: 667954

URL: http://svn.apache.org/viewvc?rev=667954&view=rev
Log:
HTTPCORE-163: Fixed AbstractMultiworkerIOReactor#execute() to correctly propagate the original I/O exception in case of an abnormal termination. 
Contributed by Patrick Moore <patmoore at ieee.org> 
Reviewed by Oleg Kalnichevski


Modified:
    httpcomponents/httpcore/trunk/RELEASE_NOTES.txt
    httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/impl/nio/reactor/AbstractMultiworkerIOReactor.java

Modified: httpcomponents/httpcore/trunk/RELEASE_NOTES.txt
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/RELEASE_NOTES.txt?rev=667954&r1=667953&r2=667954&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/RELEASE_NOTES.txt (original)
+++ httpcomponents/httpcore/trunk/RELEASE_NOTES.txt Sun Jun 15 05:50:39 2008
@@ -10,18 +10,22 @@
 
 All upstream projects dependent on HttpCore NIO are strongly advised to upgrade.
 
+* [HTTPCORE-163] Fixed AbstractMultiworkerIOReactor#execute() to correctly 
+  propagate the original I/O exception in case of an abnormal termination. 
+  Contributed by Patrick Moore <patmoore at ieee.org> 
+
 * Changed behavior of IdentityDecoder & LengthDelimitedDecoder to throw
   an IOException if data is attempted to be written beyond the length
   of a FileChannel.  Previously would write nothing.
-  Sam Berlin <sberlin at apache.org>
+  Contributed by Sam Berlin <sberlin at apache.org>
 
 * Fixed bug in LengthDelimitedDecoder & IdentityDecoder that caused transfers
   to a FileChannel to overwrite arbitrary parts of the file, if data was
   buffered in SessionInputBuffer.
-  Sam Berlin <sberlin at apache.org>
+  Contributed by Sam Berlin <sberlin at apache.org>
 
 * Fixed concurrency bug in the ThrottlingHttpServerHandler protocol handler.
-  Oleg Kalnichevski <olegk at apache.org> 
+  Contributed by Oleg Kalnichevski <olegk at apache.org> 
 
 * Fixed bug in SharedInputBuffer that caused input events to be
   incorrectly suspended.

Modified: httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/impl/nio/reactor/AbstractMultiworkerIOReactor.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/impl/nio/reactor/AbstractMultiworkerIOReactor.java?rev=667954&r1=667953&r2=667954&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/impl/nio/reactor/AbstractMultiworkerIOReactor.java (original)
+++ httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/impl/nio/reactor/AbstractMultiworkerIOReactor.java Sun Jun 15 05:50:39 2008
@@ -142,6 +142,7 @@
             this.threads[i].start();
         }
         
+        boolean completed = false;
         try {
 
             for (;;) {
@@ -155,6 +156,7 @@
                 }
                 
                 if (this.status.compareTo(IOReactorStatus.ACTIVE) > 0) {
+                    completed = true;
                     break;
                 }
                 processEvents(readyCount);
@@ -180,11 +182,12 @@
 
         } catch (ClosedSelectorException ex) {
         } finally {
-            // Shutdown
             try {
                 doShutdown();
             } catch (IOException ex) {
-                throw new IOReactorException(ex.getMessage(), ex);
+                if (completed) {
+                    throw new IOReactorException(ex.getMessage(), ex);
+                }
             }
         }
     }



Re: svn commit: r667954

Posted by sebb <se...@gmail.com>.
On 15/06/2008, Oleg Kalnichevski <ol...@apache.org> wrote:
> On Sun, 2008-06-15 at 15:31 +0100, sebb wrote:
>  > On 15/06/2008, olegk@apache.org <ol...@apache.org> wrote:
>  > > Author: olegk
>  > >  Date: Sun Jun 15 05:50:39 2008
>  > >  New Revision: 667954
>  > >
>  > >  URL: http://svn.apache.org/viewvc?rev=667954&view=rev
>  > >  Log:
>  > >  HTTPCORE-163: Fixed AbstractMultiworkerIOReactor#execute() to correctly propagate the original I/O exception in case of an abnormal termination.
>  > >  Contributed by Patrick Moore <patmoore at ieee.org>
>  > >  Reviewed by Oleg Kalnichevski
>  > >
>
>  ...
>
>  > >
>  > >  @@ -155,6 +156,7 @@
>  > >                  }
>  > >
>  > >                  if (this.status.compareTo(IOReactorStatus.ACTIVE) > 0) {
>  > >  +                    completed = true;
>  > >                      break;
>  > >                  }
>  > >                  processEvents(readyCount);
>  > >  @@ -180,11 +182,12 @@
>  > >
>  > >          } catch (ClosedSelectorException ex) {
>  >
>  > The exception is still ignored - or am I missing something here?
>  >
>  > I think there should at least be a comment to say why it can be ignored.
>  >
>
>  I think it is ok to ignore this exception. It is thrown when an
>  operation is attempted on a closed selector, which means the i/o reactor
>  is in the process of being shut down.
>
>  I'll add a comment to that effect.
>

OK, thanks.

The JIRA issue mentioned an ignored exception so I was surprised when
it was still ignored  after the patch was applied...

Also, ignored exceptions tend to trigger bug warnings, so having a
comment will help in future.

>  Oleg
>
>
>  ---------------------------------------------------------------------
>  To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
>  For additional commands, e-mail: dev-help@hc.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org


Re: svn commit: r667954

Posted by Oleg Kalnichevski <ol...@apache.org>.
On Sun, 2008-06-15 at 15:31 +0100, sebb wrote:
> On 15/06/2008, olegk@apache.org <ol...@apache.org> wrote:
> > Author: olegk
> >  Date: Sun Jun 15 05:50:39 2008
> >  New Revision: 667954
> >
> >  URL: http://svn.apache.org/viewvc?rev=667954&view=rev
> >  Log:
> >  HTTPCORE-163: Fixed AbstractMultiworkerIOReactor#execute() to correctly propagate the original I/O exception in case of an abnormal termination.
> >  Contributed by Patrick Moore <patmoore at ieee.org>
> >  Reviewed by Oleg Kalnichevski
> >

...

> >
> >  @@ -155,6 +156,7 @@
> >                  }
> >
> >                  if (this.status.compareTo(IOReactorStatus.ACTIVE) > 0) {
> >  +                    completed = true;
> >                      break;
> >                  }
> >                  processEvents(readyCount);
> >  @@ -180,11 +182,12 @@
> >
> >          } catch (ClosedSelectorException ex) {
> 
> The exception is still ignored - or am I missing something here?
> 
> I think there should at least be a comment to say why it can be ignored.
> 

I think it is ok to ignore this exception. It is thrown when an
operation is attempted on a closed selector, which means the i/o reactor
is in the process of being shut down.

I'll add a comment to that effect.

Oleg


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org


Re: svn commit: r667954 - in /httpcomponents/httpcore/trunk: RELEASE_NOTES.txt module-nio/src/main/java/org/apache/http/impl/nio/reactor/AbstractMultiworkerIOReactor.java

Posted by sebb <se...@gmail.com>.
On 15/06/2008, olegk@apache.org <ol...@apache.org> wrote:
> Author: olegk
>  Date: Sun Jun 15 05:50:39 2008
>  New Revision: 667954
>
>  URL: http://svn.apache.org/viewvc?rev=667954&view=rev
>  Log:
>  HTTPCORE-163: Fixed AbstractMultiworkerIOReactor#execute() to correctly propagate the original I/O exception in case of an abnormal termination.
>  Contributed by Patrick Moore <patmoore at ieee.org>
>  Reviewed by Oleg Kalnichevski
>
>
>  Modified:
>     httpcomponents/httpcore/trunk/RELEASE_NOTES.txt
>     httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/impl/nio/reactor/AbstractMultiworkerIOReactor.java
>
>  Modified: httpcomponents/httpcore/trunk/RELEASE_NOTES.txt
>  URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/RELEASE_NOTES.txt?rev=667954&r1=667953&r2=667954&view=diff
>  ==============================================================================
>  --- httpcomponents/httpcore/trunk/RELEASE_NOTES.txt (original)
>  +++ httpcomponents/httpcore/trunk/RELEASE_NOTES.txt Sun Jun 15 05:50:39 2008
>  @@ -10,18 +10,22 @@
>
>   All upstream projects dependent on HttpCore NIO are strongly advised to upgrade.
>
>  +* [HTTPCORE-163] Fixed AbstractMultiworkerIOReactor#execute() to correctly
>  +  propagate the original I/O exception in case of an abnormal termination.
>  +  Contributed by Patrick Moore <patmoore at ieee.org>
>  +
>   * Changed behavior of IdentityDecoder & LengthDelimitedDecoder to throw
>    an IOException if data is attempted to be written beyond the length
>    of a FileChannel.  Previously would write nothing.
>  -  Sam Berlin <sberlin at apache.org>
>  +  Contributed by Sam Berlin <sberlin at apache.org>
>
>   * Fixed bug in LengthDelimitedDecoder & IdentityDecoder that caused transfers
>    to a FileChannel to overwrite arbitrary parts of the file, if data was
>    buffered in SessionInputBuffer.
>  -  Sam Berlin <sberlin at apache.org>
>  +  Contributed by Sam Berlin <sberlin at apache.org>
>
>   * Fixed concurrency bug in the ThrottlingHttpServerHandler protocol handler.
>  -  Oleg Kalnichevski <olegk at apache.org>
>  +  Contributed by Oleg Kalnichevski <olegk at apache.org>
>
>   * Fixed bug in SharedInputBuffer that caused input events to be
>    incorrectly suspended.
>
>  Modified: httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/impl/nio/reactor/AbstractMultiworkerIOReactor.java
>  URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/impl/nio/reactor/AbstractMultiworkerIOReactor.java?rev=667954&r1=667953&r2=667954&view=diff
>  ==============================================================================
>  --- httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/impl/nio/reactor/AbstractMultiworkerIOReactor.java (original)
>  +++ httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/impl/nio/reactor/AbstractMultiworkerIOReactor.java Sun Jun 15 05:50:39 2008
>  @@ -142,6 +142,7 @@
>              this.threads[i].start();
>          }
>
>  +        boolean completed = false;
>          try {
>
>              for (;;) {
>  @@ -155,6 +156,7 @@
>                  }
>
>                  if (this.status.compareTo(IOReactorStatus.ACTIVE) > 0) {
>  +                    completed = true;
>                      break;
>                  }
>                  processEvents(readyCount);
>  @@ -180,11 +182,12 @@
>
>          } catch (ClosedSelectorException ex) {

The exception is still ignored - or am I missing something here?

I think there should at least be a comment to say why it can be ignored.

>          } finally {
>  -            // Shutdown
>              try {
>                  doShutdown();
>              } catch (IOException ex) {
>  -                throw new IOReactorException(ex.getMessage(), ex);
>  +                if (completed) {
>  +                    throw new IOReactorException(ex.getMessage(), ex);
>  +                }
>              }
>          }
>      }
>
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org