You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hc.apache.org by "Anders Wallgren (JIRA)" <ji...@apache.org> on 2007/01/24 02:06:49 UTC

[jira] Created: (HTTPCORE-29) DefaultConnectingIOReactor.execute propagates IOException, but isn't really re-callable

DefaultConnectingIOReactor.execute propagates IOException, but isn't really re-callable
---------------------------------------------------------------------------------------

                 Key: HTTPCORE-29
                 URL: https://issues.apache.org/jira/browse/HTTPCORE-29
             Project: HttpComponents Core
          Issue Type: Bug
          Components: HttpCore NIO
    Affects Versions: 4.0-alpha3
            Reporter: Anders Wallgren


I'm trying to figure out what to do when DefaultConnectingIOReactor.execute throws an exception.  It doesn't seem like I can just call execute() again after handling the exception, since that will recreate all the state in DCIOR.

Seems to me that there needs to be a different way to handle exceptions, or the execute method should be callable more than once.

For reference, here's the stack trace of an exception:
{code}
2007-01-23T16:23:19.800 | ERROR | urceInvoker |                                               | NewResourceInvoker             | Invalid argument: sun.nio.ch.Net.setIntOption
java.net.SocketException: Invalid argument: sun.nio.ch.Net.setIntOption
	at sun.nio.ch.Net.setIntOption0(Native Method)
	at sun.nio.ch.Net.setIntOption(Net.java:154)
	at sun.nio.ch.SocketChannelImpl$1.setInt(SocketChannelImpl.java:406)
	at sun.nio.ch.SocketOptsImpl.setBoolean(SocketOptsImpl.java:38)
	at sun.nio.ch.SocketOptsImpl$IP$TCP.noDelay(SocketOptsImpl.java:284)
	at sun.nio.ch.OptionAdaptor.setTcpNoDelay(OptionAdaptor.java:48)
	at sun.nio.ch.SocketAdaptor.setTcpNoDelay(SocketAdaptor.java:268)
	at org.apache.http.nio.impl.reactor.DefaultConnectingIOReactor.prepareSocket(DefaultConnectingIOReactor.java:171)
	at org.apache.http.nio.impl.reactor.DefaultConnectingIOReactor.processEvent(DefaultConnectingIOReactor.java:158)
	at org.apache.http.nio.impl.reactor.DefaultConnectingIOReactor.processEvents(DefaultConnectingIOReactor.java:134)
	at org.apache.http.nio.impl.reactor.DefaultConnectingIOReactor.execute(DefaultConnectingIOReactor.java:94)
	at com.electriccloud.commander.domain.NewResourceInvoker.innerRun(NewResourceInvoker.java:304)
	at com.electriccloud.util.FailsafeRunnable.run(FailsafeRunnable.java:105)
	at java.lang.Thread.run(Thread.java:619)
{code}


-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


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


[jira] Reopened: (HTTPCORE-29) DefaultConnectingIOReactor.execute propagates IOException, but isn't really re-callable

Posted by "Oleg Kalnichevski (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/HTTPCORE-29?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Oleg Kalnichevski reopened HTTPCORE-29:
---------------------------------------

      Assignee: Oleg Kalnichevski

> DefaultConnectingIOReactor.execute propagates IOException, but isn't really re-callable
> ---------------------------------------------------------------------------------------
>
>                 Key: HTTPCORE-29
>                 URL: https://issues.apache.org/jira/browse/HTTPCORE-29
>             Project: HttpComponents Core
>          Issue Type: Bug
>          Components: HttpCore NIO
>    Affects Versions: 4.0-alpha3
>            Reporter: Anders Wallgren
>         Assigned To: Oleg Kalnichevski
>             Fix For: 4.0-alpha4
>
>
> I'm trying to figure out what to do when DefaultConnectingIOReactor.execute throws an exception.  It doesn't seem like I can just call execute() again after handling the exception, since that will recreate all the state in DCIOR.
> Seems to me that there needs to be a different way to handle exceptions, or the execute method should be callable more than once.
> For reference, here's the stack trace of an exception:
> {code}
> 2007-01-23T16:23:19.800 | ERROR | urceInvoker |                                               | NewResourceInvoker             | Invalid argument: sun.nio.ch.Net.setIntOption
> java.net.SocketException: Invalid argument: sun.nio.ch.Net.setIntOption
> 	at sun.nio.ch.Net.setIntOption0(Native Method)
> 	at sun.nio.ch.Net.setIntOption(Net.java:154)
> 	at sun.nio.ch.SocketChannelImpl$1.setInt(SocketChannelImpl.java:406)
> 	at sun.nio.ch.SocketOptsImpl.setBoolean(SocketOptsImpl.java:38)
> 	at sun.nio.ch.SocketOptsImpl$IP$TCP.noDelay(SocketOptsImpl.java:284)
> 	at sun.nio.ch.OptionAdaptor.setTcpNoDelay(OptionAdaptor.java:48)
> 	at sun.nio.ch.SocketAdaptor.setTcpNoDelay(SocketAdaptor.java:268)
> 	at org.apache.http.nio.impl.reactor.DefaultConnectingIOReactor.prepareSocket(DefaultConnectingIOReactor.java:171)
> 	at org.apache.http.nio.impl.reactor.DefaultConnectingIOReactor.processEvent(DefaultConnectingIOReactor.java:158)
> 	at org.apache.http.nio.impl.reactor.DefaultConnectingIOReactor.processEvents(DefaultConnectingIOReactor.java:134)
> 	at org.apache.http.nio.impl.reactor.DefaultConnectingIOReactor.execute(DefaultConnectingIOReactor.java:94)
> 	at com.electriccloud.commander.domain.NewResourceInvoker.innerRun(NewResourceInvoker.java:304)
> 	at com.electriccloud.util.FailsafeRunnable.run(FailsafeRunnable.java:105)
> 	at java.lang.Thread.run(Thread.java:619)
> {code}

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


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


[jira] Commented: (HTTPCORE-29) DefaultConnectingIOReactor.execute propagates IOException, but isn't really re-callable

Posted by "Oleg Kalnichevski (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HTTPCORE-29?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12467675 ] 

Oleg Kalnichevski commented on HTTPCORE-29:
-------------------------------------------

> The session that had the problem should be shut down, but the reactor should not fail
Anders,
Once a new session is open it gets immediately passed onto a dedicated I/O thread. The selector on the main thread is used exclusively to open new sessions, while I/O events of running sessions are managed by selectors on separate I/O threads. Should any session throw an IO exception it would trigger an event on the dispatch interface but would definitely not shut down the I/O reactor along with other active sessions.  The execute method can terminate with an I/O exception only if the main selector is for some reason unable to open new sessions, which in my opinion is a problem severe enough to warrant the shutdown of the I/O reactor. 

I'll review the code one more time, but I do not think the I/O reactor can actually throw any IO exception that can be automatically recovered from. Can you provide me with a stack trace of an exception that you think should be recovered from automatically? 

Oleg

> DefaultConnectingIOReactor.execute propagates IOException, but isn't really re-callable
> ---------------------------------------------------------------------------------------
>
>                 Key: HTTPCORE-29
>                 URL: https://issues.apache.org/jira/browse/HTTPCORE-29
>             Project: HttpComponents Core
>          Issue Type: Bug
>          Components: HttpCore NIO
>    Affects Versions: 4.0-alpha3
>            Reporter: Anders Wallgren
>         Assigned To: Oleg Kalnichevski
>             Fix For: 4.0-alpha4
>
>
> I'm trying to figure out what to do when DefaultConnectingIOReactor.execute throws an exception.  It doesn't seem like I can just call execute() again after handling the exception, since that will recreate all the state in DCIOR.
> Seems to me that there needs to be a different way to handle exceptions, or the execute method should be callable more than once.
> For reference, here's the stack trace of an exception:
> {code}
> 2007-01-23T16:23:19.800 | ERROR | urceInvoker |                                               | NewResourceInvoker             | Invalid argument: sun.nio.ch.Net.setIntOption
> java.net.SocketException: Invalid argument: sun.nio.ch.Net.setIntOption
> 	at sun.nio.ch.Net.setIntOption0(Native Method)
> 	at sun.nio.ch.Net.setIntOption(Net.java:154)
> 	at sun.nio.ch.SocketChannelImpl$1.setInt(SocketChannelImpl.java:406)
> 	at sun.nio.ch.SocketOptsImpl.setBoolean(SocketOptsImpl.java:38)
> 	at sun.nio.ch.SocketOptsImpl$IP$TCP.noDelay(SocketOptsImpl.java:284)
> 	at sun.nio.ch.OptionAdaptor.setTcpNoDelay(OptionAdaptor.java:48)
> 	at sun.nio.ch.SocketAdaptor.setTcpNoDelay(SocketAdaptor.java:268)
> 	at org.apache.http.nio.impl.reactor.DefaultConnectingIOReactor.prepareSocket(DefaultConnectingIOReactor.java:171)
> 	at org.apache.http.nio.impl.reactor.DefaultConnectingIOReactor.processEvent(DefaultConnectingIOReactor.java:158)
> 	at org.apache.http.nio.impl.reactor.DefaultConnectingIOReactor.processEvents(DefaultConnectingIOReactor.java:134)
> 	at org.apache.http.nio.impl.reactor.DefaultConnectingIOReactor.execute(DefaultConnectingIOReactor.java:94)
> 	at com.electriccloud.commander.domain.NewResourceInvoker.innerRun(NewResourceInvoker.java:304)
> 	at com.electriccloud.util.FailsafeRunnable.run(FailsafeRunnable.java:105)
> 	at java.lang.Thread.run(Thread.java:619)
> {code}

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


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


[jira] Commented: (HTTPCORE-29) DefaultConnectingIOReactor.execute propagates IOException, but isn't really re-callable

Posted by "Anders Wallgren (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HTTPCORE-29?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12467477 ] 

Anders Wallgren commented on HTTPCORE-29:
-----------------------------------------

Your patches fixes this instance.  However, it doesn't address the underlying issue: execute() will throw IOExceptions (as declared), after which the IOReactor is dead -- I can't call execute() again. 

What happens to existing connections in this case?  Are they abandoned?

It seems to me that this class should be designed to be robust, and suitable for use in a long-running environment.  As it is currently, it is not.

> DefaultConnectingIOReactor.execute propagates IOException, but isn't really re-callable
> ---------------------------------------------------------------------------------------
>
>                 Key: HTTPCORE-29
>                 URL: https://issues.apache.org/jira/browse/HTTPCORE-29
>             Project: HttpComponents Core
>          Issue Type: Bug
>          Components: HttpCore NIO
>    Affects Versions: 4.0-alpha3
>            Reporter: Anders Wallgren
>             Fix For: 4.0-alpha4
>
>
> I'm trying to figure out what to do when DefaultConnectingIOReactor.execute throws an exception.  It doesn't seem like I can just call execute() again after handling the exception, since that will recreate all the state in DCIOR.
> Seems to me that there needs to be a different way to handle exceptions, or the execute method should be callable more than once.
> For reference, here's the stack trace of an exception:
> {code}
> 2007-01-23T16:23:19.800 | ERROR | urceInvoker |                                               | NewResourceInvoker             | Invalid argument: sun.nio.ch.Net.setIntOption
> java.net.SocketException: Invalid argument: sun.nio.ch.Net.setIntOption
> 	at sun.nio.ch.Net.setIntOption0(Native Method)
> 	at sun.nio.ch.Net.setIntOption(Net.java:154)
> 	at sun.nio.ch.SocketChannelImpl$1.setInt(SocketChannelImpl.java:406)
> 	at sun.nio.ch.SocketOptsImpl.setBoolean(SocketOptsImpl.java:38)
> 	at sun.nio.ch.SocketOptsImpl$IP$TCP.noDelay(SocketOptsImpl.java:284)
> 	at sun.nio.ch.OptionAdaptor.setTcpNoDelay(OptionAdaptor.java:48)
> 	at sun.nio.ch.SocketAdaptor.setTcpNoDelay(SocketAdaptor.java:268)
> 	at org.apache.http.nio.impl.reactor.DefaultConnectingIOReactor.prepareSocket(DefaultConnectingIOReactor.java:171)
> 	at org.apache.http.nio.impl.reactor.DefaultConnectingIOReactor.processEvent(DefaultConnectingIOReactor.java:158)
> 	at org.apache.http.nio.impl.reactor.DefaultConnectingIOReactor.processEvents(DefaultConnectingIOReactor.java:134)
> 	at org.apache.http.nio.impl.reactor.DefaultConnectingIOReactor.execute(DefaultConnectingIOReactor.java:94)
> 	at com.electriccloud.commander.domain.NewResourceInvoker.innerRun(NewResourceInvoker.java:304)
> 	at com.electriccloud.util.FailsafeRunnable.run(FailsafeRunnable.java:105)
> 	at java.lang.Thread.run(Thread.java:619)
> {code}

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


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


[jira] Commented: (HTTPCORE-29) DefaultConnectingIOReactor.execute propagates IOException, but isn't really re-callable

Posted by "Oleg Kalnichevski (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HTTPCORE-29?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12467512 ] 

Oleg Kalnichevski commented on HTTPCORE-29:
-------------------------------------------

Anders,

I tend to see all IOExceptions thrown within the execute method as fatal. So, are you suggesting that the I/O reactor should re-start itself automatically if an I/O exception is thrown? In my opinion the recovery mechanism should not be part of the reactor itself. I just have to review the code and make sure all connections are cleanly shutdown in case of an I/O failure. 

What is your take?

Oleg

> DefaultConnectingIOReactor.execute propagates IOException, but isn't really re-callable
> ---------------------------------------------------------------------------------------
>
>                 Key: HTTPCORE-29
>                 URL: https://issues.apache.org/jira/browse/HTTPCORE-29
>             Project: HttpComponents Core
>          Issue Type: Bug
>          Components: HttpCore NIO
>    Affects Versions: 4.0-alpha3
>            Reporter: Anders Wallgren
>         Assigned To: Oleg Kalnichevski
>             Fix For: 4.0-alpha4
>
>
> I'm trying to figure out what to do when DefaultConnectingIOReactor.execute throws an exception.  It doesn't seem like I can just call execute() again after handling the exception, since that will recreate all the state in DCIOR.
> Seems to me that there needs to be a different way to handle exceptions, or the execute method should be callable more than once.
> For reference, here's the stack trace of an exception:
> {code}
> 2007-01-23T16:23:19.800 | ERROR | urceInvoker |                                               | NewResourceInvoker             | Invalid argument: sun.nio.ch.Net.setIntOption
> java.net.SocketException: Invalid argument: sun.nio.ch.Net.setIntOption
> 	at sun.nio.ch.Net.setIntOption0(Native Method)
> 	at sun.nio.ch.Net.setIntOption(Net.java:154)
> 	at sun.nio.ch.SocketChannelImpl$1.setInt(SocketChannelImpl.java:406)
> 	at sun.nio.ch.SocketOptsImpl.setBoolean(SocketOptsImpl.java:38)
> 	at sun.nio.ch.SocketOptsImpl$IP$TCP.noDelay(SocketOptsImpl.java:284)
> 	at sun.nio.ch.OptionAdaptor.setTcpNoDelay(OptionAdaptor.java:48)
> 	at sun.nio.ch.SocketAdaptor.setTcpNoDelay(SocketAdaptor.java:268)
> 	at org.apache.http.nio.impl.reactor.DefaultConnectingIOReactor.prepareSocket(DefaultConnectingIOReactor.java:171)
> 	at org.apache.http.nio.impl.reactor.DefaultConnectingIOReactor.processEvent(DefaultConnectingIOReactor.java:158)
> 	at org.apache.http.nio.impl.reactor.DefaultConnectingIOReactor.processEvents(DefaultConnectingIOReactor.java:134)
> 	at org.apache.http.nio.impl.reactor.DefaultConnectingIOReactor.execute(DefaultConnectingIOReactor.java:94)
> 	at com.electriccloud.commander.domain.NewResourceInvoker.innerRun(NewResourceInvoker.java:304)
> 	at com.electriccloud.util.FailsafeRunnable.run(FailsafeRunnable.java:105)
> 	at java.lang.Thread.run(Thread.java:619)
> {code}

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


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


[jira] Commented: (HTTPCORE-29) DefaultConnectingIOReactor.execute propagates IOException, but isn't really re-callable

Posted by "Anders Wallgren (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HTTPCORE-29?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12466880 ] 

Anders Wallgren commented on HTTPCORE-29:
-----------------------------------------

Oops, guess wiki annotations aren't enabled.

> DefaultConnectingIOReactor.execute propagates IOException, but isn't really re-callable
> ---------------------------------------------------------------------------------------
>
>                 Key: HTTPCORE-29
>                 URL: https://issues.apache.org/jira/browse/HTTPCORE-29
>             Project: HttpComponents Core
>          Issue Type: Bug
>          Components: HttpCore NIO
>    Affects Versions: 4.0-alpha3
>            Reporter: Anders Wallgren
>
> I'm trying to figure out what to do when DefaultConnectingIOReactor.execute throws an exception.  It doesn't seem like I can just call execute() again after handling the exception, since that will recreate all the state in DCIOR.
> Seems to me that there needs to be a different way to handle exceptions, or the execute method should be callable more than once.
> For reference, here's the stack trace of an exception:
> {code}
> 2007-01-23T16:23:19.800 | ERROR | urceInvoker |                                               | NewResourceInvoker             | Invalid argument: sun.nio.ch.Net.setIntOption
> java.net.SocketException: Invalid argument: sun.nio.ch.Net.setIntOption
> 	at sun.nio.ch.Net.setIntOption0(Native Method)
> 	at sun.nio.ch.Net.setIntOption(Net.java:154)
> 	at sun.nio.ch.SocketChannelImpl$1.setInt(SocketChannelImpl.java:406)
> 	at sun.nio.ch.SocketOptsImpl.setBoolean(SocketOptsImpl.java:38)
> 	at sun.nio.ch.SocketOptsImpl$IP$TCP.noDelay(SocketOptsImpl.java:284)
> 	at sun.nio.ch.OptionAdaptor.setTcpNoDelay(OptionAdaptor.java:48)
> 	at sun.nio.ch.SocketAdaptor.setTcpNoDelay(SocketAdaptor.java:268)
> 	at org.apache.http.nio.impl.reactor.DefaultConnectingIOReactor.prepareSocket(DefaultConnectingIOReactor.java:171)
> 	at org.apache.http.nio.impl.reactor.DefaultConnectingIOReactor.processEvent(DefaultConnectingIOReactor.java:158)
> 	at org.apache.http.nio.impl.reactor.DefaultConnectingIOReactor.processEvents(DefaultConnectingIOReactor.java:134)
> 	at org.apache.http.nio.impl.reactor.DefaultConnectingIOReactor.execute(DefaultConnectingIOReactor.java:94)
> 	at com.electriccloud.commander.domain.NewResourceInvoker.innerRun(NewResourceInvoker.java:304)
> 	at com.electriccloud.util.FailsafeRunnable.run(FailsafeRunnable.java:105)
> 	at java.lang.Thread.run(Thread.java:619)
> {code}

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


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


[jira] Commented: (HTTPCORE-29) DefaultConnectingIOReactor.execute propagates IOException, but isn't really re-callable

Posted by "Roland Weber (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HTTPCORE-29?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12467933 ] 

Roland Weber commented on HTTPCORE-29:
--------------------------------------

Without looking at the code, this sounds like it would have been nice to have a bringup() or initialize() method as the counterpart to shutdown(). If the state building is done in an extra method, it would have been the caller's choice to shutdown() or retry execute(). Just for the sake of symmetry... ;-)

cheers,
  Roland
 

> DefaultConnectingIOReactor.execute propagates IOException, but isn't really re-callable
> ---------------------------------------------------------------------------------------
>
>                 Key: HTTPCORE-29
>                 URL: https://issues.apache.org/jira/browse/HTTPCORE-29
>             Project: HttpComponents Core
>          Issue Type: Bug
>          Components: HttpCore NIO
>    Affects Versions: 4.0-alpha3
>            Reporter: Anders Wallgren
>         Assigned To: Oleg Kalnichevski
>             Fix For: 4.0-alpha4
>
>
> I'm trying to figure out what to do when DefaultConnectingIOReactor.execute throws an exception.  It doesn't seem like I can just call execute() again after handling the exception, since that will recreate all the state in DCIOR.
> Seems to me that there needs to be a different way to handle exceptions, or the execute method should be callable more than once.
> For reference, here's the stack trace of an exception:
> {code}
> 2007-01-23T16:23:19.800 | ERROR | urceInvoker |                                               | NewResourceInvoker             | Invalid argument: sun.nio.ch.Net.setIntOption
> java.net.SocketException: Invalid argument: sun.nio.ch.Net.setIntOption
> 	at sun.nio.ch.Net.setIntOption0(Native Method)
> 	at sun.nio.ch.Net.setIntOption(Net.java:154)
> 	at sun.nio.ch.SocketChannelImpl$1.setInt(SocketChannelImpl.java:406)
> 	at sun.nio.ch.SocketOptsImpl.setBoolean(SocketOptsImpl.java:38)
> 	at sun.nio.ch.SocketOptsImpl$IP$TCP.noDelay(SocketOptsImpl.java:284)
> 	at sun.nio.ch.OptionAdaptor.setTcpNoDelay(OptionAdaptor.java:48)
> 	at sun.nio.ch.SocketAdaptor.setTcpNoDelay(SocketAdaptor.java:268)
> 	at org.apache.http.nio.impl.reactor.DefaultConnectingIOReactor.prepareSocket(DefaultConnectingIOReactor.java:171)
> 	at org.apache.http.nio.impl.reactor.DefaultConnectingIOReactor.processEvent(DefaultConnectingIOReactor.java:158)
> 	at org.apache.http.nio.impl.reactor.DefaultConnectingIOReactor.processEvents(DefaultConnectingIOReactor.java:134)
> 	at org.apache.http.nio.impl.reactor.DefaultConnectingIOReactor.execute(DefaultConnectingIOReactor.java:94)
> 	at com.electriccloud.commander.domain.NewResourceInvoker.innerRun(NewResourceInvoker.java:304)
> 	at com.electriccloud.util.FailsafeRunnable.run(FailsafeRunnable.java:105)
> 	at java.lang.Thread.run(Thread.java:619)
> {code}

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


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


[jira] Commented: (HTTPCORE-29) DefaultConnectingIOReactor.execute propagates IOException, but isn't really re-callable

Posted by "Anders Wallgren (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HTTPCORE-29?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12467688 ] 

Anders Wallgren commented on HTTPCORE-29:
-----------------------------------------

I don't have a stack trace, but, by inspection, doesn't the call to verifyWorkers() in execute() have the effect of taking exceptions from the worker threads and throwing them out of execute()?

Or perhaps it's the case that such exceptions are also fatal?

In any case, it seems as though we agree that the reactor should only shut down if the main selector is unable to perform its function.

> DefaultConnectingIOReactor.execute propagates IOException, but isn't really re-callable
> ---------------------------------------------------------------------------------------
>
>                 Key: HTTPCORE-29
>                 URL: https://issues.apache.org/jira/browse/HTTPCORE-29
>             Project: HttpComponents Core
>          Issue Type: Bug
>          Components: HttpCore NIO
>    Affects Versions: 4.0-alpha3
>            Reporter: Anders Wallgren
>         Assigned To: Oleg Kalnichevski
>             Fix For: 4.0-alpha4
>
>
> I'm trying to figure out what to do when DefaultConnectingIOReactor.execute throws an exception.  It doesn't seem like I can just call execute() again after handling the exception, since that will recreate all the state in DCIOR.
> Seems to me that there needs to be a different way to handle exceptions, or the execute method should be callable more than once.
> For reference, here's the stack trace of an exception:
> {code}
> 2007-01-23T16:23:19.800 | ERROR | urceInvoker |                                               | NewResourceInvoker             | Invalid argument: sun.nio.ch.Net.setIntOption
> java.net.SocketException: Invalid argument: sun.nio.ch.Net.setIntOption
> 	at sun.nio.ch.Net.setIntOption0(Native Method)
> 	at sun.nio.ch.Net.setIntOption(Net.java:154)
> 	at sun.nio.ch.SocketChannelImpl$1.setInt(SocketChannelImpl.java:406)
> 	at sun.nio.ch.SocketOptsImpl.setBoolean(SocketOptsImpl.java:38)
> 	at sun.nio.ch.SocketOptsImpl$IP$TCP.noDelay(SocketOptsImpl.java:284)
> 	at sun.nio.ch.OptionAdaptor.setTcpNoDelay(OptionAdaptor.java:48)
> 	at sun.nio.ch.SocketAdaptor.setTcpNoDelay(SocketAdaptor.java:268)
> 	at org.apache.http.nio.impl.reactor.DefaultConnectingIOReactor.prepareSocket(DefaultConnectingIOReactor.java:171)
> 	at org.apache.http.nio.impl.reactor.DefaultConnectingIOReactor.processEvent(DefaultConnectingIOReactor.java:158)
> 	at org.apache.http.nio.impl.reactor.DefaultConnectingIOReactor.processEvents(DefaultConnectingIOReactor.java:134)
> 	at org.apache.http.nio.impl.reactor.DefaultConnectingIOReactor.execute(DefaultConnectingIOReactor.java:94)
> 	at com.electriccloud.commander.domain.NewResourceInvoker.innerRun(NewResourceInvoker.java:304)
> 	at com.electriccloud.util.FailsafeRunnable.run(FailsafeRunnable.java:105)
> 	at java.lang.Thread.run(Thread.java:619)
> {code}

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


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


[jira] Resolved: (HTTPCORE-29) DefaultConnectingIOReactor.execute propagates IOException, but isn't really re-callable

Posted by "Oleg Kalnichevski (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/HTTPCORE-29?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Oleg Kalnichevski resolved HTTPCORE-29.
---------------------------------------

       Resolution: Fixed
    Fix Version/s: 4.0-alpha4

Anders,

I have applied the following patch to fix the problem. Please review and let me know if you find the fix sufficient. 

Oleg


Index: /home/oleg/src/apache.org/jakarta/httpcomponents/httpcore/module-nio/src/main/java/org/apache/http/nio/impl/reactor/DefaultConnectingIOReactor.java
===================================================================
--- /home/oleg/src/apache.org/jakarta/httpcomponents/httpcore/module-nio/src/main/java/org/apache/http/nio/impl/reactor/DefaultConnectingIOReactor.java	(revision 498997)
+++ /home/oleg/src/apache.org/jakarta/httpcomponents/httpcore/module-nio/src/main/java/org/apache/http/nio/impl/reactor/DefaultConnectingIOReactor.java	(working copy)
@@ -124,10 +124,14 @@
                 }
                 key.cancel();
                 if (channel.isConnected()) {
-                    prepareSocket(channel.socket());
-                    Object attachment = sessionRequest.getAttachment();
-                    ChannelEntry entry = new ChannelEntry(channel, attachment); 
-                    addChannel(entry);
+                    try {
+                        prepareSocket(channel.socket());
+                        Object attachment = sessionRequest.getAttachment();
+                        ChannelEntry entry = new ChannelEntry(channel, attachment); 
+                        addChannel(entry);
+                    } catch (IOException ex) {
+                        sessionRequest.failed(ex);
+                    }
                 }
             }
                         


> DefaultConnectingIOReactor.execute propagates IOException, but isn't really re-callable
> ---------------------------------------------------------------------------------------
>
>                 Key: HTTPCORE-29
>                 URL: https://issues.apache.org/jira/browse/HTTPCORE-29
>             Project: HttpComponents Core
>          Issue Type: Bug
>          Components: HttpCore NIO
>    Affects Versions: 4.0-alpha3
>            Reporter: Anders Wallgren
>             Fix For: 4.0-alpha4
>
>
> I'm trying to figure out what to do when DefaultConnectingIOReactor.execute throws an exception.  It doesn't seem like I can just call execute() again after handling the exception, since that will recreate all the state in DCIOR.
> Seems to me that there needs to be a different way to handle exceptions, or the execute method should be callable more than once.
> For reference, here's the stack trace of an exception:
> {code}
> 2007-01-23T16:23:19.800 | ERROR | urceInvoker |                                               | NewResourceInvoker             | Invalid argument: sun.nio.ch.Net.setIntOption
> java.net.SocketException: Invalid argument: sun.nio.ch.Net.setIntOption
> 	at sun.nio.ch.Net.setIntOption0(Native Method)
> 	at sun.nio.ch.Net.setIntOption(Net.java:154)
> 	at sun.nio.ch.SocketChannelImpl$1.setInt(SocketChannelImpl.java:406)
> 	at sun.nio.ch.SocketOptsImpl.setBoolean(SocketOptsImpl.java:38)
> 	at sun.nio.ch.SocketOptsImpl$IP$TCP.noDelay(SocketOptsImpl.java:284)
> 	at sun.nio.ch.OptionAdaptor.setTcpNoDelay(OptionAdaptor.java:48)
> 	at sun.nio.ch.SocketAdaptor.setTcpNoDelay(SocketAdaptor.java:268)
> 	at org.apache.http.nio.impl.reactor.DefaultConnectingIOReactor.prepareSocket(DefaultConnectingIOReactor.java:171)
> 	at org.apache.http.nio.impl.reactor.DefaultConnectingIOReactor.processEvent(DefaultConnectingIOReactor.java:158)
> 	at org.apache.http.nio.impl.reactor.DefaultConnectingIOReactor.processEvents(DefaultConnectingIOReactor.java:134)
> 	at org.apache.http.nio.impl.reactor.DefaultConnectingIOReactor.execute(DefaultConnectingIOReactor.java:94)
> 	at com.electriccloud.commander.domain.NewResourceInvoker.innerRun(NewResourceInvoker.java:304)
> 	at com.electriccloud.util.FailsafeRunnable.run(FailsafeRunnable.java:105)
> 	at java.lang.Thread.run(Thread.java:619)
> {code}

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


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


[jira] Resolved: (HTTPCORE-29) DefaultConnectingIOReactor.execute propagates IOException, but isn't really re-callable

Posted by "Oleg Kalnichevski (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/HTTPCORE-29?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Oleg Kalnichevski resolved HTTPCORE-29.
---------------------------------------

    Resolution: Fixed

Anders,

I committed the following changes to the SVN trunk:

(1) I/O reactor implementations now re-throw all I/O exceptions I thought were fatal as IOReactorException (subclass of IOException) in order to clearly demarcate them as such
(2) I went thought the whole code base and took extra case all non-fatal I/O exceptions were passed onto a user defined event dispatcher
(3) The default implementation of the listening I/O reactor now uses an optional exception handler to determine whether an I/O exception thrown while accepting a new connection is fatal or not

Please review the changes and If you think I missed some cases where legitimate non-fatal I/O exceptions can occur, please do let me know

Oleg


> DefaultConnectingIOReactor.execute propagates IOException, but isn't really re-callable
> ---------------------------------------------------------------------------------------
>
>                 Key: HTTPCORE-29
>                 URL: https://issues.apache.org/jira/browse/HTTPCORE-29
>             Project: HttpComponents Core
>          Issue Type: Bug
>          Components: HttpCore NIO
>    Affects Versions: 4.0-alpha3
>            Reporter: Anders Wallgren
>         Assigned To: Oleg Kalnichevski
>             Fix For: 4.0-alpha4
>
>
> I'm trying to figure out what to do when DefaultConnectingIOReactor.execute throws an exception.  It doesn't seem like I can just call execute() again after handling the exception, since that will recreate all the state in DCIOR.
> Seems to me that there needs to be a different way to handle exceptions, or the execute method should be callable more than once.
> For reference, here's the stack trace of an exception:
> {code}
> 2007-01-23T16:23:19.800 | ERROR | urceInvoker |                                               | NewResourceInvoker             | Invalid argument: sun.nio.ch.Net.setIntOption
> java.net.SocketException: Invalid argument: sun.nio.ch.Net.setIntOption
> 	at sun.nio.ch.Net.setIntOption0(Native Method)
> 	at sun.nio.ch.Net.setIntOption(Net.java:154)
> 	at sun.nio.ch.SocketChannelImpl$1.setInt(SocketChannelImpl.java:406)
> 	at sun.nio.ch.SocketOptsImpl.setBoolean(SocketOptsImpl.java:38)
> 	at sun.nio.ch.SocketOptsImpl$IP$TCP.noDelay(SocketOptsImpl.java:284)
> 	at sun.nio.ch.OptionAdaptor.setTcpNoDelay(OptionAdaptor.java:48)
> 	at sun.nio.ch.SocketAdaptor.setTcpNoDelay(SocketAdaptor.java:268)
> 	at org.apache.http.nio.impl.reactor.DefaultConnectingIOReactor.prepareSocket(DefaultConnectingIOReactor.java:171)
> 	at org.apache.http.nio.impl.reactor.DefaultConnectingIOReactor.processEvent(DefaultConnectingIOReactor.java:158)
> 	at org.apache.http.nio.impl.reactor.DefaultConnectingIOReactor.processEvents(DefaultConnectingIOReactor.java:134)
> 	at org.apache.http.nio.impl.reactor.DefaultConnectingIOReactor.execute(DefaultConnectingIOReactor.java:94)
> 	at com.electriccloud.commander.domain.NewResourceInvoker.innerRun(NewResourceInvoker.java:304)
> 	at com.electriccloud.util.FailsafeRunnable.run(FailsafeRunnable.java:105)
> 	at java.lang.Thread.run(Thread.java:619)
> {code}

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


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


[jira] Commented: (HTTPCORE-29) DefaultConnectingIOReactor.execute propagates IOException, but isn't really re-callable

Posted by "Anders Wallgren (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HTTPCORE-29?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12467515 ] 

Anders Wallgren commented on HTTPCORE-29:
-----------------------------------------

It the IOException happens while initialiizing the reactor, I can see a legitimate reason to shut down the reactor.

However if the reactor has started properly and I now have 250 outbound sessions and one of them has an IOException, it doesn't make sense to me that the other 249 sessions should have to fail.  The session that had the problem should be shut down, but the reactor should not fail.

Does that make sense?

> DefaultConnectingIOReactor.execute propagates IOException, but isn't really re-callable
> ---------------------------------------------------------------------------------------
>
>                 Key: HTTPCORE-29
>                 URL: https://issues.apache.org/jira/browse/HTTPCORE-29
>             Project: HttpComponents Core
>          Issue Type: Bug
>          Components: HttpCore NIO
>    Affects Versions: 4.0-alpha3
>            Reporter: Anders Wallgren
>         Assigned To: Oleg Kalnichevski
>             Fix For: 4.0-alpha4
>
>
> I'm trying to figure out what to do when DefaultConnectingIOReactor.execute throws an exception.  It doesn't seem like I can just call execute() again after handling the exception, since that will recreate all the state in DCIOR.
> Seems to me that there needs to be a different way to handle exceptions, or the execute method should be callable more than once.
> For reference, here's the stack trace of an exception:
> {code}
> 2007-01-23T16:23:19.800 | ERROR | urceInvoker |                                               | NewResourceInvoker             | Invalid argument: sun.nio.ch.Net.setIntOption
> java.net.SocketException: Invalid argument: sun.nio.ch.Net.setIntOption
> 	at sun.nio.ch.Net.setIntOption0(Native Method)
> 	at sun.nio.ch.Net.setIntOption(Net.java:154)
> 	at sun.nio.ch.SocketChannelImpl$1.setInt(SocketChannelImpl.java:406)
> 	at sun.nio.ch.SocketOptsImpl.setBoolean(SocketOptsImpl.java:38)
> 	at sun.nio.ch.SocketOptsImpl$IP$TCP.noDelay(SocketOptsImpl.java:284)
> 	at sun.nio.ch.OptionAdaptor.setTcpNoDelay(OptionAdaptor.java:48)
> 	at sun.nio.ch.SocketAdaptor.setTcpNoDelay(SocketAdaptor.java:268)
> 	at org.apache.http.nio.impl.reactor.DefaultConnectingIOReactor.prepareSocket(DefaultConnectingIOReactor.java:171)
> 	at org.apache.http.nio.impl.reactor.DefaultConnectingIOReactor.processEvent(DefaultConnectingIOReactor.java:158)
> 	at org.apache.http.nio.impl.reactor.DefaultConnectingIOReactor.processEvents(DefaultConnectingIOReactor.java:134)
> 	at org.apache.http.nio.impl.reactor.DefaultConnectingIOReactor.execute(DefaultConnectingIOReactor.java:94)
> 	at com.electriccloud.commander.domain.NewResourceInvoker.innerRun(NewResourceInvoker.java:304)
> 	at com.electriccloud.util.FailsafeRunnable.run(FailsafeRunnable.java:105)
> 	at java.lang.Thread.run(Thread.java:619)
> {code}

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


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