You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@mina.apache.org by "Florin Sultan (JIRA)" <ji...@apache.org> on 2012/07/18 00:42:35 UTC
[jira] [Created] (DIRMINA-901) connect() a nonblocking unregistered
channel fails with UDT
Florin Sultan created DIRMINA-901:
-------------------------------------
Summary: connect() a nonblocking unregistered channel fails with UDT
Key: DIRMINA-901
URL: https://issues.apache.org/jira/browse/DIRMINA-901
Project: MINA
Issue Type: Bug
Components: Core
Affects Versions: 2.0.4
Environment: Linux 2.6.18-164.11.1.el5xen #1 SMP Wed Jan 20 08:06:04 EST 2010 x86_64 x86_64 x86_64 GNU/Linux
java version "1.6.0_31"
Java(TM) SE Runtime Environment (build 1.6.0_31-b04)
Java HotSpot(TM) 64-Bit Server VM (build 20.6-b01, mixed mode)
Reporter: Florin Sultan
Context:
-------
I am using BarchartUDT as transport, which I have integrated with MINA 2.0.4.
BarchartUDT is a java wrapper to a native UDT library (C++). UDT is a reliable,
connection-oriented, streaming protocol.
The example below is the MINA sample sumup client iprogram that breaks
with an exception during the connect() call into the UDT wrapper.
Description:
-----------
Trigger :
1. MINA creates a (non-blocking, by default) UDT channel.
2. Calls connect() on it BEFORE registering it with a selector.
3. My UDT library does not accept a connect with a nonblocking channel and throws an exception.
Just for reference, here's the exception in UDT - the message is quite clear :
Jul 3, 2012 11:22:30 AM com.barchart.udt.nio.ChannelSocketUDT connect
SEVERE: UDT channel is in non blocking mode;must register with a selector before trying to connect()
Of course, the above sequence of actions does work with the native TCP channels.
The problem is that UDT does not accept a connect on a nonblocking AND unregistered channel.
I am perfectly aware that this is most likely an issue with UDT, and not a bug in MINA.
However, I would greatly appreciate it if you can provide any suggestions or help.
Questions :
1. What would it take to have MINA perform these actions in reverse (first register, then connect) ?
Is there an easy change to AbstractPollingIoConnector.connect0 that would do the register before connect,
for example?
2. If this is not possible, is there a way to make the channel blocking, for example?
3. Is there other way around it?
I'd be happy to try any suggestion (or piece of code, if you provide it).
It would help me get over this hurdle until UDT people give a reply to this issue.
Details:
-------
-- Call stack:
Jul 13, 2012 1:10:03 PM com.barchart.udt.nio.ChannelSocketUDT connect
SEVERE: UDT channel is in non blocking mode;must register with a selector before trying to connect()
Exception in thread "main" java.nio.channels.IllegalBlockingModeException
at com.barchart.udt.nio.ChannelSocketUDT.connect(ChannelSocketUDT.java:176)
at org.apache.mina.transport.socket.nio.NioUDTSocketConnector.connect(NioUDTSocketConnector.java:215)
at org.apache.mina.transport.socket.nio.NioUDTSocketConnector.connect(NioUDTSocketConnector.java:66)
at org.apache.mina.core.polling.AbstractPollingIoConnector.connect0(AbstractPollingIoConnector.java:320)
at org.apache.mina.core.service.AbstractIoConnector.connect(AbstractIoConnector.java:262)
at org.apache.mina.core.service.AbstractIoConnector.connect(AbstractIoConnector.java:172)
-- Code in question :
AbstractPollingIoConnector.connect0 :
creates Connector thread AFTER connect call on the non-blocking channel
AbstractPollingIoConnector.Connector.run() :
calls registerNew() :
private class Connector implements Runnable {
public Connector() {
System.out.println("Connector::CTOR " + selectable);
}
public void run() {
assert (connectorRef.get() == this);
int nHandles = 0;
while (selectable) {
try {
// the timeout for select shall be smaller of the connect
// timeout or 1 second...
int timeout = (int)Math.min(getConnectTimeoutMillis(), 1000L);
int selected = select(timeout);
nHandles += registerNew();
Thanks !
Florin
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Commented] (DIRMINA-901) connect() a nonblocking
unregistered channel fails with UDT
Posted by "Emmanuel Lecharny (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/DIRMINA-901?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13417653#comment-13417653 ]
Emmanuel Lecharny commented on DIRMINA-901:
-------------------------------------------
I barely can 'connect' the stack trace with the files you attached, the ine number aren't the same :/
> connect() a nonblocking unregistered channel fails with UDT
> -----------------------------------------------------------
>
> Key: DIRMINA-901
> URL: https://issues.apache.org/jira/browse/DIRMINA-901
> Project: MINA
> Issue Type: Bug
> Components: Core
> Affects Versions: 2.0.4
> Environment: Linux 2.6.18-164.11.1.el5xen #1 SMP Wed Jan 20 08:06:04 EST 2010 x86_64 x86_64 x86_64 GNU/Linux
> java version "1.6.0_31"
> Java(TM) SE Runtime Environment (build 1.6.0_31-b04)
> Java HotSpot(TM) 64-Bit Server VM (build 20.6-b01, mixed mode)
> Reporter: Florin Sultan
> Attachments: ChannelSocketUDT.java, NioUDTSocketConnector.java
>
>
> Context:
> -------
> I am using BarchartUDT as transport, which I have integrated with MINA 2.0.4.
> BarchartUDT is a java wrapper to a native UDT library (C++). UDT is a reliable,
> connection-oriented, streaming protocol.
> The example below is the MINA sample sumup client iprogram that breaks
> with an exception during the connect() call into the UDT wrapper.
> Description:
> -----------
> Trigger :
> 1. MINA creates a (non-blocking, by default) UDT channel.
> 2. Calls connect() on it BEFORE registering it with a selector.
> 3. My UDT library does not accept a connect with a nonblocking channel and throws an exception.
> Just for reference, here's the exception in UDT - the message is quite clear :
> Jul 3, 2012 11:22:30 AM com.barchart.udt.nio.ChannelSocketUDT connect
> SEVERE: UDT channel is in non blocking mode;must register with a selector before trying to connect()
> Of course, the above sequence of actions does work with the native TCP channels.
> The problem is that UDT does not accept a connect on a nonblocking AND unregistered channel.
> I am perfectly aware that this is most likely an issue with UDT, and not a bug in MINA.
> However, I would greatly appreciate it if you can provide any suggestions or help.
> Questions :
> 1. What would it take to have MINA perform these actions in reverse (first register, then connect) ?
> Is there an easy change to AbstractPollingIoConnector.connect0 that would do the register before connect,
> for example?
> 2. If this is not possible, is there a way to make the channel blocking, for example?
> 3. Is there other way around it?
> I'd be happy to try any suggestion (or piece of code, if you provide it).
> It would help me get over this hurdle until UDT people give a reply to this issue.
> Details:
> -------
> -- Call stack:
> Jul 13, 2012 1:10:03 PM com.barchart.udt.nio.ChannelSocketUDT connect
> SEVERE: UDT channel is in non blocking mode;must register with a selector before trying to connect()
> Exception in thread "main" java.nio.channels.IllegalBlockingModeException
> at com.barchart.udt.nio.ChannelSocketUDT.connect(ChannelSocketUDT.java:176)
> at org.apache.mina.transport.socket.nio.NioUDTSocketConnector.connect(NioUDTSocketConnector.java:215)
> at org.apache.mina.transport.socket.nio.NioUDTSocketConnector.connect(NioUDTSocketConnector.java:66)
> at org.apache.mina.core.polling.AbstractPollingIoConnector.connect0(AbstractPollingIoConnector.java:320)
> at org.apache.mina.core.service.AbstractIoConnector.connect(AbstractIoConnector.java:262)
> at org.apache.mina.core.service.AbstractIoConnector.connect(AbstractIoConnector.java:172)
> -- Code in question :
> AbstractPollingIoConnector.connect0 :
> creates Connector thread AFTER connect call on the non-blocking channel
> AbstractPollingIoConnector.Connector.run() :
> calls registerNew() :
> private class Connector implements Runnable {
> public Connector() {
> System.out.println("Connector::CTOR " + selectable);
> }
> public void run() {
> assert (connectorRef.get() == this);
> int nHandles = 0;
> while (selectable) {
> try {
> // the timeout for select shall be smaller of the connect
> // timeout or 1 second...
> int timeout = (int)Math.min(getConnectTimeoutMillis(), 1000L);
> int selected = select(timeout);
> nHandles += registerNew();
> Thanks !
> Florin
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Commented] (DIRMINA-901) connect() a nonblocking
unregistered channel fails with UDT
Posted by "Emmanuel Lecharny (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/DIRMINA-901?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13417725#comment-13417725 ]
Emmanuel Lecharny commented on DIRMINA-901:
-------------------------------------------
AFAICT, you have a null channelKey. Have you called the setRegistredKeuUDT( key ) method ?
> connect() a nonblocking unregistered channel fails with UDT
> -----------------------------------------------------------
>
> Key: DIRMINA-901
> URL: https://issues.apache.org/jira/browse/DIRMINA-901
> Project: MINA
> Issue Type: Bug
> Components: Core
> Affects Versions: 2.0.4
> Environment: Linux 2.6.18-164.11.1.el5xen #1 SMP Wed Jan 20 08:06:04 EST 2010 x86_64 x86_64 x86_64 GNU/Linux
> java version "1.6.0_31"
> Java(TM) SE Runtime Environment (build 1.6.0_31-b04)
> Java HotSpot(TM) 64-Bit Server VM (build 20.6-b01, mixed mode)
> Reporter: Florin Sultan
> Attachments: ChannelSocketUDT.java, ChannelSocketUDT.java, NioUDTSocketConnector.java, NioUDTSocketConnector.java
>
>
> Context:
> -------
> I am using BarchartUDT as transport, which I have integrated with MINA 2.0.4.
> BarchartUDT is a java wrapper to a native UDT library (C++). UDT is a reliable,
> connection-oriented, streaming protocol.
> The example below is the MINA sample sumup client iprogram that breaks
> with an exception during the connect() call into the UDT wrapper.
> Description:
> -----------
> Trigger :
> 1. MINA creates a (non-blocking, by default) UDT channel.
> 2. Calls connect() on it BEFORE registering it with a selector.
> 3. My UDT library does not accept a connect with a nonblocking channel and throws an exception.
> Just for reference, here's the exception in UDT - the message is quite clear :
> Jul 3, 2012 11:22:30 AM com.barchart.udt.nio.ChannelSocketUDT connect
> SEVERE: UDT channel is in non blocking mode;must register with a selector before trying to connect()
> Of course, the above sequence of actions does work with the native TCP channels.
> The problem is that UDT does not accept a connect on a nonblocking AND unregistered channel.
> I am perfectly aware that this is most likely an issue with UDT, and not a bug in MINA.
> However, I would greatly appreciate it if you can provide any suggestions or help.
> Questions :
> 1. What would it take to have MINA perform these actions in reverse (first register, then connect) ?
> Is there an easy change to AbstractPollingIoConnector.connect0 that would do the register before connect,
> for example?
> 2. If this is not possible, is there a way to make the channel blocking, for example?
> 3. Is there other way around it?
> I'd be happy to try any suggestion (or piece of code, if you provide it).
> It would help me get over this hurdle until UDT people give a reply to this issue.
> Details:
> -------
> -- Call stack:
> Jul 13, 2012 1:10:03 PM com.barchart.udt.nio.ChannelSocketUDT connect
> SEVERE: UDT channel is in non blocking mode;must register with a selector before trying to connect()
> Exception in thread "main" java.nio.channels.IllegalBlockingModeException
> at com.barchart.udt.nio.ChannelSocketUDT.connect(ChannelSocketUDT.java:176)
> at org.apache.mina.transport.socket.nio.NioUDTSocketConnector.connect(NioUDTSocketConnector.java:215)
> at org.apache.mina.transport.socket.nio.NioUDTSocketConnector.connect(NioUDTSocketConnector.java:66)
> at org.apache.mina.core.polling.AbstractPollingIoConnector.connect0(AbstractPollingIoConnector.java:320)
> at org.apache.mina.core.service.AbstractIoConnector.connect(AbstractIoConnector.java:262)
> at org.apache.mina.core.service.AbstractIoConnector.connect(AbstractIoConnector.java:172)
> -- Code in question :
> AbstractPollingIoConnector.connect0 :
> creates Connector thread AFTER connect call on the non-blocking channel
> AbstractPollingIoConnector.Connector.run() :
> calls registerNew() :
> private class Connector implements Runnable {
> public Connector() {
> System.out.println("Connector::CTOR " + selectable);
> }
> public void run() {
> assert (connectorRef.get() == this);
> int nHandles = 0;
> while (selectable) {
> try {
> // the timeout for select shall be smaller of the connect
> // timeout or 1 second...
> int timeout = (int)Math.min(getConnectTimeoutMillis(), 1000L);
> int selected = select(timeout);
> nHandles += registerNew();
> Thanks !
> Florin
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Updated] (DIRMINA-901) connect() a nonblocking unregistered
channel fails with UDT
Posted by "Florin Sultan (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/DIRMINA-901?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Florin Sultan updated DIRMINA-901:
----------------------------------
Attachment: NioUDTSocketConnector.java
ChannelSocketUDT.java
I've attached again the files that correspond to the trace below :
(Note that the problem originates in AbstractPollingIoConnector.Connector.run()
which calls register after the connect() call of this trace).
Exception in thread "main" java.nio.channels.IllegalBlockingModeException
at com.barchart.udt.nio.ChannelSocketUDT.connect(ChannelSocketUDT.java:167)
at org.apache.mina.transport.socket.nio.NioUDTSocketConnector.connect(NioUDTSocketConnector.java:212)
at org.apache.mina.transport.socket.nio.NioUDTSocketConnector.connect(NioUDTSocketConnector.java:66)
at org.apache.mina.core.polling.AbstractPollingIoConnector.connect0(AbstractPollingIoConnector.java:319)
at org.apache.mina.core.service.AbstractIoConnector.connect(AbstractIoConnector.java:262)
at org.apache.mina.core.service.AbstractIoConnector.connect(AbstractIoConnector.java:172)
at Client.main(Client.java:111)
> connect() a nonblocking unregistered channel fails with UDT
> -----------------------------------------------------------
>
> Key: DIRMINA-901
> URL: https://issues.apache.org/jira/browse/DIRMINA-901
> Project: MINA
> Issue Type: Bug
> Components: Core
> Affects Versions: 2.0.4
> Environment: Linux 2.6.18-164.11.1.el5xen #1 SMP Wed Jan 20 08:06:04 EST 2010 x86_64 x86_64 x86_64 GNU/Linux
> java version "1.6.0_31"
> Java(TM) SE Runtime Environment (build 1.6.0_31-b04)
> Java HotSpot(TM) 64-Bit Server VM (build 20.6-b01, mixed mode)
> Reporter: Florin Sultan
> Attachments: ChannelSocketUDT.java, ChannelSocketUDT.java, NioUDTSocketConnector.java, NioUDTSocketConnector.java
>
>
> Context:
> -------
> I am using BarchartUDT as transport, which I have integrated with MINA 2.0.4.
> BarchartUDT is a java wrapper to a native UDT library (C++). UDT is a reliable,
> connection-oriented, streaming protocol.
> The example below is the MINA sample sumup client iprogram that breaks
> with an exception during the connect() call into the UDT wrapper.
> Description:
> -----------
> Trigger :
> 1. MINA creates a (non-blocking, by default) UDT channel.
> 2. Calls connect() on it BEFORE registering it with a selector.
> 3. My UDT library does not accept a connect with a nonblocking channel and throws an exception.
> Just for reference, here's the exception in UDT - the message is quite clear :
> Jul 3, 2012 11:22:30 AM com.barchart.udt.nio.ChannelSocketUDT connect
> SEVERE: UDT channel is in non blocking mode;must register with a selector before trying to connect()
> Of course, the above sequence of actions does work with the native TCP channels.
> The problem is that UDT does not accept a connect on a nonblocking AND unregistered channel.
> I am perfectly aware that this is most likely an issue with UDT, and not a bug in MINA.
> However, I would greatly appreciate it if you can provide any suggestions or help.
> Questions :
> 1. What would it take to have MINA perform these actions in reverse (first register, then connect) ?
> Is there an easy change to AbstractPollingIoConnector.connect0 that would do the register before connect,
> for example?
> 2. If this is not possible, is there a way to make the channel blocking, for example?
> 3. Is there other way around it?
> I'd be happy to try any suggestion (or piece of code, if you provide it).
> It would help me get over this hurdle until UDT people give a reply to this issue.
> Details:
> -------
> -- Call stack:
> Jul 13, 2012 1:10:03 PM com.barchart.udt.nio.ChannelSocketUDT connect
> SEVERE: UDT channel is in non blocking mode;must register with a selector before trying to connect()
> Exception in thread "main" java.nio.channels.IllegalBlockingModeException
> at com.barchart.udt.nio.ChannelSocketUDT.connect(ChannelSocketUDT.java:176)
> at org.apache.mina.transport.socket.nio.NioUDTSocketConnector.connect(NioUDTSocketConnector.java:215)
> at org.apache.mina.transport.socket.nio.NioUDTSocketConnector.connect(NioUDTSocketConnector.java:66)
> at org.apache.mina.core.polling.AbstractPollingIoConnector.connect0(AbstractPollingIoConnector.java:320)
> at org.apache.mina.core.service.AbstractIoConnector.connect(AbstractIoConnector.java:262)
> at org.apache.mina.core.service.AbstractIoConnector.connect(AbstractIoConnector.java:172)
> -- Code in question :
> AbstractPollingIoConnector.connect0 :
> creates Connector thread AFTER connect call on the non-blocking channel
> AbstractPollingIoConnector.Connector.run() :
> calls registerNew() :
> private class Connector implements Runnable {
> public Connector() {
> System.out.println("Connector::CTOR " + selectable);
> }
> public void run() {
> assert (connectorRef.get() == this);
> int nHandles = 0;
> while (selectable) {
> try {
> // the timeout for select shall be smaller of the connect
> // timeout or 1 second...
> int timeout = (int)Math.min(getConnectTimeoutMillis(), 1000L);
> int selected = select(timeout);
> nHandles += registerNew();
> Thanks !
> Florin
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Updated] (DIRMINA-901) connect() a nonblocking unregistered
channel fails with UDT
Posted by "Florin Sultan (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/DIRMINA-901?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Florin Sultan updated DIRMINA-901:
----------------------------------
Attachment: ChannelSocketUDT.java
NioUDTSocketConnector.java
Attached.
Note that I've edited both, so the line numbers in the stack trace no longer match.
In the attached UDT file, the exception is at line 167.
Thanks.
> connect() a nonblocking unregistered channel fails with UDT
> -----------------------------------------------------------
>
> Key: DIRMINA-901
> URL: https://issues.apache.org/jira/browse/DIRMINA-901
> Project: MINA
> Issue Type: Bug
> Components: Core
> Affects Versions: 2.0.4
> Environment: Linux 2.6.18-164.11.1.el5xen #1 SMP Wed Jan 20 08:06:04 EST 2010 x86_64 x86_64 x86_64 GNU/Linux
> java version "1.6.0_31"
> Java(TM) SE Runtime Environment (build 1.6.0_31-b04)
> Java HotSpot(TM) 64-Bit Server VM (build 20.6-b01, mixed mode)
> Reporter: Florin Sultan
> Attachments: ChannelSocketUDT.java, NioUDTSocketConnector.java
>
>
> Context:
> -------
> I am using BarchartUDT as transport, which I have integrated with MINA 2.0.4.
> BarchartUDT is a java wrapper to a native UDT library (C++). UDT is a reliable,
> connection-oriented, streaming protocol.
> The example below is the MINA sample sumup client iprogram that breaks
> with an exception during the connect() call into the UDT wrapper.
> Description:
> -----------
> Trigger :
> 1. MINA creates a (non-blocking, by default) UDT channel.
> 2. Calls connect() on it BEFORE registering it with a selector.
> 3. My UDT library does not accept a connect with a nonblocking channel and throws an exception.
> Just for reference, here's the exception in UDT - the message is quite clear :
> Jul 3, 2012 11:22:30 AM com.barchart.udt.nio.ChannelSocketUDT connect
> SEVERE: UDT channel is in non blocking mode;must register with a selector before trying to connect()
> Of course, the above sequence of actions does work with the native TCP channels.
> The problem is that UDT does not accept a connect on a nonblocking AND unregistered channel.
> I am perfectly aware that this is most likely an issue with UDT, and not a bug in MINA.
> However, I would greatly appreciate it if you can provide any suggestions or help.
> Questions :
> 1. What would it take to have MINA perform these actions in reverse (first register, then connect) ?
> Is there an easy change to AbstractPollingIoConnector.connect0 that would do the register before connect,
> for example?
> 2. If this is not possible, is there a way to make the channel blocking, for example?
> 3. Is there other way around it?
> I'd be happy to try any suggestion (or piece of code, if you provide it).
> It would help me get over this hurdle until UDT people give a reply to this issue.
> Details:
> -------
> -- Call stack:
> Jul 13, 2012 1:10:03 PM com.barchart.udt.nio.ChannelSocketUDT connect
> SEVERE: UDT channel is in non blocking mode;must register with a selector before trying to connect()
> Exception in thread "main" java.nio.channels.IllegalBlockingModeException
> at com.barchart.udt.nio.ChannelSocketUDT.connect(ChannelSocketUDT.java:176)
> at org.apache.mina.transport.socket.nio.NioUDTSocketConnector.connect(NioUDTSocketConnector.java:215)
> at org.apache.mina.transport.socket.nio.NioUDTSocketConnector.connect(NioUDTSocketConnector.java:66)
> at org.apache.mina.core.polling.AbstractPollingIoConnector.connect0(AbstractPollingIoConnector.java:320)
> at org.apache.mina.core.service.AbstractIoConnector.connect(AbstractIoConnector.java:262)
> at org.apache.mina.core.service.AbstractIoConnector.connect(AbstractIoConnector.java:172)
> -- Code in question :
> AbstractPollingIoConnector.connect0 :
> creates Connector thread AFTER connect call on the non-blocking channel
> AbstractPollingIoConnector.Connector.run() :
> calls registerNew() :
> private class Connector implements Runnable {
> public Connector() {
> System.out.println("Connector::CTOR " + selectable);
> }
> public void run() {
> assert (connectorRef.get() == this);
> int nHandles = 0;
> while (selectable) {
> try {
> // the timeout for select shall be smaller of the connect
> // timeout or 1 second...
> int timeout = (int)Math.min(getConnectTimeoutMillis(), 1000L);
> int selected = select(timeout);
> nHandles += registerNew();
> Thanks !
> Florin
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Commented] (DIRMINA-901) connect() a nonblocking
unregistered channel fails with UDT
Posted by "Emmanuel Lecharny (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/DIRMINA-901?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13417803#comment-13417803 ]
Emmanuel Lecharny commented on DIRMINA-901:
-------------------------------------------
Ok, I'm a bit slow tonite :/
I need to sleep on this JIRA...
> connect() a nonblocking unregistered channel fails with UDT
> -----------------------------------------------------------
>
> Key: DIRMINA-901
> URL: https://issues.apache.org/jira/browse/DIRMINA-901
> Project: MINA
> Issue Type: Bug
> Components: Core
> Affects Versions: 2.0.4
> Environment: Linux 2.6.18-164.11.1.el5xen #1 SMP Wed Jan 20 08:06:04 EST 2010 x86_64 x86_64 x86_64 GNU/Linux
> java version "1.6.0_31"
> Java(TM) SE Runtime Environment (build 1.6.0_31-b04)
> Java HotSpot(TM) 64-Bit Server VM (build 20.6-b01, mixed mode)
> Reporter: Florin Sultan
> Attachments: ChannelSocketUDT.java, ChannelSocketUDT.java, NioUDTSocketConnector.java, NioUDTSocketConnector.java
>
>
> Context:
> -------
> I am using BarchartUDT as transport, which I have integrated with MINA 2.0.4.
> BarchartUDT is a java wrapper to a native UDT library (C++). UDT is a reliable,
> connection-oriented, streaming protocol.
> The example below is the MINA sample sumup client iprogram that breaks
> with an exception during the connect() call into the UDT wrapper.
> Description:
> -----------
> Trigger :
> 1. MINA creates a (non-blocking, by default) UDT channel.
> 2. Calls connect() on it BEFORE registering it with a selector.
> 3. My UDT library does not accept a connect with a nonblocking channel and throws an exception.
> Just for reference, here's the exception in UDT - the message is quite clear :
> Jul 3, 2012 11:22:30 AM com.barchart.udt.nio.ChannelSocketUDT connect
> SEVERE: UDT channel is in non blocking mode;must register with a selector before trying to connect()
> Of course, the above sequence of actions does work with the native TCP channels.
> The problem is that UDT does not accept a connect on a nonblocking AND unregistered channel.
> I am perfectly aware that this is most likely an issue with UDT, and not a bug in MINA.
> However, I would greatly appreciate it if you can provide any suggestions or help.
> Questions :
> 1. What would it take to have MINA perform these actions in reverse (first register, then connect) ?
> Is there an easy change to AbstractPollingIoConnector.connect0 that would do the register before connect,
> for example?
> 2. If this is not possible, is there a way to make the channel blocking, for example?
> 3. Is there other way around it?
> I'd be happy to try any suggestion (or piece of code, if you provide it).
> It would help me get over this hurdle until UDT people give a reply to this issue.
> Details:
> -------
> -- Call stack:
> Jul 13, 2012 1:10:03 PM com.barchart.udt.nio.ChannelSocketUDT connect
> SEVERE: UDT channel is in non blocking mode;must register with a selector before trying to connect()
> Exception in thread "main" java.nio.channels.IllegalBlockingModeException
> at com.barchart.udt.nio.ChannelSocketUDT.connect(ChannelSocketUDT.java:176)
> at org.apache.mina.transport.socket.nio.NioUDTSocketConnector.connect(NioUDTSocketConnector.java:215)
> at org.apache.mina.transport.socket.nio.NioUDTSocketConnector.connect(NioUDTSocketConnector.java:66)
> at org.apache.mina.core.polling.AbstractPollingIoConnector.connect0(AbstractPollingIoConnector.java:320)
> at org.apache.mina.core.service.AbstractIoConnector.connect(AbstractIoConnector.java:262)
> at org.apache.mina.core.service.AbstractIoConnector.connect(AbstractIoConnector.java:172)
> -- Code in question :
> AbstractPollingIoConnector.connect0 :
> creates Connector thread AFTER connect call on the non-blocking channel
> AbstractPollingIoConnector.Connector.run() :
> calls registerNew() :
> private class Connector implements Runnable {
> public Connector() {
> System.out.println("Connector::CTOR " + selectable);
> }
> public void run() {
> assert (connectorRef.get() == this);
> int nHandles = 0;
> while (selectable) {
> try {
> // the timeout for select shall be smaller of the connect
> // timeout or 1 second...
> int timeout = (int)Math.min(getConnectTimeoutMillis(), 1000L);
> int selected = select(timeout);
> nHandles += registerNew();
> Thanks !
> Florin
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Commented] (DIRMINA-901) connect() a nonblocking
unregistered channel fails with UDT
Posted by "Florin Sultan (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/DIRMINA-901?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13417747#comment-13417747 ]
Florin Sultan commented on DIRMINA-901:
---------------------------------------
That is exactly my problem. Note that I am just using this code (UDT).
setRegistredKeuUDT( key ) is called by UDT upon a register call (coming from MINA, in AbstractPollingIoConnector.Connector.run()
).
But, as I stated before, MINA calls register() only after it calls connect().... This sequence of actions (connect, then register) is not accepted by UDT for NON-blocking channels, and the result is this exception.
Can you suggest a workaround - even a change to MINA code that would fix this sequence? Can I make the
channel temporarily blocking in MINA during connect, for example?
Please also read my initial JIRA comment and the questions inthere.
Thanks.
> connect() a nonblocking unregistered channel fails with UDT
> -----------------------------------------------------------
>
> Key: DIRMINA-901
> URL: https://issues.apache.org/jira/browse/DIRMINA-901
> Project: MINA
> Issue Type: Bug
> Components: Core
> Affects Versions: 2.0.4
> Environment: Linux 2.6.18-164.11.1.el5xen #1 SMP Wed Jan 20 08:06:04 EST 2010 x86_64 x86_64 x86_64 GNU/Linux
> java version "1.6.0_31"
> Java(TM) SE Runtime Environment (build 1.6.0_31-b04)
> Java HotSpot(TM) 64-Bit Server VM (build 20.6-b01, mixed mode)
> Reporter: Florin Sultan
> Attachments: ChannelSocketUDT.java, ChannelSocketUDT.java, NioUDTSocketConnector.java, NioUDTSocketConnector.java
>
>
> Context:
> -------
> I am using BarchartUDT as transport, which I have integrated with MINA 2.0.4.
> BarchartUDT is a java wrapper to a native UDT library (C++). UDT is a reliable,
> connection-oriented, streaming protocol.
> The example below is the MINA sample sumup client iprogram that breaks
> with an exception during the connect() call into the UDT wrapper.
> Description:
> -----------
> Trigger :
> 1. MINA creates a (non-blocking, by default) UDT channel.
> 2. Calls connect() on it BEFORE registering it with a selector.
> 3. My UDT library does not accept a connect with a nonblocking channel and throws an exception.
> Just for reference, here's the exception in UDT - the message is quite clear :
> Jul 3, 2012 11:22:30 AM com.barchart.udt.nio.ChannelSocketUDT connect
> SEVERE: UDT channel is in non blocking mode;must register with a selector before trying to connect()
> Of course, the above sequence of actions does work with the native TCP channels.
> The problem is that UDT does not accept a connect on a nonblocking AND unregistered channel.
> I am perfectly aware that this is most likely an issue with UDT, and not a bug in MINA.
> However, I would greatly appreciate it if you can provide any suggestions or help.
> Questions :
> 1. What would it take to have MINA perform these actions in reverse (first register, then connect) ?
> Is there an easy change to AbstractPollingIoConnector.connect0 that would do the register before connect,
> for example?
> 2. If this is not possible, is there a way to make the channel blocking, for example?
> 3. Is there other way around it?
> I'd be happy to try any suggestion (or piece of code, if you provide it).
> It would help me get over this hurdle until UDT people give a reply to this issue.
> Details:
> -------
> -- Call stack:
> Jul 13, 2012 1:10:03 PM com.barchart.udt.nio.ChannelSocketUDT connect
> SEVERE: UDT channel is in non blocking mode;must register with a selector before trying to connect()
> Exception in thread "main" java.nio.channels.IllegalBlockingModeException
> at com.barchart.udt.nio.ChannelSocketUDT.connect(ChannelSocketUDT.java:176)
> at org.apache.mina.transport.socket.nio.NioUDTSocketConnector.connect(NioUDTSocketConnector.java:215)
> at org.apache.mina.transport.socket.nio.NioUDTSocketConnector.connect(NioUDTSocketConnector.java:66)
> at org.apache.mina.core.polling.AbstractPollingIoConnector.connect0(AbstractPollingIoConnector.java:320)
> at org.apache.mina.core.service.AbstractIoConnector.connect(AbstractIoConnector.java:262)
> at org.apache.mina.core.service.AbstractIoConnector.connect(AbstractIoConnector.java:172)
> -- Code in question :
> AbstractPollingIoConnector.connect0 :
> creates Connector thread AFTER connect call on the non-blocking channel
> AbstractPollingIoConnector.Connector.run() :
> calls registerNew() :
> private class Connector implements Runnable {
> public Connector() {
> System.out.println("Connector::CTOR " + selectable);
> }
> public void run() {
> assert (connectorRef.get() == this);
> int nHandles = 0;
> while (selectable) {
> try {
> // the timeout for select shall be smaller of the connect
> // timeout or 1 second...
> int timeout = (int)Math.min(getConnectTimeoutMillis(), 1000L);
> int selected = select(timeout);
> nHandles += registerNew();
> Thanks !
> Florin
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Commented] (DIRMINA-901) connect() a nonblocking
unregistered channel fails with UDT
Posted by "Florin Sultan (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/DIRMINA-901?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13417380#comment-13417380 ]
Florin Sultan commented on DIRMINA-901:
---------------------------------------
I forgot to mention it : the NioUDTSocketConnector is based on the OLD 2.0.4 NioSocketConnector.
Now I realize I did not make it similar to the NioSocketConnector of 2.0.5 when moving to 2.0.5. I just copied the UDT-specific file as I had
created it under 2.0.4.
> connect() a nonblocking unregistered channel fails with UDT
> -----------------------------------------------------------
>
> Key: DIRMINA-901
> URL: https://issues.apache.org/jira/browse/DIRMINA-901
> Project: MINA
> Issue Type: Bug
> Components: Core
> Affects Versions: 2.0.4
> Environment: Linux 2.6.18-164.11.1.el5xen #1 SMP Wed Jan 20 08:06:04 EST 2010 x86_64 x86_64 x86_64 GNU/Linux
> java version "1.6.0_31"
> Java(TM) SE Runtime Environment (build 1.6.0_31-b04)
> Java HotSpot(TM) 64-Bit Server VM (build 20.6-b01, mixed mode)
> Reporter: Florin Sultan
> Attachments: ChannelSocketUDT.java, NioUDTSocketConnector.java
>
>
> Context:
> -------
> I am using BarchartUDT as transport, which I have integrated with MINA 2.0.4.
> BarchartUDT is a java wrapper to a native UDT library (C++). UDT is a reliable,
> connection-oriented, streaming protocol.
> The example below is the MINA sample sumup client iprogram that breaks
> with an exception during the connect() call into the UDT wrapper.
> Description:
> -----------
> Trigger :
> 1. MINA creates a (non-blocking, by default) UDT channel.
> 2. Calls connect() on it BEFORE registering it with a selector.
> 3. My UDT library does not accept a connect with a nonblocking channel and throws an exception.
> Just for reference, here's the exception in UDT - the message is quite clear :
> Jul 3, 2012 11:22:30 AM com.barchart.udt.nio.ChannelSocketUDT connect
> SEVERE: UDT channel is in non blocking mode;must register with a selector before trying to connect()
> Of course, the above sequence of actions does work with the native TCP channels.
> The problem is that UDT does not accept a connect on a nonblocking AND unregistered channel.
> I am perfectly aware that this is most likely an issue with UDT, and not a bug in MINA.
> However, I would greatly appreciate it if you can provide any suggestions or help.
> Questions :
> 1. What would it take to have MINA perform these actions in reverse (first register, then connect) ?
> Is there an easy change to AbstractPollingIoConnector.connect0 that would do the register before connect,
> for example?
> 2. If this is not possible, is there a way to make the channel blocking, for example?
> 3. Is there other way around it?
> I'd be happy to try any suggestion (or piece of code, if you provide it).
> It would help me get over this hurdle until UDT people give a reply to this issue.
> Details:
> -------
> -- Call stack:
> Jul 13, 2012 1:10:03 PM com.barchart.udt.nio.ChannelSocketUDT connect
> SEVERE: UDT channel is in non blocking mode;must register with a selector before trying to connect()
> Exception in thread "main" java.nio.channels.IllegalBlockingModeException
> at com.barchart.udt.nio.ChannelSocketUDT.connect(ChannelSocketUDT.java:176)
> at org.apache.mina.transport.socket.nio.NioUDTSocketConnector.connect(NioUDTSocketConnector.java:215)
> at org.apache.mina.transport.socket.nio.NioUDTSocketConnector.connect(NioUDTSocketConnector.java:66)
> at org.apache.mina.core.polling.AbstractPollingIoConnector.connect0(AbstractPollingIoConnector.java:320)
> at org.apache.mina.core.service.AbstractIoConnector.connect(AbstractIoConnector.java:262)
> at org.apache.mina.core.service.AbstractIoConnector.connect(AbstractIoConnector.java:172)
> -- Code in question :
> AbstractPollingIoConnector.connect0 :
> creates Connector thread AFTER connect call on the non-blocking channel
> AbstractPollingIoConnector.Connector.run() :
> calls registerNew() :
> private class Connector implements Runnable {
> public Connector() {
> System.out.println("Connector::CTOR " + selectable);
> }
> public void run() {
> assert (connectorRef.get() == this);
> int nHandles = 0;
> while (selectable) {
> try {
> // the timeout for select shall be smaller of the connect
> // timeout or 1 second...
> int timeout = (int)Math.min(getConnectTimeoutMillis(), 1000L);
> int selected = select(timeout);
> nHandles += registerNew();
> Thanks !
> Florin
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Commented] (DIRMINA-901) connect() a nonblocking
unregistered channel fails with UDT
Posted by "Emmanuel Lecharny (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/DIRMINA-901?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13417356#comment-13417356 ]
Emmanuel Lecharny commented on DIRMINA-901:
-------------------------------------------
Can you provide the code of your NioUDTSocketConnector and ChannelSocketUDT classes ?
> connect() a nonblocking unregistered channel fails with UDT
> -----------------------------------------------------------
>
> Key: DIRMINA-901
> URL: https://issues.apache.org/jira/browse/DIRMINA-901
> Project: MINA
> Issue Type: Bug
> Components: Core
> Affects Versions: 2.0.4
> Environment: Linux 2.6.18-164.11.1.el5xen #1 SMP Wed Jan 20 08:06:04 EST 2010 x86_64 x86_64 x86_64 GNU/Linux
> java version "1.6.0_31"
> Java(TM) SE Runtime Environment (build 1.6.0_31-b04)
> Java HotSpot(TM) 64-Bit Server VM (build 20.6-b01, mixed mode)
> Reporter: Florin Sultan
>
> Context:
> -------
> I am using BarchartUDT as transport, which I have integrated with MINA 2.0.4.
> BarchartUDT is a java wrapper to a native UDT library (C++). UDT is a reliable,
> connection-oriented, streaming protocol.
> The example below is the MINA sample sumup client iprogram that breaks
> with an exception during the connect() call into the UDT wrapper.
> Description:
> -----------
> Trigger :
> 1. MINA creates a (non-blocking, by default) UDT channel.
> 2. Calls connect() on it BEFORE registering it with a selector.
> 3. My UDT library does not accept a connect with a nonblocking channel and throws an exception.
> Just for reference, here's the exception in UDT - the message is quite clear :
> Jul 3, 2012 11:22:30 AM com.barchart.udt.nio.ChannelSocketUDT connect
> SEVERE: UDT channel is in non blocking mode;must register with a selector before trying to connect()
> Of course, the above sequence of actions does work with the native TCP channels.
> The problem is that UDT does not accept a connect on a nonblocking AND unregistered channel.
> I am perfectly aware that this is most likely an issue with UDT, and not a bug in MINA.
> However, I would greatly appreciate it if you can provide any suggestions or help.
> Questions :
> 1. What would it take to have MINA perform these actions in reverse (first register, then connect) ?
> Is there an easy change to AbstractPollingIoConnector.connect0 that would do the register before connect,
> for example?
> 2. If this is not possible, is there a way to make the channel blocking, for example?
> 3. Is there other way around it?
> I'd be happy to try any suggestion (or piece of code, if you provide it).
> It would help me get over this hurdle until UDT people give a reply to this issue.
> Details:
> -------
> -- Call stack:
> Jul 13, 2012 1:10:03 PM com.barchart.udt.nio.ChannelSocketUDT connect
> SEVERE: UDT channel is in non blocking mode;must register with a selector before trying to connect()
> Exception in thread "main" java.nio.channels.IllegalBlockingModeException
> at com.barchart.udt.nio.ChannelSocketUDT.connect(ChannelSocketUDT.java:176)
> at org.apache.mina.transport.socket.nio.NioUDTSocketConnector.connect(NioUDTSocketConnector.java:215)
> at org.apache.mina.transport.socket.nio.NioUDTSocketConnector.connect(NioUDTSocketConnector.java:66)
> at org.apache.mina.core.polling.AbstractPollingIoConnector.connect0(AbstractPollingIoConnector.java:320)
> at org.apache.mina.core.service.AbstractIoConnector.connect(AbstractIoConnector.java:262)
> at org.apache.mina.core.service.AbstractIoConnector.connect(AbstractIoConnector.java:172)
> -- Code in question :
> AbstractPollingIoConnector.connect0 :
> creates Connector thread AFTER connect call on the non-blocking channel
> AbstractPollingIoConnector.Connector.run() :
> calls registerNew() :
> private class Connector implements Runnable {
> public Connector() {
> System.out.println("Connector::CTOR " + selectable);
> }
> public void run() {
> assert (connectorRef.get() == this);
> int nHandles = 0;
> while (selectable) {
> try {
> // the timeout for select shall be smaller of the connect
> // timeout or 1 second...
> int timeout = (int)Math.min(getConnectTimeoutMillis(), 1000L);
> int selected = select(timeout);
> nHandles += registerNew();
> Thanks !
> Florin
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira