[jira] [Commented] (DIRMINA-1172) Multiple DatagramAcceptors and the creation of a session object

2023-09-12 Thread Alexander B (Jira)


[ 
https://issues.apache.org/jira/browse/DIRMINA-1172?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17764105#comment-17764105
 ] 

Alexander B commented on DIRMINA-1172:
--

Thanks a lot. (y)

> Multiple DatagramAcceptors and the creation of a session object
> ---
>
> Key: DIRMINA-1172
> URL: https://issues.apache.org/jira/browse/DIRMINA-1172
> Project: MINA
>  Issue Type: Bug
>  Components: Core
>Affects Versions: 2.1.5
>Reporter: Alexander B
>Priority: Major
> Fix For: 2.2.3, 2.0.25, 2.1.8
>
> Attachments: DIRMINA1172.java, UDPTest4.java, 
> apache-mina-2.2.3-SNAPSHOT-bin.tar.gz, mina-core-2.2.3-SNAPSHOT.jar
>
>
> Hello,
> I am using two independently created NioDatagramAcceptors, which are created 
> by the following code :
> {code:java}
> AbstractIoService inputSource = new NioDatagramAcceptor();
> ((NioDatagramAcceptor) inputSource).getSessionConfig().setReuseAddress(true);
> DefaultIoFilterChainBuilder filterChainBuilderUDP = 
> ((NioDatagramAcceptor)inputSource).getFilterChain();
> filterChainBuilderUDP.addLast("logger", new LoggingFilter());
> ((NioDatagramAcceptor) 
> inputSource).getSessionConfig().setIdleTime(IdleStatus.READER_IDLE, 
> getIdleTimeout());
> ((NioDatagramAcceptor) inputSource).setHandler(this);
> try {
>   ((NioDatagramAcceptor)inputSource).bind(new InetSocketAddress(port));
> } catch (IOException e) {
>   log.error("Failed to connect {}", e);
> }
> {code}
> One Acceptor is listening on port 9800, the other one on 9801. If I now send 
> UDP packages (from a external application) to both ports (independently). It 
> seems, that both UDP port are "connected" to the same session.
> Information: The external app is sending:
> Message "TEST_1 " just to port 9800
> Message "TEST_2 " just to port 9801
> The overwritten method messageReceived will give the following output:
> {code:java}
> public void messageReceived(IoSession session, Object message) throws 
> Exception {
>   String msgStr = message.toString();
>   log.info("SessionId:" + session.getId() + " " + msgStr);
> }
> {code}
> 2023-04-19_11:47:35.035 [NioDatagramAcceptor-2] INFO - SessionId:1 TEST_1 
> 1681904855701
> 2023-04-19_11:47:35.035 [NioDatagramAcceptor-3] INFO - SessionId:1 TEST_2 
> 1681904855701
> So, both messages (for port 9800 and port 9801) are received by SessionId1. 
> If I do exactly the same with `NioSocketConnector`, I can see two different 
> sessions, such that both messages are handled independently:
> 2023-04-19_11:44:35.725 [NioProcessor-11] INFO - SessionId:1 TEST_1 
> 1681904875701
> 2023-04-19_11:44:37.754 [NioProcessor-15] INFO - SessionId:2 TEST_2 
> 1681904875701
> Is there anything I did not mention in the context of UDP/DatagramAcceptor? 
> Or is there any setting, such that DatagramAcceptors can create/handle their 
> own session objects?



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

-
To unsubscribe, e-mail: dev-unsubscr...@mina.apache.org
For additional commands, e-mail: dev-h...@mina.apache.org



[jira] [Commented] (DIRMINA-1172) Multiple DatagramAcceptors and the creation of a session object

2023-08-27 Thread Jira


[ 
https://issues.apache.org/jira/browse/DIRMINA-1172?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17759366#comment-17759366
 ] 

Emmanuel Lécharny commented on DIRMINA-1172:


Hi Alexander,

will work on a triple release (2.0,X, 2.1.X and 2.2.X in the coming days). Not 
a lot of available time, but that should not take me a lot of time either.

> Multiple DatagramAcceptors and the creation of a session object
> ---
>
> Key: DIRMINA-1172
> URL: https://issues.apache.org/jira/browse/DIRMINA-1172
> Project: MINA
>  Issue Type: Bug
>  Components: Core
>Affects Versions: 2.1.5
>Reporter: Alexander B
>Priority: Major
> Attachments: DIRMINA1172.java, UDPTest4.java, 
> apache-mina-2.2.3-SNAPSHOT-bin.tar.gz, mina-core-2.2.3-SNAPSHOT.jar
>
>
> Hello,
> I am using two independently created NioDatagramAcceptors, which are created 
> by the following code :
> {code:java}
> AbstractIoService inputSource = new NioDatagramAcceptor();
> ((NioDatagramAcceptor) inputSource).getSessionConfig().setReuseAddress(true);
> DefaultIoFilterChainBuilder filterChainBuilderUDP = 
> ((NioDatagramAcceptor)inputSource).getFilterChain();
> filterChainBuilderUDP.addLast("logger", new LoggingFilter());
> ((NioDatagramAcceptor) 
> inputSource).getSessionConfig().setIdleTime(IdleStatus.READER_IDLE, 
> getIdleTimeout());
> ((NioDatagramAcceptor) inputSource).setHandler(this);
> try {
>   ((NioDatagramAcceptor)inputSource).bind(new InetSocketAddress(port));
> } catch (IOException e) {
>   log.error("Failed to connect {}", e);
> }
> {code}
> One Acceptor is listening on port 9800, the other one on 9801. If I now send 
> UDP packages (from a external application) to both ports (independently). It 
> seems, that both UDP port are "connected" to the same session.
> Information: The external app is sending:
> Message "TEST_1 " just to port 9800
> Message "TEST_2 " just to port 9801
> The overwritten method messageReceived will give the following output:
> {code:java}
> public void messageReceived(IoSession session, Object message) throws 
> Exception {
>   String msgStr = message.toString();
>   log.info("SessionId:" + session.getId() + " " + msgStr);
> }
> {code}
> 2023-04-19_11:47:35.035 [NioDatagramAcceptor-2] INFO - SessionId:1 TEST_1 
> 1681904855701
> 2023-04-19_11:47:35.035 [NioDatagramAcceptor-3] INFO - SessionId:1 TEST_2 
> 1681904855701
> So, both messages (for port 9800 and port 9801) are received by SessionId1. 
> If I do exactly the same with `NioSocketConnector`, I can see two different 
> sessions, such that both messages are handled independently:
> 2023-04-19_11:44:35.725 [NioProcessor-11] INFO - SessionId:1 TEST_1 
> 1681904875701
> 2023-04-19_11:44:37.754 [NioProcessor-15] INFO - SessionId:2 TEST_2 
> 1681904875701
> Is there anything I did not mention in the context of UDP/DatagramAcceptor? 
> Or is there any setting, such that DatagramAcceptors can create/handle their 
> own session objects?



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

-
To unsubscribe, e-mail: dev-unsubscr...@mina.apache.org
For additional commands, e-mail: dev-h...@mina.apache.org



[jira] [Commented] (DIRMINA-1172) Multiple DatagramAcceptors and the creation of a session object

2023-08-24 Thread Alexander B (Jira)


[ 
https://issues.apache.org/jira/browse/DIRMINA-1172?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17758563#comment-17758563
 ] 

Alexander B commented on DIRMINA-1172:
--

Actually, the two Cmd's are running in parallel. 

But, anyway, I think, if it works now - would it be possible to fix this 
officially in 2.1.x and/or 2.2.x ?

Thanks a lot

> Multiple DatagramAcceptors and the creation of a session object
> ---
>
> Key: DIRMINA-1172
> URL: https://issues.apache.org/jira/browse/DIRMINA-1172
> Project: MINA
>  Issue Type: Bug
>  Components: Core
>Affects Versions: 2.1.5
>Reporter: Alexander B
>Priority: Major
> Attachments: DIRMINA1172.java, UDPTest4.java, 
> apache-mina-2.2.3-SNAPSHOT-bin.tar.gz, mina-core-2.2.3-SNAPSHOT.jar
>
>
> Hello,
> I am using two independently created NioDatagramAcceptors, which are created 
> by the following code :
> {code:java}
> AbstractIoService inputSource = new NioDatagramAcceptor();
> ((NioDatagramAcceptor) inputSource).getSessionConfig().setReuseAddress(true);
> DefaultIoFilterChainBuilder filterChainBuilderUDP = 
> ((NioDatagramAcceptor)inputSource).getFilterChain();
> filterChainBuilderUDP.addLast("logger", new LoggingFilter());
> ((NioDatagramAcceptor) 
> inputSource).getSessionConfig().setIdleTime(IdleStatus.READER_IDLE, 
> getIdleTimeout());
> ((NioDatagramAcceptor) inputSource).setHandler(this);
> try {
>   ((NioDatagramAcceptor)inputSource).bind(new InetSocketAddress(port));
> } catch (IOException e) {
>   log.error("Failed to connect {}", e);
> }
> {code}
> One Acceptor is listening on port 9800, the other one on 9801. If I now send 
> UDP packages (from a external application) to both ports (independently). It 
> seems, that both UDP port are "connected" to the same session.
> Information: The external app is sending:
> Message "TEST_1 " just to port 9800
> Message "TEST_2 " just to port 9801
> The overwritten method messageReceived will give the following output:
> {code:java}
> public void messageReceived(IoSession session, Object message) throws 
> Exception {
>   String msgStr = message.toString();
>   log.info("SessionId:" + session.getId() + " " + msgStr);
> }
> {code}
> 2023-04-19_11:47:35.035 [NioDatagramAcceptor-2] INFO - SessionId:1 TEST_1 
> 1681904855701
> 2023-04-19_11:47:35.035 [NioDatagramAcceptor-3] INFO - SessionId:1 TEST_2 
> 1681904855701
> So, both messages (for port 9800 and port 9801) are received by SessionId1. 
> If I do exactly the same with `NioSocketConnector`, I can see two different 
> sessions, such that both messages are handled independently:
> 2023-04-19_11:44:35.725 [NioProcessor-11] INFO - SessionId:1 TEST_1 
> 1681904875701
> 2023-04-19_11:44:37.754 [NioProcessor-15] INFO - SessionId:2 TEST_2 
> 1681904875701
> Is there anything I did not mention in the context of UDP/DatagramAcceptor? 
> Or is there any setting, such that DatagramAcceptors can create/handle their 
> own session objects?



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

-
To unsubscribe, e-mail: dev-unsubscr...@mina.apache.org
For additional commands, e-mail: dev-h...@mina.apache.org



[jira] [Commented] (DIRMINA-1172) Multiple DatagramAcceptors and the creation of a session object

2023-08-24 Thread Jira


[ 
https://issues.apache.org/jira/browse/DIRMINA-1172?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17758540#comment-17758540
 ] 

Emmanuel Lécharny commented on DIRMINA-1172:


The session does not last forever, may be it expired in scenario 2?

> Multiple DatagramAcceptors and the creation of a session object
> ---
>
> Key: DIRMINA-1172
> URL: https://issues.apache.org/jira/browse/DIRMINA-1172
> Project: MINA
>  Issue Type: Bug
>  Components: Core
>Affects Versions: 2.1.5
>Reporter: Alexander B
>Priority: Major
> Attachments: DIRMINA1172.java, UDPTest4.java, 
> apache-mina-2.2.3-SNAPSHOT-bin.tar.gz, mina-core-2.2.3-SNAPSHOT.jar
>
>
> Hello,
> I am using two independently created NioDatagramAcceptors, which are created 
> by the following code :
> {code:java}
> AbstractIoService inputSource = new NioDatagramAcceptor();
> ((NioDatagramAcceptor) inputSource).getSessionConfig().setReuseAddress(true);
> DefaultIoFilterChainBuilder filterChainBuilderUDP = 
> ((NioDatagramAcceptor)inputSource).getFilterChain();
> filterChainBuilderUDP.addLast("logger", new LoggingFilter());
> ((NioDatagramAcceptor) 
> inputSource).getSessionConfig().setIdleTime(IdleStatus.READER_IDLE, 
> getIdleTimeout());
> ((NioDatagramAcceptor) inputSource).setHandler(this);
> try {
>   ((NioDatagramAcceptor)inputSource).bind(new InetSocketAddress(port));
> } catch (IOException e) {
>   log.error("Failed to connect {}", e);
> }
> {code}
> One Acceptor is listening on port 9800, the other one on 9801. If I now send 
> UDP packages (from a external application) to both ports (independently). It 
> seems, that both UDP port are "connected" to the same session.
> Information: The external app is sending:
> Message "TEST_1 " just to port 9800
> Message "TEST_2 " just to port 9801
> The overwritten method messageReceived will give the following output:
> {code:java}
> public void messageReceived(IoSession session, Object message) throws 
> Exception {
>   String msgStr = message.toString();
>   log.info("SessionId:" + session.getId() + " " + msgStr);
> }
> {code}
> 2023-04-19_11:47:35.035 [NioDatagramAcceptor-2] INFO - SessionId:1 TEST_1 
> 1681904855701
> 2023-04-19_11:47:35.035 [NioDatagramAcceptor-3] INFO - SessionId:1 TEST_2 
> 1681904855701
> So, both messages (for port 9800 and port 9801) are received by SessionId1. 
> If I do exactly the same with `NioSocketConnector`, I can see two different 
> sessions, such that both messages are handled independently:
> 2023-04-19_11:44:35.725 [NioProcessor-11] INFO - SessionId:1 TEST_1 
> 1681904875701
> 2023-04-19_11:44:37.754 [NioProcessor-15] INFO - SessionId:2 TEST_2 
> 1681904875701
> Is there anything I did not mention in the context of UDP/DatagramAcceptor? 
> Or is there any setting, such that DatagramAcceptors can create/handle their 
> own session objects?



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

-
To unsubscribe, e-mail: dev-unsubscr...@mina.apache.org
For additional commands, e-mail: dev-h...@mina.apache.org



[jira] [Commented] (DIRMINA-1172) Multiple DatagramAcceptors and the creation of a session object

2023-08-24 Thread Alexander B (Jira)


[ 
https://issues.apache.org/jira/browse/DIRMINA-1172?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17758460#comment-17758460
 ] 

Alexander B commented on DIRMINA-1172:
--

Actually, I still did not get the clue. Before, the port was not part of the 
session key. And scenario 2 worked before. It was just scenario 3, that did not 
work. Scenario 2 and 3 are both sending to different ports. The difference is 
just from two applications or just from one. In both scenarios you can find 
just one sending machine.

> Multiple DatagramAcceptors and the creation of a session object
> ---
>
> Key: DIRMINA-1172
> URL: https://issues.apache.org/jira/browse/DIRMINA-1172
> Project: MINA
>  Issue Type: Bug
>  Components: Core
>Affects Versions: 2.1.5
>Reporter: Alexander B
>Priority: Major
> Attachments: DIRMINA1172.java, UDPTest4.java, 
> apache-mina-2.2.3-SNAPSHOT-bin.tar.gz, mina-core-2.2.3-SNAPSHOT.jar
>
>
> Hello,
> I am using two independently created NioDatagramAcceptors, which are created 
> by the following code :
> {code:java}
> AbstractIoService inputSource = new NioDatagramAcceptor();
> ((NioDatagramAcceptor) inputSource).getSessionConfig().setReuseAddress(true);
> DefaultIoFilterChainBuilder filterChainBuilderUDP = 
> ((NioDatagramAcceptor)inputSource).getFilterChain();
> filterChainBuilderUDP.addLast("logger", new LoggingFilter());
> ((NioDatagramAcceptor) 
> inputSource).getSessionConfig().setIdleTime(IdleStatus.READER_IDLE, 
> getIdleTimeout());
> ((NioDatagramAcceptor) inputSource).setHandler(this);
> try {
>   ((NioDatagramAcceptor)inputSource).bind(new InetSocketAddress(port));
> } catch (IOException e) {
>   log.error("Failed to connect {}", e);
> }
> {code}
> One Acceptor is listening on port 9800, the other one on 9801. If I now send 
> UDP packages (from a external application) to both ports (independently). It 
> seems, that both UDP port are "connected" to the same session.
> Information: The external app is sending:
> Message "TEST_1 " just to port 9800
> Message "TEST_2 " just to port 9801
> The overwritten method messageReceived will give the following output:
> {code:java}
> public void messageReceived(IoSession session, Object message) throws 
> Exception {
>   String msgStr = message.toString();
>   log.info("SessionId:" + session.getId() + " " + msgStr);
> }
> {code}
> 2023-04-19_11:47:35.035 [NioDatagramAcceptor-2] INFO - SessionId:1 TEST_1 
> 1681904855701
> 2023-04-19_11:47:35.035 [NioDatagramAcceptor-3] INFO - SessionId:1 TEST_2 
> 1681904855701
> So, both messages (for port 9800 and port 9801) are received by SessionId1. 
> If I do exactly the same with `NioSocketConnector`, I can see two different 
> sessions, such that both messages are handled independently:
> 2023-04-19_11:44:35.725 [NioProcessor-11] INFO - SessionId:1 TEST_1 
> 1681904875701
> 2023-04-19_11:44:37.754 [NioProcessor-15] INFO - SessionId:2 TEST_2 
> 1681904875701
> Is there anything I did not mention in the context of UDP/DatagramAcceptor? 
> Or is there any setting, such that DatagramAcceptors can create/handle their 
> own session objects?



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

-
To unsubscribe, e-mail: dev-unsubscr...@mina.apache.org
For additional commands, e-mail: dev-h...@mina.apache.org



[jira] [Commented] (DIRMINA-1172) Multiple DatagramAcceptors and the creation of a session object

2023-08-24 Thread Jira


[ 
https://issues.apache.org/jira/browse/DIRMINA-1172?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17758452#comment-17758452
 ] 

Emmanuel Lécharny commented on DIRMINA-1172:


Hi, Alexender,

they do have the same IP address, but they aren't sending the data to the same 
port. Now that the port is part of the session key, two sessions will be 
created.

> Multiple DatagramAcceptors and the creation of a session object
> ---
>
> Key: DIRMINA-1172
> URL: https://issues.apache.org/jira/browse/DIRMINA-1172
> Project: MINA
>  Issue Type: Bug
>  Components: Core
>Affects Versions: 2.1.5
>Reporter: Alexander B
>Priority: Major
> Attachments: DIRMINA1172.java, UDPTest4.java, 
> apache-mina-2.2.3-SNAPSHOT-bin.tar.gz, mina-core-2.2.3-SNAPSHOT.jar
>
>
> Hello,
> I am using two independently created NioDatagramAcceptors, which are created 
> by the following code :
> {code:java}
> AbstractIoService inputSource = new NioDatagramAcceptor();
> ((NioDatagramAcceptor) inputSource).getSessionConfig().setReuseAddress(true);
> DefaultIoFilterChainBuilder filterChainBuilderUDP = 
> ((NioDatagramAcceptor)inputSource).getFilterChain();
> filterChainBuilderUDP.addLast("logger", new LoggingFilter());
> ((NioDatagramAcceptor) 
> inputSource).getSessionConfig().setIdleTime(IdleStatus.READER_IDLE, 
> getIdleTimeout());
> ((NioDatagramAcceptor) inputSource).setHandler(this);
> try {
>   ((NioDatagramAcceptor)inputSource).bind(new InetSocketAddress(port));
> } catch (IOException e) {
>   log.error("Failed to connect {}", e);
> }
> {code}
> One Acceptor is listening on port 9800, the other one on 9801. If I now send 
> UDP packages (from a external application) to both ports (independently). It 
> seems, that both UDP port are "connected" to the same session.
> Information: The external app is sending:
> Message "TEST_1 " just to port 9800
> Message "TEST_2 " just to port 9801
> The overwritten method messageReceived will give the following output:
> {code:java}
> public void messageReceived(IoSession session, Object message) throws 
> Exception {
>   String msgStr = message.toString();
>   log.info("SessionId:" + session.getId() + " " + msgStr);
> }
> {code}
> 2023-04-19_11:47:35.035 [NioDatagramAcceptor-2] INFO - SessionId:1 TEST_1 
> 1681904855701
> 2023-04-19_11:47:35.035 [NioDatagramAcceptor-3] INFO - SessionId:1 TEST_2 
> 1681904855701
> So, both messages (for port 9800 and port 9801) are received by SessionId1. 
> If I do exactly the same with `NioSocketConnector`, I can see two different 
> sessions, such that both messages are handled independently:
> 2023-04-19_11:44:35.725 [NioProcessor-11] INFO - SessionId:1 TEST_1 
> 1681904875701
> 2023-04-19_11:44:37.754 [NioProcessor-15] INFO - SessionId:2 TEST_2 
> 1681904875701
> Is there anything I did not mention in the context of UDP/DatagramAcceptor? 
> Or is there any setting, such that DatagramAcceptors can create/handle their 
> own session objects?



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

-
To unsubscribe, e-mail: dev-unsubscr...@mina.apache.org
For additional commands, e-mail: dev-h...@mina.apache.org



[jira] [Commented] (DIRMINA-1172) Multiple DatagramAcceptors and the creation of a session object

2023-08-24 Thread Alexander B (Jira)


[ 
https://issues.apache.org/jira/browse/DIRMINA-1172?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17758431#comment-17758431
 ] 

Alexander B commented on DIRMINA-1172:
--

Thanks a lot - i think my three scenarios are working fine now.

What I actually don't understand is the second scenario: There are two Cmds 
from one machine sending to a target machine. For me it seems that these 
senders should have the same remote address - don't they? Why did this work 
before as well? Just the case sending to two different ports from one 
application (on one machine) to one target machine seems to be problematic?

> Multiple DatagramAcceptors and the creation of a session object
> ---
>
> Key: DIRMINA-1172
> URL: https://issues.apache.org/jira/browse/DIRMINA-1172
> Project: MINA
>  Issue Type: Bug
>  Components: Core
>Affects Versions: 2.1.5
>Reporter: Alexander B
>Priority: Major
> Attachments: DIRMINA1172.java, UDPTest4.java, 
> apache-mina-2.2.3-SNAPSHOT-bin.tar.gz, mina-core-2.2.3-SNAPSHOT.jar
>
>
> Hello,
> I am using two independently created NioDatagramAcceptors, which are created 
> by the following code :
> {code:java}
> AbstractIoService inputSource = new NioDatagramAcceptor();
> ((NioDatagramAcceptor) inputSource).getSessionConfig().setReuseAddress(true);
> DefaultIoFilterChainBuilder filterChainBuilderUDP = 
> ((NioDatagramAcceptor)inputSource).getFilterChain();
> filterChainBuilderUDP.addLast("logger", new LoggingFilter());
> ((NioDatagramAcceptor) 
> inputSource).getSessionConfig().setIdleTime(IdleStatus.READER_IDLE, 
> getIdleTimeout());
> ((NioDatagramAcceptor) inputSource).setHandler(this);
> try {
>   ((NioDatagramAcceptor)inputSource).bind(new InetSocketAddress(port));
> } catch (IOException e) {
>   log.error("Failed to connect {}", e);
> }
> {code}
> One Acceptor is listening on port 9800, the other one on 9801. If I now send 
> UDP packages (from a external application) to both ports (independently). It 
> seems, that both UDP port are "connected" to the same session.
> Information: The external app is sending:
> Message "TEST_1 " just to port 9800
> Message "TEST_2 " just to port 9801
> The overwritten method messageReceived will give the following output:
> {code:java}
> public void messageReceived(IoSession session, Object message) throws 
> Exception {
>   String msgStr = message.toString();
>   log.info("SessionId:" + session.getId() + " " + msgStr);
> }
> {code}
> 2023-04-19_11:47:35.035 [NioDatagramAcceptor-2] INFO - SessionId:1 TEST_1 
> 1681904855701
> 2023-04-19_11:47:35.035 [NioDatagramAcceptor-3] INFO - SessionId:1 TEST_2 
> 1681904855701
> So, both messages (for port 9800 and port 9801) are received by SessionId1. 
> If I do exactly the same with `NioSocketConnector`, I can see two different 
> sessions, such that both messages are handled independently:
> 2023-04-19_11:44:35.725 [NioProcessor-11] INFO - SessionId:1 TEST_1 
> 1681904875701
> 2023-04-19_11:44:37.754 [NioProcessor-15] INFO - SessionId:2 TEST_2 
> 1681904875701
> Is there anything I did not mention in the context of UDP/DatagramAcceptor? 
> Or is there any setting, such that DatagramAcceptors can create/handle their 
> own session objects?



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

-
To unsubscribe, e-mail: dev-unsubscr...@mina.apache.org
For additional commands, e-mail: dev-h...@mina.apache.org



[jira] [Commented] (DIRMINA-1172) Multiple DatagramAcceptors and the creation of a session object

2023-08-23 Thread Alexander B (Jira)


[ 
https://issues.apache.org/jira/browse/DIRMINA-1172?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17758062#comment-17758062
 ] 

Alexander B commented on DIRMINA-1172:
--

Yes, this should be enough. In our dependency-list I can just see 
`org.apache.mina.mina-core`. 
I will replace this and let you know. 
Thanks so far.

> Multiple DatagramAcceptors and the creation of a session object
> ---
>
> Key: DIRMINA-1172
> URL: https://issues.apache.org/jira/browse/DIRMINA-1172
> Project: MINA
>  Issue Type: Bug
>  Components: Core
>Affects Versions: 2.1.5
>Reporter: Alexander B
>Priority: Major
> Attachments: DIRMINA1172.java, UDPTest4.java, 
> apache-mina-2.2.3-SNAPSHOT-bin.tar.gz, mina-core-2.2.3-SNAPSHOT.jar
>
>
> Hello,
> I am using two independently created NioDatagramAcceptors, which are created 
> by the following code :
> {code:java}
> AbstractIoService inputSource = new NioDatagramAcceptor();
> ((NioDatagramAcceptor) inputSource).getSessionConfig().setReuseAddress(true);
> DefaultIoFilterChainBuilder filterChainBuilderUDP = 
> ((NioDatagramAcceptor)inputSource).getFilterChain();
> filterChainBuilderUDP.addLast("logger", new LoggingFilter());
> ((NioDatagramAcceptor) 
> inputSource).getSessionConfig().setIdleTime(IdleStatus.READER_IDLE, 
> getIdleTimeout());
> ((NioDatagramAcceptor) inputSource).setHandler(this);
> try {
>   ((NioDatagramAcceptor)inputSource).bind(new InetSocketAddress(port));
> } catch (IOException e) {
>   log.error("Failed to connect {}", e);
> }
> {code}
> One Acceptor is listening on port 9800, the other one on 9801. If I now send 
> UDP packages (from a external application) to both ports (independently). It 
> seems, that both UDP port are "connected" to the same session.
> Information: The external app is sending:
> Message "TEST_1 " just to port 9800
> Message "TEST_2 " just to port 9801
> The overwritten method messageReceived will give the following output:
> {code:java}
> public void messageReceived(IoSession session, Object message) throws 
> Exception {
>   String msgStr = message.toString();
>   log.info("SessionId:" + session.getId() + " " + msgStr);
> }
> {code}
> 2023-04-19_11:47:35.035 [NioDatagramAcceptor-2] INFO - SessionId:1 TEST_1 
> 1681904855701
> 2023-04-19_11:47:35.035 [NioDatagramAcceptor-3] INFO - SessionId:1 TEST_2 
> 1681904855701
> So, both messages (for port 9800 and port 9801) are received by SessionId1. 
> If I do exactly the same with `NioSocketConnector`, I can see two different 
> sessions, such that both messages are handled independently:
> 2023-04-19_11:44:35.725 [NioProcessor-11] INFO - SessionId:1 TEST_1 
> 1681904875701
> 2023-04-19_11:44:37.754 [NioProcessor-15] INFO - SessionId:2 TEST_2 
> 1681904875701
> Is there anything I did not mention in the context of UDP/DatagramAcceptor? 
> Or is there any setting, such that DatagramAcceptors can create/handle their 
> own session objects?



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

-
To unsubscribe, e-mail: dev-unsubscr...@mina.apache.org
For additional commands, e-mail: dev-h...@mina.apache.org



[jira] [Commented] (DIRMINA-1172) Multiple DatagramAcceptors and the creation of a session object

2023-08-23 Thread Jira


[ 
https://issues.apache.org/jira/browse/DIRMINA-1172?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17758030#comment-17758030
 ] 

Emmanuel Lécharny commented on DIRMINA-1172:


Tell me which jar you requires. If it's only mina-core, find it attachaed.

> Multiple DatagramAcceptors and the creation of a session object
> ---
>
> Key: DIRMINA-1172
> URL: https://issues.apache.org/jira/browse/DIRMINA-1172
> Project: MINA
>  Issue Type: Bug
>  Components: Core
>Affects Versions: 2.1.5
>Reporter: Alexander B
>Priority: Major
> Attachments: DIRMINA1172.java, UDPTest4.java, 
> apache-mina-2.2.3-SNAPSHOT-bin.tar.gz, mina-core-2.2.3-SNAPSHOT.jar
>
>
> Hello,
> I am using two independently created NioDatagramAcceptors, which are created 
> by the following code :
> {code:java}
> AbstractIoService inputSource = new NioDatagramAcceptor();
> ((NioDatagramAcceptor) inputSource).getSessionConfig().setReuseAddress(true);
> DefaultIoFilterChainBuilder filterChainBuilderUDP = 
> ((NioDatagramAcceptor)inputSource).getFilterChain();
> filterChainBuilderUDP.addLast("logger", new LoggingFilter());
> ((NioDatagramAcceptor) 
> inputSource).getSessionConfig().setIdleTime(IdleStatus.READER_IDLE, 
> getIdleTimeout());
> ((NioDatagramAcceptor) inputSource).setHandler(this);
> try {
>   ((NioDatagramAcceptor)inputSource).bind(new InetSocketAddress(port));
> } catch (IOException e) {
>   log.error("Failed to connect {}", e);
> }
> {code}
> One Acceptor is listening on port 9800, the other one on 9801. If I now send 
> UDP packages (from a external application) to both ports (independently). It 
> seems, that both UDP port are "connected" to the same session.
> Information: The external app is sending:
> Message "TEST_1 " just to port 9800
> Message "TEST_2 " just to port 9801
> The overwritten method messageReceived will give the following output:
> {code:java}
> public void messageReceived(IoSession session, Object message) throws 
> Exception {
>   String msgStr = message.toString();
>   log.info("SessionId:" + session.getId() + " " + msgStr);
> }
> {code}
> 2023-04-19_11:47:35.035 [NioDatagramAcceptor-2] INFO - SessionId:1 TEST_1 
> 1681904855701
> 2023-04-19_11:47:35.035 [NioDatagramAcceptor-3] INFO - SessionId:1 TEST_2 
> 1681904855701
> So, both messages (for port 9800 and port 9801) are received by SessionId1. 
> If I do exactly the same with `NioSocketConnector`, I can see two different 
> sessions, such that both messages are handled independently:
> 2023-04-19_11:44:35.725 [NioProcessor-11] INFO - SessionId:1 TEST_1 
> 1681904875701
> 2023-04-19_11:44:37.754 [NioProcessor-15] INFO - SessionId:2 TEST_2 
> 1681904875701
> Is there anything I did not mention in the context of UDP/DatagramAcceptor? 
> Or is there any setting, such that DatagramAcceptors can create/handle their 
> own session objects?



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

-
To unsubscribe, e-mail: dev-unsubscr...@mina.apache.org
For additional commands, e-mail: dev-h...@mina.apache.org



[jira] [Commented] (DIRMINA-1172) Multiple DatagramAcceptors and the creation of a session object

2023-08-23 Thread Alexander B (Jira)


[ 
https://issues.apache.org/jira/browse/DIRMINA-1172?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17758025#comment-17758025
 ] 

Alexander B commented on DIRMINA-1172:
--

Thanks a lot for a fast fix.

I will try it. Give me a bit of time - I try to combine your  jar files with 
our maven project.

> Multiple DatagramAcceptors and the creation of a session object
> ---
>
> Key: DIRMINA-1172
> URL: https://issues.apache.org/jira/browse/DIRMINA-1172
> Project: MINA
>  Issue Type: Bug
>  Components: Core
>Affects Versions: 2.1.5
>Reporter: Alexander B
>Priority: Major
> Attachments: DIRMINA1172.java, UDPTest4.java, 
> apache-mina-2.2.3-SNAPSHOT-bin.tar.gz
>
>
> Hello,
> I am using two independently created NioDatagramAcceptors, which are created 
> by the following code :
> {code:java}
> AbstractIoService inputSource = new NioDatagramAcceptor();
> ((NioDatagramAcceptor) inputSource).getSessionConfig().setReuseAddress(true);
> DefaultIoFilterChainBuilder filterChainBuilderUDP = 
> ((NioDatagramAcceptor)inputSource).getFilterChain();
> filterChainBuilderUDP.addLast("logger", new LoggingFilter());
> ((NioDatagramAcceptor) 
> inputSource).getSessionConfig().setIdleTime(IdleStatus.READER_IDLE, 
> getIdleTimeout());
> ((NioDatagramAcceptor) inputSource).setHandler(this);
> try {
>   ((NioDatagramAcceptor)inputSource).bind(new InetSocketAddress(port));
> } catch (IOException e) {
>   log.error("Failed to connect {}", e);
> }
> {code}
> One Acceptor is listening on port 9800, the other one on 9801. If I now send 
> UDP packages (from a external application) to both ports (independently). It 
> seems, that both UDP port are "connected" to the same session.
> Information: The external app is sending:
> Message "TEST_1 " just to port 9800
> Message "TEST_2 " just to port 9801
> The overwritten method messageReceived will give the following output:
> {code:java}
> public void messageReceived(IoSession session, Object message) throws 
> Exception {
>   String msgStr = message.toString();
>   log.info("SessionId:" + session.getId() + " " + msgStr);
> }
> {code}
> 2023-04-19_11:47:35.035 [NioDatagramAcceptor-2] INFO - SessionId:1 TEST_1 
> 1681904855701
> 2023-04-19_11:47:35.035 [NioDatagramAcceptor-3] INFO - SessionId:1 TEST_2 
> 1681904855701
> So, both messages (for port 9800 and port 9801) are received by SessionId1. 
> If I do exactly the same with `NioSocketConnector`, I can see two different 
> sessions, such that both messages are handled independently:
> 2023-04-19_11:44:35.725 [NioProcessor-11] INFO - SessionId:1 TEST_1 
> 1681904875701
> 2023-04-19_11:44:37.754 [NioProcessor-15] INFO - SessionId:2 TEST_2 
> 1681904875701
> Is there anything I did not mention in the context of UDP/DatagramAcceptor? 
> Or is there any setting, such that DatagramAcceptors can create/handle their 
> own session objects?



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

-
To unsubscribe, e-mail: dev-unsubscr...@mina.apache.org
For additional commands, e-mail: dev-h...@mina.apache.org



[jira] [Commented] (DIRMINA-1172) Multiple DatagramAcceptors and the creation of a session object

2023-08-23 Thread Jira


[ 
https://issues.apache.org/jira/browse/DIRMINA-1172?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17757997#comment-17757997
 ] 

Emmanuel Lécharny commented on DIRMINA-1172:


Hi Alexander,

could you give the attached package a try, please?

 

Thanks!

> Multiple DatagramAcceptors and the creation of a session object
> ---
>
> Key: DIRMINA-1172
> URL: https://issues.apache.org/jira/browse/DIRMINA-1172
> Project: MINA
>  Issue Type: Bug
>  Components: Core
>Affects Versions: 2.1.5
>Reporter: Alexander B
>Priority: Major
> Attachments: DIRMINA1172.java, UDPTest4.java
>
>
> Hello,
> I am using two independently created NioDatagramAcceptors, which are created 
> by the following code :
> {code:java}
> AbstractIoService inputSource = new NioDatagramAcceptor();
> ((NioDatagramAcceptor) inputSource).getSessionConfig().setReuseAddress(true);
> DefaultIoFilterChainBuilder filterChainBuilderUDP = 
> ((NioDatagramAcceptor)inputSource).getFilterChain();
> filterChainBuilderUDP.addLast("logger", new LoggingFilter());
> ((NioDatagramAcceptor) 
> inputSource).getSessionConfig().setIdleTime(IdleStatus.READER_IDLE, 
> getIdleTimeout());
> ((NioDatagramAcceptor) inputSource).setHandler(this);
> try {
>   ((NioDatagramAcceptor)inputSource).bind(new InetSocketAddress(port));
> } catch (IOException e) {
>   log.error("Failed to connect {}", e);
> }
> {code}
> One Acceptor is listening on port 9800, the other one on 9801. If I now send 
> UDP packages (from a external application) to both ports (independently). It 
> seems, that both UDP port are "connected" to the same session.
> Information: The external app is sending:
> Message "TEST_1 " just to port 9800
> Message "TEST_2 " just to port 9801
> The overwritten method messageReceived will give the following output:
> {code:java}
> public void messageReceived(IoSession session, Object message) throws 
> Exception {
>   String msgStr = message.toString();
>   log.info("SessionId:" + session.getId() + " " + msgStr);
> }
> {code}
> 2023-04-19_11:47:35.035 [NioDatagramAcceptor-2] INFO - SessionId:1 TEST_1 
> 1681904855701
> 2023-04-19_11:47:35.035 [NioDatagramAcceptor-3] INFO - SessionId:1 TEST_2 
> 1681904855701
> So, both messages (for port 9800 and port 9801) are received by SessionId1. 
> If I do exactly the same with `NioSocketConnector`, I can see two different 
> sessions, such that both messages are handled independently:
> 2023-04-19_11:44:35.725 [NioProcessor-11] INFO - SessionId:1 TEST_1 
> 1681904875701
> 2023-04-19_11:44:37.754 [NioProcessor-15] INFO - SessionId:2 TEST_2 
> 1681904875701
> Is there anything I did not mention in the context of UDP/DatagramAcceptor? 
> Or is there any setting, such that DatagramAcceptors can create/handle their 
> own session objects?



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

-
To unsubscribe, e-mail: dev-unsubscr...@mina.apache.org
For additional commands, e-mail: dev-h...@mina.apache.org



[jira] [Commented] (DIRMINA-1172) Multiple DatagramAcceptors and the creation of a session object

2023-08-23 Thread Jira


[ 
https://issues.apache.org/jira/browse/DIRMINA-1172?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17757914#comment-17757914
 ] 

Emmanuel Lécharny commented on DIRMINA-1172:


The idea is to build a key that contains the remote address and the local port. 
All in all, there is no reason to create a session that is shared between two 
ports.

> Multiple DatagramAcceptors and the creation of a session object
> ---
>
> Key: DIRMINA-1172
> URL: https://issues.apache.org/jira/browse/DIRMINA-1172
> Project: MINA
>  Issue Type: Bug
>  Components: Core
>Affects Versions: 2.1.5
>Reporter: Alexander B
>Priority: Major
> Attachments: DIRMINA1172.java, UDPTest4.java
>
>
> Hello,
> I am using two independently created NioDatagramAcceptors, which are created 
> by the following code :
> {code:java}
> AbstractIoService inputSource = new NioDatagramAcceptor();
> ((NioDatagramAcceptor) inputSource).getSessionConfig().setReuseAddress(true);
> DefaultIoFilterChainBuilder filterChainBuilderUDP = 
> ((NioDatagramAcceptor)inputSource).getFilterChain();
> filterChainBuilderUDP.addLast("logger", new LoggingFilter());
> ((NioDatagramAcceptor) 
> inputSource).getSessionConfig().setIdleTime(IdleStatus.READER_IDLE, 
> getIdleTimeout());
> ((NioDatagramAcceptor) inputSource).setHandler(this);
> try {
>   ((NioDatagramAcceptor)inputSource).bind(new InetSocketAddress(port));
> } catch (IOException e) {
>   log.error("Failed to connect {}", e);
> }
> {code}
> One Acceptor is listening on port 9800, the other one on 9801. If I now send 
> UDP packages (from a external application) to both ports (independently). It 
> seems, that both UDP port are "connected" to the same session.
> Information: The external app is sending:
> Message "TEST_1 " just to port 9800
> Message "TEST_2 " just to port 9801
> The overwritten method messageReceived will give the following output:
> {code:java}
> public void messageReceived(IoSession session, Object message) throws 
> Exception {
>   String msgStr = message.toString();
>   log.info("SessionId:" + session.getId() + " " + msgStr);
> }
> {code}
> 2023-04-19_11:47:35.035 [NioDatagramAcceptor-2] INFO - SessionId:1 TEST_1 
> 1681904855701
> 2023-04-19_11:47:35.035 [NioDatagramAcceptor-3] INFO - SessionId:1 TEST_2 
> 1681904855701
> So, both messages (for port 9800 and port 9801) are received by SessionId1. 
> If I do exactly the same with `NioSocketConnector`, I can see two different 
> sessions, such that both messages are handled independently:
> 2023-04-19_11:44:35.725 [NioProcessor-11] INFO - SessionId:1 TEST_1 
> 1681904875701
> 2023-04-19_11:44:37.754 [NioProcessor-15] INFO - SessionId:2 TEST_2 
> 1681904875701
> Is there anything I did not mention in the context of UDP/DatagramAcceptor? 
> Or is there any setting, such that DatagramAcceptors can create/handle their 
> own session objects?



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

-
To unsubscribe, e-mail: dev-unsubscr...@mina.apache.org
For additional commands, e-mail: dev-h...@mina.apache.org



[jira] [Commented] (DIRMINA-1172) Multiple DatagramAcceptors and the creation of a session object

2023-08-23 Thread Alexander B (Jira)


[ 
https://issues.apache.org/jira/browse/DIRMINA-1172?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17757888#comment-17757888
 ] 

Alexander B commented on DIRMINA-1172:
--

But would it be correct, that you handle TCP-Sessions (NioSocketConnector's) on 
another way (including the remote port or anything like this)?

> Multiple DatagramAcceptors and the creation of a session object
> ---
>
> Key: DIRMINA-1172
> URL: https://issues.apache.org/jira/browse/DIRMINA-1172
> Project: MINA
>  Issue Type: Bug
>  Components: Core
>Affects Versions: 2.1.5
>Reporter: Alexander B
>Priority: Major
> Attachments: DIRMINA1172.java, UDPTest4.java
>
>
> Hello,
> I am using two independently created NioDatagramAcceptors, which are created 
> by the following code :
> {code:java}
> AbstractIoService inputSource = new NioDatagramAcceptor();
> ((NioDatagramAcceptor) inputSource).getSessionConfig().setReuseAddress(true);
> DefaultIoFilterChainBuilder filterChainBuilderUDP = 
> ((NioDatagramAcceptor)inputSource).getFilterChain();
> filterChainBuilderUDP.addLast("logger", new LoggingFilter());
> ((NioDatagramAcceptor) 
> inputSource).getSessionConfig().setIdleTime(IdleStatus.READER_IDLE, 
> getIdleTimeout());
> ((NioDatagramAcceptor) inputSource).setHandler(this);
> try {
>   ((NioDatagramAcceptor)inputSource).bind(new InetSocketAddress(port));
> } catch (IOException e) {
>   log.error("Failed to connect {}", e);
> }
> {code}
> One Acceptor is listening on port 9800, the other one on 9801. If I now send 
> UDP packages (from a external application) to both ports (independently). It 
> seems, that both UDP port are "connected" to the same session.
> Information: The external app is sending:
> Message "TEST_1 " just to port 9800
> Message "TEST_2 " just to port 9801
> The overwritten method messageReceived will give the following output:
> {code:java}
> public void messageReceived(IoSession session, Object message) throws 
> Exception {
>   String msgStr = message.toString();
>   log.info("SessionId:" + session.getId() + " " + msgStr);
> }
> {code}
> 2023-04-19_11:47:35.035 [NioDatagramAcceptor-2] INFO - SessionId:1 TEST_1 
> 1681904855701
> 2023-04-19_11:47:35.035 [NioDatagramAcceptor-3] INFO - SessionId:1 TEST_2 
> 1681904855701
> So, both messages (for port 9800 and port 9801) are received by SessionId1. 
> If I do exactly the same with `NioSocketConnector`, I can see two different 
> sessions, such that both messages are handled independently:
> 2023-04-19_11:44:35.725 [NioProcessor-11] INFO - SessionId:1 TEST_1 
> 1681904875701
> 2023-04-19_11:44:37.754 [NioProcessor-15] INFO - SessionId:2 TEST_2 
> 1681904875701
> Is there anything I did not mention in the context of UDP/DatagramAcceptor? 
> Or is there any setting, such that DatagramAcceptors can create/handle their 
> own session objects?



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

-
To unsubscribe, e-mail: dev-unsubscr...@mina.apache.org
For additional commands, e-mail: dev-h...@mina.apache.org



[jira] [Commented] (DIRMINA-1172) Multiple DatagramAcceptors and the creation of a session object

2023-08-22 Thread Jira


[ 
https://issues.apache.org/jira/browse/DIRMINA-1172?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17757818#comment-17757818
 ] 

Emmanuel Lécharny commented on DIRMINA-1172:


Ok, if I create two instances, I get to see that there is only one acceptor 
receiving all the messages, whatever the port used.

The problem is that we keep sessions in a cache with the key being the 
RemoteAdress, the port not being taken into account:
{code:java}
    private ExpiringMap sessionMap;

public void put(IoSession session) {
mapExpirer.startExpiringIfNotStarted();
SocketAddress key = session.getRemoteAddress();

if (!sessionMap.containsKey(key)) {
sessionMap.put(key, session);
}
} {code}
At this point, we must certainly need to inject the port in the key, which will 
require some modification in the session map handling.

> Multiple DatagramAcceptors and the creation of a session object
> ---
>
> Key: DIRMINA-1172
> URL: https://issues.apache.org/jira/browse/DIRMINA-1172
> Project: MINA
>  Issue Type: Bug
>  Components: Core
>Affects Versions: 2.1.5
>Reporter: Alexander B
>Priority: Major
> Attachments: DIRMINA1172.java, UDPTest4.java
>
>
> Hello,
> I am using two independently created NioDatagramAcceptors, which are created 
> by the following code :
> {code:java}
> AbstractIoService inputSource = new NioDatagramAcceptor();
> ((NioDatagramAcceptor) inputSource).getSessionConfig().setReuseAddress(true);
> DefaultIoFilterChainBuilder filterChainBuilderUDP = 
> ((NioDatagramAcceptor)inputSource).getFilterChain();
> filterChainBuilderUDP.addLast("logger", new LoggingFilter());
> ((NioDatagramAcceptor) 
> inputSource).getSessionConfig().setIdleTime(IdleStatus.READER_IDLE, 
> getIdleTimeout());
> ((NioDatagramAcceptor) inputSource).setHandler(this);
> try {
>   ((NioDatagramAcceptor)inputSource).bind(new InetSocketAddress(port));
> } catch (IOException e) {
>   log.error("Failed to connect {}", e);
> }
> {code}
> One Acceptor is listening on port 9800, the other one on 9801. If I now send 
> UDP packages (from a external application) to both ports (independently). It 
> seems, that both UDP port are "connected" to the same session.
> Information: The external app is sending:
> Message "TEST_1 " just to port 9800
> Message "TEST_2 " just to port 9801
> The overwritten method messageReceived will give the following output:
> {code:java}
> public void messageReceived(IoSession session, Object message) throws 
> Exception {
>   String msgStr = message.toString();
>   log.info("SessionId:" + session.getId() + " " + msgStr);
> }
> {code}
> 2023-04-19_11:47:35.035 [NioDatagramAcceptor-2] INFO - SessionId:1 TEST_1 
> 1681904855701
> 2023-04-19_11:47:35.035 [NioDatagramAcceptor-3] INFO - SessionId:1 TEST_2 
> 1681904855701
> So, both messages (for port 9800 and port 9801) are received by SessionId1. 
> If I do exactly the same with `NioSocketConnector`, I can see two different 
> sessions, such that both messages are handled independently:
> 2023-04-19_11:44:35.725 [NioProcessor-11] INFO - SessionId:1 TEST_1 
> 1681904875701
> 2023-04-19_11:44:37.754 [NioProcessor-15] INFO - SessionId:2 TEST_2 
> 1681904875701
> Is there anything I did not mention in the context of UDP/DatagramAcceptor? 
> Or is there any setting, such that DatagramAcceptors can create/handle their 
> own session objects?



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

-
To unsubscribe, e-mail: dev-unsubscr...@mina.apache.org
For additional commands, e-mail: dev-h...@mina.apache.org



[jira] [Commented] (DIRMINA-1172) Multiple DatagramAcceptors and the creation of a session object

2023-08-22 Thread Alexander B (Jira)


[ 
https://issues.apache.org/jira/browse/DIRMINA-1172?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17757437#comment-17757437
 ] 

Alexander B commented on DIRMINA-1172:
--

Sorry, I was not able to take a closer look or to prepare something, but as I 
can see, you are using 1 object and bind two ports at the same object.

Compared to our code, I am pretty sure, that we use two different instances, 
therefore two different NioDatagramAcceptors and two different Handlers. 

> Multiple DatagramAcceptors and the creation of a session object
> ---
>
> Key: DIRMINA-1172
> URL: https://issues.apache.org/jira/browse/DIRMINA-1172
> Project: MINA
>  Issue Type: Bug
>  Components: Core
>Affects Versions: 2.1.5
>Reporter: Alexander B
>Priority: Major
> Attachments: DIRMINA1172.java, UDPTest4.java
>
>
> Hello,
> I am using two independently created NioDatagramAcceptors, which are created 
> by the following code :
> {code:java}
> AbstractIoService inputSource = new NioDatagramAcceptor();
> ((NioDatagramAcceptor) inputSource).getSessionConfig().setReuseAddress(true);
> DefaultIoFilterChainBuilder filterChainBuilderUDP = 
> ((NioDatagramAcceptor)inputSource).getFilterChain();
> filterChainBuilderUDP.addLast("logger", new LoggingFilter());
> ((NioDatagramAcceptor) 
> inputSource).getSessionConfig().setIdleTime(IdleStatus.READER_IDLE, 
> getIdleTimeout());
> ((NioDatagramAcceptor) inputSource).setHandler(this);
> try {
>   ((NioDatagramAcceptor)inputSource).bind(new InetSocketAddress(port));
> } catch (IOException e) {
>   log.error("Failed to connect {}", e);
> }
> {code}
> One Acceptor is listening on port 9800, the other one on 9801. If I now send 
> UDP packages (from a external application) to both ports (independently). It 
> seems, that both UDP port are "connected" to the same session.
> Information: The external app is sending:
> Message "TEST_1 " just to port 9800
> Message "TEST_2 " just to port 9801
> The overwritten method messageReceived will give the following output:
> {code:java}
> public void messageReceived(IoSession session, Object message) throws 
> Exception {
>   String msgStr = message.toString();
>   log.info("SessionId:" + session.getId() + " " + msgStr);
> }
> {code}
> 2023-04-19_11:47:35.035 [NioDatagramAcceptor-2] INFO - SessionId:1 TEST_1 
> 1681904855701
> 2023-04-19_11:47:35.035 [NioDatagramAcceptor-3] INFO - SessionId:1 TEST_2 
> 1681904855701
> So, both messages (for port 9800 and port 9801) are received by SessionId1. 
> If I do exactly the same with `NioSocketConnector`, I can see two different 
> sessions, such that both messages are handled independently:
> 2023-04-19_11:44:35.725 [NioProcessor-11] INFO - SessionId:1 TEST_1 
> 1681904875701
> 2023-04-19_11:44:37.754 [NioProcessor-15] INFO - SessionId:2 TEST_2 
> 1681904875701
> Is there anything I did not mention in the context of UDP/DatagramAcceptor? 
> Or is there any setting, such that DatagramAcceptors can create/handle their 
> own session objects?



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

-
To unsubscribe, e-mail: dev-unsubscr...@mina.apache.org
For additional commands, e-mail: dev-h...@mina.apache.org



[jira] [Commented] (DIRMINA-1172) Multiple DatagramAcceptors and the creation of a session object

2023-08-22 Thread Jira


[ 
https://issues.apache.org/jira/browse/DIRMINA-1172?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17757411#comment-17757411
 ] 

Emmanuel Lécharny commented on DIRMINA-1172:


Hi Alexander,

I think I have a working test (see attachement). It's a bit brutal.

What I see is that for both port, the session is the same. Investigating.

> Multiple DatagramAcceptors and the creation of a session object
> ---
>
> Key: DIRMINA-1172
> URL: https://issues.apache.org/jira/browse/DIRMINA-1172
> Project: MINA
>  Issue Type: Bug
>  Components: Core
>Affects Versions: 2.1.5
>Reporter: Alexander B
>Priority: Major
> Attachments: UDPTest4.java
>
>
> Hello,
> I am using two independently created NioDatagramAcceptors, which are created 
> by the following code :
> {code:java}
> AbstractIoService inputSource = new NioDatagramAcceptor();
> ((NioDatagramAcceptor) inputSource).getSessionConfig().setReuseAddress(true);
> DefaultIoFilterChainBuilder filterChainBuilderUDP = 
> ((NioDatagramAcceptor)inputSource).getFilterChain();
> filterChainBuilderUDP.addLast("logger", new LoggingFilter());
> ((NioDatagramAcceptor) 
> inputSource).getSessionConfig().setIdleTime(IdleStatus.READER_IDLE, 
> getIdleTimeout());
> ((NioDatagramAcceptor) inputSource).setHandler(this);
> try {
>   ((NioDatagramAcceptor)inputSource).bind(new InetSocketAddress(port));
> } catch (IOException e) {
>   log.error("Failed to connect {}", e);
> }
> {code}
> One Acceptor is listening on port 9800, the other one on 9801. If I now send 
> UDP packages (from a external application) to both ports (independently). It 
> seems, that both UDP port are "connected" to the same session.
> Information: The external app is sending:
> Message "TEST_1 " just to port 9800
> Message "TEST_2 " just to port 9801
> The overwritten method messageReceived will give the following output:
> {code:java}
> public void messageReceived(IoSession session, Object message) throws 
> Exception {
>   String msgStr = message.toString();
>   log.info("SessionId:" + session.getId() + " " + msgStr);
> }
> {code}
> 2023-04-19_11:47:35.035 [NioDatagramAcceptor-2] INFO - SessionId:1 TEST_1 
> 1681904855701
> 2023-04-19_11:47:35.035 [NioDatagramAcceptor-3] INFO - SessionId:1 TEST_2 
> 1681904855701
> So, both messages (for port 9800 and port 9801) are received by SessionId1. 
> If I do exactly the same with `NioSocketConnector`, I can see two different 
> sessions, such that both messages are handled independently:
> 2023-04-19_11:44:35.725 [NioProcessor-11] INFO - SessionId:1 TEST_1 
> 1681904875701
> 2023-04-19_11:44:37.754 [NioProcessor-15] INFO - SessionId:2 TEST_2 
> 1681904875701
> Is there anything I did not mention in the context of UDP/DatagramAcceptor? 
> Or is there any setting, such that DatagramAcceptors can create/handle their 
> own session objects?



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

-
To unsubscribe, e-mail: dev-unsubscr...@mina.apache.org
For additional commands, e-mail: dev-h...@mina.apache.org



[jira] [Commented] (DIRMINA-1172) Multiple DatagramAcceptors and the creation of a session object

2023-08-22 Thread Jira


[ 
https://issues.apache.org/jira/browse/DIRMINA-1172?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17757242#comment-17757242
 ] 

Emmanuel Lécharny commented on DIRMINA-1172:


Hi Alexander,

 

may I ask you to provide a fully functionnal test? It will spare me the time to 
recreate something I can test. Thanks!

> Multiple DatagramAcceptors and the creation of a session object
> ---
>
> Key: DIRMINA-1172
> URL: https://issues.apache.org/jira/browse/DIRMINA-1172
> Project: MINA
>  Issue Type: Bug
>  Components: Core
>Affects Versions: 2.1.5
>Reporter: Alexander B
>Priority: Major
> Attachments: UDPTest4.java
>
>
> Hello,
> I am using two independently created NioDatagramAcceptors, which are created 
> by the following code :
> {code:java}
> AbstractIoService inputSource = new NioDatagramAcceptor();
> ((NioDatagramAcceptor) inputSource).getSessionConfig().setReuseAddress(true);
> DefaultIoFilterChainBuilder filterChainBuilderUDP = 
> ((NioDatagramAcceptor)inputSource).getFilterChain();
> filterChainBuilderUDP.addLast("logger", new LoggingFilter());
> ((NioDatagramAcceptor) 
> inputSource).getSessionConfig().setIdleTime(IdleStatus.READER_IDLE, 
> getIdleTimeout());
> ((NioDatagramAcceptor) inputSource).setHandler(this);
> try {
>   ((NioDatagramAcceptor)inputSource).bind(new InetSocketAddress(port));
> } catch (IOException e) {
>   log.error("Failed to connect {}", e);
> }
> {code}
> One Acceptor is listening on port 9800, the other one on 9801. If I now send 
> UDP packages (from a external application) to both ports (independently). It 
> seems, that both UDP port are "connected" to the same session.
> Information: The external app is sending:
> Message "TEST_1 " just to port 9800
> Message "TEST_2 " just to port 9801
> The overwritten method messageReceived will give the following output:
> {code:java}
> public void messageReceived(IoSession session, Object message) throws 
> Exception {
>   String msgStr = message.toString();
>   log.info("SessionId:" + session.getId() + " " + msgStr);
> }
> {code}
> 2023-04-19_11:47:35.035 [NioDatagramAcceptor-2] INFO - SessionId:1 TEST_1 
> 1681904855701
> 2023-04-19_11:47:35.035 [NioDatagramAcceptor-3] INFO - SessionId:1 TEST_2 
> 1681904855701
> So, both messages (for port 9800 and port 9801) are received by SessionId1. 
> If I do exactly the same with `NioSocketConnector`, I can see two different 
> sessions, such that both messages are handled independently:
> 2023-04-19_11:44:35.725 [NioProcessor-11] INFO - SessionId:1 TEST_1 
> 1681904875701
> 2023-04-19_11:44:37.754 [NioProcessor-15] INFO - SessionId:2 TEST_2 
> 1681904875701
> Is there anything I did not mention in the context of UDP/DatagramAcceptor? 
> Or is there any setting, such that DatagramAcceptors can create/handle their 
> own session objects?



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

-
To unsubscribe, e-mail: dev-unsubscr...@mina.apache.org
For additional commands, e-mail: dev-h...@mina.apache.org



[jira] [Commented] (DIRMINA-1172) Multiple DatagramAcceptors and the creation of a session object

2023-08-19 Thread Alexander B (Jira)


[ 
https://issues.apache.org/jira/browse/DIRMINA-1172?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17756334#comment-17756334
 ] 

Alexander B commented on DIRMINA-1172:
--

Hi [~elecharny] , 

i know i am nerving a little bit. But I would like to ask again, if you already 
find something about the behaviour above?

Thank a lot
Alex

> Multiple DatagramAcceptors and the creation of a session object
> ---
>
> Key: DIRMINA-1172
> URL: https://issues.apache.org/jira/browse/DIRMINA-1172
> Project: MINA
>  Issue Type: Bug
>  Components: Core
>Affects Versions: 2.1.5
>Reporter: Alexander B
>Priority: Major
> Attachments: UDPTest4.java
>
>
> Hello,
> I am using two independently created NioDatagramAcceptors, which are created 
> by the following code :
> {code:java}
> AbstractIoService inputSource = new NioDatagramAcceptor();
> ((NioDatagramAcceptor) inputSource).getSessionConfig().setReuseAddress(true);
> DefaultIoFilterChainBuilder filterChainBuilderUDP = 
> ((NioDatagramAcceptor)inputSource).getFilterChain();
> filterChainBuilderUDP.addLast("logger", new LoggingFilter());
> ((NioDatagramAcceptor) 
> inputSource).getSessionConfig().setIdleTime(IdleStatus.READER_IDLE, 
> getIdleTimeout());
> ((NioDatagramAcceptor) inputSource).setHandler(this);
> try {
>   ((NioDatagramAcceptor)inputSource).bind(new InetSocketAddress(port));
> } catch (IOException e) {
>   log.error("Failed to connect {}", e);
> }
> {code}
> One Acceptor is listening on port 9800, the other one on 9801. If I now send 
> UDP packages (from a external application) to both ports (independently). It 
> seems, that both UDP port are "connected" to the same session.
> Information: The external app is sending:
> Message "TEST_1 " just to port 9800
> Message "TEST_2 " just to port 9801
> The overwritten method messageReceived will give the following output:
> {code:java}
> public void messageReceived(IoSession session, Object message) throws 
> Exception {
>   String msgStr = message.toString();
>   log.info("SessionId:" + session.getId() + " " + msgStr);
> }
> {code}
> 2023-04-19_11:47:35.035 [NioDatagramAcceptor-2] INFO - SessionId:1 TEST_1 
> 1681904855701
> 2023-04-19_11:47:35.035 [NioDatagramAcceptor-3] INFO - SessionId:1 TEST_2 
> 1681904855701
> So, both messages (for port 9800 and port 9801) are received by SessionId1. 
> If I do exactly the same with `NioSocketConnector`, I can see two different 
> sessions, such that both messages are handled independently:
> 2023-04-19_11:44:35.725 [NioProcessor-11] INFO - SessionId:1 TEST_1 
> 1681904875701
> 2023-04-19_11:44:37.754 [NioProcessor-15] INFO - SessionId:2 TEST_2 
> 1681904875701
> Is there anything I did not mention in the context of UDP/DatagramAcceptor? 
> Or is there any setting, such that DatagramAcceptors can create/handle their 
> own session objects?



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

-
To unsubscribe, e-mail: dev-unsubscr...@mina.apache.org
For additional commands, e-mail: dev-h...@mina.apache.org



[jira] [Commented] (DIRMINA-1172) Multiple DatagramAcceptors and the creation of a session object

2023-06-21 Thread Jira


[ 
https://issues.apache.org/jira/browse/DIRMINA-1172?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17735575#comment-17735575
 ] 

Emmanuel Lécharny commented on DIRMINA-1172:


Hi [~abuechel], sorry, no, I was taken into a maelstroem of other tasks, 
including a triple release of MINA.

 

So thank for the reminder, I'll do my best to check what's going on in the 
coming days.

> Multiple DatagramAcceptors and the creation of a session object
> ---
>
> Key: DIRMINA-1172
> URL: https://issues.apache.org/jira/browse/DIRMINA-1172
> Project: MINA
>  Issue Type: Bug
>  Components: Core
>Affects Versions: 2.1.5
>Reporter: Alexander B
>Priority: Major
> Attachments: UDPTest4.java
>
>
> Hello,
> I am using two independently created NioDatagramAcceptors, which are created 
> by the following code :
> {code:java}
> AbstractIoService inputSource = new NioDatagramAcceptor();
> ((NioDatagramAcceptor) inputSource).getSessionConfig().setReuseAddress(true);
> DefaultIoFilterChainBuilder filterChainBuilderUDP = 
> ((NioDatagramAcceptor)inputSource).getFilterChain();
> filterChainBuilderUDP.addLast("logger", new LoggingFilter());
> ((NioDatagramAcceptor) 
> inputSource).getSessionConfig().setIdleTime(IdleStatus.READER_IDLE, 
> getIdleTimeout());
> ((NioDatagramAcceptor) inputSource).setHandler(this);
> try {
>   ((NioDatagramAcceptor)inputSource).bind(new InetSocketAddress(port));
> } catch (IOException e) {
>   log.error("Failed to connect {}", e);
> }
> {code}
> One Acceptor is listening on port 9800, the other one on 9801. If I now send 
> UDP packages (from a external application) to both ports (independently). It 
> seems, that both UDP port are "connected" to the same session.
> Information: The external app is sending:
> Message "TEST_1 " just to port 9800
> Message "TEST_2 " just to port 9801
> The overwritten method messageReceived will give the following output:
> {code:java}
> public void messageReceived(IoSession session, Object message) throws 
> Exception {
>   String msgStr = message.toString();
>   log.info("SessionId:" + session.getId() + " " + msgStr);
> }
> {code}
> 2023-04-19_11:47:35.035 [NioDatagramAcceptor-2] INFO - SessionId:1 TEST_1 
> 1681904855701
> 2023-04-19_11:47:35.035 [NioDatagramAcceptor-3] INFO - SessionId:1 TEST_2 
> 1681904855701
> So, both messages (for port 9800 and port 9801) are received by SessionId1. 
> If I do exactly the same with `NioSocketConnector`, I can see two different 
> sessions, such that both messages are handled independently:
> 2023-04-19_11:44:35.725 [NioProcessor-11] INFO - SessionId:1 TEST_1 
> 1681904875701
> 2023-04-19_11:44:37.754 [NioProcessor-15] INFO - SessionId:2 TEST_2 
> 1681904875701
> Is there anything I did not mention in the context of UDP/DatagramAcceptor? 
> Or is there any setting, such that DatagramAcceptors can create/handle their 
> own session objects?



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

-
To unsubscribe, e-mail: dev-unsubscr...@mina.apache.org
For additional commands, e-mail: dev-h...@mina.apache.org



[jira] [Commented] (DIRMINA-1172) Multiple DatagramAcceptors and the creation of a session object

2023-05-16 Thread Alexander B (Jira)


[ 
https://issues.apache.org/jira/browse/DIRMINA-1172?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17723102#comment-17723102
 ] 

Alexander B commented on DIRMINA-1172:
--

Hi, did you already had the time to take a look deeper to the problem?

> Multiple DatagramAcceptors and the creation of a session object
> ---
>
> Key: DIRMINA-1172
> URL: https://issues.apache.org/jira/browse/DIRMINA-1172
> Project: MINA
>  Issue Type: Bug
>  Components: Core
>Affects Versions: 2.1.5
>Reporter: Alexander B
>Priority: Major
> Attachments: UDPTest4.java
>
>
> Hello,
> I am using two independently created NioDatagramAcceptors, which are created 
> by the following code :
> {code:java}
> AbstractIoService inputSource = new NioDatagramAcceptor();
> ((NioDatagramAcceptor) inputSource).getSessionConfig().setReuseAddress(true);
> DefaultIoFilterChainBuilder filterChainBuilderUDP = 
> ((NioDatagramAcceptor)inputSource).getFilterChain();
> filterChainBuilderUDP.addLast("logger", new LoggingFilter());
> ((NioDatagramAcceptor) 
> inputSource).getSessionConfig().setIdleTime(IdleStatus.READER_IDLE, 
> getIdleTimeout());
> ((NioDatagramAcceptor) inputSource).setHandler(this);
> try {
>   ((NioDatagramAcceptor)inputSource).bind(new InetSocketAddress(port));
> } catch (IOException e) {
>   log.error("Failed to connect {}", e);
> }
> {code}
> One Acceptor is listening on port 9800, the other one on 9801. If I now send 
> UDP packages (from a external application) to both ports (independently). It 
> seems, that both UDP port are "connected" to the same session.
> Information: The external app is sending:
> Message "TEST_1 " just to port 9800
> Message "TEST_2 " just to port 9801
> The overwritten method messageReceived will give the following output:
> {code:java}
> public void messageReceived(IoSession session, Object message) throws 
> Exception {
>   String msgStr = message.toString();
>   log.info("SessionId:" + session.getId() + " " + msgStr);
> }
> {code}
> 2023-04-19_11:47:35.035 [NioDatagramAcceptor-2] INFO - SessionId:1 TEST_1 
> 1681904855701
> 2023-04-19_11:47:35.035 [NioDatagramAcceptor-3] INFO - SessionId:1 TEST_2 
> 1681904855701
> So, both messages (for port 9800 and port 9801) are received by SessionId1. 
> If I do exactly the same with `NioSocketConnector`, I can see two different 
> sessions, such that both messages are handled independently:
> 2023-04-19_11:44:35.725 [NioProcessor-11] INFO - SessionId:1 TEST_1 
> 1681904875701
> 2023-04-19_11:44:37.754 [NioProcessor-15] INFO - SessionId:2 TEST_2 
> 1681904875701
> Is there anything I did not mention in the context of UDP/DatagramAcceptor? 
> Or is there any setting, such that DatagramAcceptors can create/handle their 
> own session objects?



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

-
To unsubscribe, e-mail: dev-unsubscr...@mina.apache.org
For additional commands, e-mail: dev-h...@mina.apache.org



[jira] [Commented] (DIRMINA-1172) Multiple DatagramAcceptors and the creation of a session object

2023-04-27 Thread Jira


[ 
https://issues.apache.org/jira/browse/DIRMINA-1172?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17717373#comment-17717373
 ] 

Emmanuel Lécharny commented on DIRMINA-1172:


Ok, it can't be a problem with the session recycler. We store the SocketAddress 
in the cache, and it contains the port.

 

I'll check with the code you pushed to reproduce it, and see what's the root 
cause.

> Multiple DatagramAcceptors and the creation of a session object
> ---
>
> Key: DIRMINA-1172
> URL: https://issues.apache.org/jira/browse/DIRMINA-1172
> Project: MINA
>  Issue Type: Bug
>  Components: Core
>Affects Versions: 2.1.5
>Reporter: Alexander B
>Priority: Major
> Attachments: UDPTest4.java
>
>
> Hello,
> I am using two independently created NioDatagramAcceptors, which are created 
> by the following code :
> {code:java}
> AbstractIoService inputSource = new NioDatagramAcceptor();
> ((NioDatagramAcceptor) inputSource).getSessionConfig().setReuseAddress(true);
> DefaultIoFilterChainBuilder filterChainBuilderUDP = 
> ((NioDatagramAcceptor)inputSource).getFilterChain();
> filterChainBuilderUDP.addLast("logger", new LoggingFilter());
> ((NioDatagramAcceptor) 
> inputSource).getSessionConfig().setIdleTime(IdleStatus.READER_IDLE, 
> getIdleTimeout());
> ((NioDatagramAcceptor) inputSource).setHandler(this);
> try {
>   ((NioDatagramAcceptor)inputSource).bind(new InetSocketAddress(port));
> } catch (IOException e) {
>   log.error("Failed to connect {}", e);
> }
> {code}
> One Acceptor is listening on port 9800, the other one on 9801. If I now send 
> UDP packages (from a external application) to both ports (independently). It 
> seems, that both UDP port are "connected" to the same session.
> Information: The external app is sending:
> Message "TEST_1 " just to port 9800
> Message "TEST_2 " just to port 9801
> The overwritten method messageReceived will give the following output:
> {code:java}
> public void messageReceived(IoSession session, Object message) throws 
> Exception {
>   String msgStr = message.toString();
>   log.info("SessionId:" + session.getId() + " " + msgStr);
> }
> {code}
> 2023-04-19_11:47:35.035 [NioDatagramAcceptor-2] INFO - SessionId:1 TEST_1 
> 1681904855701
> 2023-04-19_11:47:35.035 [NioDatagramAcceptor-3] INFO - SessionId:1 TEST_2 
> 1681904855701
> So, both messages (for port 9800 and port 9801) are received by SessionId1. 
> If I do exactly the same with `NioSocketConnector`, I can see two different 
> sessions, such that both messages are handled independently:
> 2023-04-19_11:44:35.725 [NioProcessor-11] INFO - SessionId:1 TEST_1 
> 1681904875701
> 2023-04-19_11:44:37.754 [NioProcessor-15] INFO - SessionId:2 TEST_2 
> 1681904875701
> Is there anything I did not mention in the context of UDP/DatagramAcceptor? 
> Or is there any setting, such that DatagramAcceptors can create/handle their 
> own session objects?



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

-
To unsubscribe, e-mail: dev-unsubscr...@mina.apache.org
For additional commands, e-mail: dev-h...@mina.apache.org



[jira] [Commented] (DIRMINA-1172) Multiple DatagramAcceptors and the creation of a session object

2023-04-27 Thread Alexander B (Jira)


[ 
https://issues.apache.org/jira/browse/DIRMINA-1172?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17717045#comment-17717045
 ] 

Alexander B commented on DIRMINA-1172:
--

Hi, 

I can add some more information: I did several scenarios, some work, some not:
Lets say we have 3 machines: A and B are senders and C is the receiver, where 
an app incl. Mina is running:

Scenario 1:
Machine A is sending to Machine C via Port 9800.
Machine B is sending to Machine C via Port 9801.
This works fine.

Scenario 2:
Machine A is sending to Machine C via Port 9800 in a first cmd.
Machine A is sending to Machine C via Port 9801 in a second cmd (independently 
from the first one).
This works fine.

Scenario 3:
Machine A is sending to Machine C via Port 9800 and 9801 separately in one cmd 
(or to be more specific in one external application)
This scenario runs into the effect of having just one session object and every 
message is going throw.

I have added this external application as a minimum udpTest.

For scenario 1 you can run this tester from Machine A: "java UDPTest 
hostnameOfMachineC 9800" and from Machine B: "java UDPTest hostnameOfMachineC 
9801".
For scenario 2 you can run this tester from Machine A "java UDPTest 
hostnameOfMachineC 9800" and in a second cmd "java UDPTest hostnameOfMachineC 
9801".
For scenario 3 you can run this tester from Machine A "java UDPTest 
hostnameOfMachineC 9800 9081". So here it is one application sending to two 
ports

Maybe it has something to do with the same "socket"-object, which is sending or 
the same "remoteport", which is used from this socketobject?

 [^UDPTest4.java] 

> Multiple DatagramAcceptors and the creation of a session object
> ---
>
> Key: DIRMINA-1172
> URL: https://issues.apache.org/jira/browse/DIRMINA-1172
> Project: MINA
>  Issue Type: Bug
>  Components: Core
>Affects Versions: 2.1.5
>Reporter: Alexander B
>Priority: Major
> Attachments: UDPTest4.java
>
>
> Hello,
> I am using two independently created NioDatagramAcceptors, which are created 
> by the following code :
> {code:java}
> AbstractIoService inputSource = new NioDatagramAcceptor();
> ((NioDatagramAcceptor) inputSource).getSessionConfig().setReuseAddress(true);
> DefaultIoFilterChainBuilder filterChainBuilderUDP = 
> ((NioDatagramAcceptor)inputSource).getFilterChain();
> filterChainBuilderUDP.addLast("logger", new LoggingFilter());
> ((NioDatagramAcceptor) 
> inputSource).getSessionConfig().setIdleTime(IdleStatus.READER_IDLE, 
> getIdleTimeout());
> ((NioDatagramAcceptor) inputSource).setHandler(this);
> try {
>   ((NioDatagramAcceptor)inputSource).bind(new InetSocketAddress(port));
> } catch (IOException e) {
>   log.error("Failed to connect {}", e);
> }
> {code}
> One Acceptor is listening on port 9800, the other one on 9801. If I now send 
> UDP packages (from a external application) to both ports (independently). It 
> seems, that both UDP port are "connected" to the same session.
> Information: The external app is sending:
> Message "TEST_1 " just to port 9800
> Message "TEST_2 " just to port 9801
> The overwritten method messageReceived will give the following output:
> {code:java}
> public void messageReceived(IoSession session, Object message) throws 
> Exception {
>   String msgStr = message.toString();
>   log.info("SessionId:" + session.getId() + " " + msgStr);
> }
> {code}
> 2023-04-19_11:47:35.035 [NioDatagramAcceptor-2] INFO - SessionId:1 TEST_1 
> 1681904855701
> 2023-04-19_11:47:35.035 [NioDatagramAcceptor-3] INFO - SessionId:1 TEST_2 
> 1681904855701
> So, both messages (for port 9800 and port 9801) are received by SessionId1. 
> If I do exactly the same with `NioSocketConnector`, I can see two different 
> sessions, such that both messages are handled independently:
> 2023-04-19_11:44:35.725 [NioProcessor-11] INFO - SessionId:1 TEST_1 
> 1681904875701
> 2023-04-19_11:44:37.754 [NioProcessor-15] INFO - SessionId:2 TEST_2 
> 1681904875701
> Is there anything I did not mention in the context of UDP/DatagramAcceptor? 
> Or is there any setting, such that DatagramAcceptors can create/handle their 
> own session objects?



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

-
To unsubscribe, e-mail: dev-unsubscr...@mina.apache.org
For additional commands, e-mail: dev-h...@mina.apache.org



[jira] [Commented] (DIRMINA-1172) Multiple DatagramAcceptors and the creation of a session object

2023-04-27 Thread Alexander B (Jira)


[ 
https://issues.apache.org/jira/browse/DIRMINA-1172?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17717002#comment-17717002
 ] 

Alexander B commented on DIRMINA-1172:
--

If you have an approach to avoid this behaviour, I would like to test your 
modification (for test purposes).

> Multiple DatagramAcceptors and the creation of a session object
> ---
>
> Key: DIRMINA-1172
> URL: https://issues.apache.org/jira/browse/DIRMINA-1172
> Project: MINA
>  Issue Type: Bug
>  Components: Core
>Affects Versions: 2.1.5
>Reporter: Alexander B
>Priority: Major
>
> Hello,
> I am using two independently created NioDatagramAcceptors, which are created 
> by the following code :
> {code:java}
> AbstractIoService inputSource = new NioDatagramAcceptor();
> ((NioDatagramAcceptor) inputSource).getSessionConfig().setReuseAddress(true);
> DefaultIoFilterChainBuilder filterChainBuilderUDP = 
> ((NioDatagramAcceptor)inputSource).getFilterChain();
> filterChainBuilderUDP.addLast("logger", new LoggingFilter());
> ((NioDatagramAcceptor) 
> inputSource).getSessionConfig().setIdleTime(IdleStatus.READER_IDLE, 
> getIdleTimeout());
> ((NioDatagramAcceptor) inputSource).setHandler(this);
> try {
>   ((NioDatagramAcceptor)inputSource).bind(new InetSocketAddress(port));
> } catch (IOException e) {
>   log.error("Failed to connect {}", e);
> }
> {code}
> One Acceptor is listening on port 9800, the other one on 9801. If I now send 
> UDP packages (from a external application) to both ports (independently). It 
> seems, that both UDP port are "connected" to the same session.
> Information: The external app is sending:
> Message "TEST_1 " just to port 9800
> Message "TEST_2 " just to port 9801
> The overwritten method messageReceived will give the following output:
> {code:java}
> public void messageReceived(IoSession session, Object message) throws 
> Exception {
>   String msgStr = message.toString();
>   log.info("SessionId:" + session.getId() + " " + msgStr);
> }
> {code}
> 2023-04-19_11:47:35.035 [NioDatagramAcceptor-2] INFO - SessionId:1 TEST_1 
> 1681904855701
> 2023-04-19_11:47:35.035 [NioDatagramAcceptor-3] INFO - SessionId:1 TEST_2 
> 1681904855701
> So, both messages (for port 9800 and port 9801) are received by SessionId1. 
> If I do exactly the same with `NioSocketConnector`, I can see two different 
> sessions, such that both messages are handled independently:
> 2023-04-19_11:44:35.725 [NioProcessor-11] INFO - SessionId:1 TEST_1 
> 1681904875701
> 2023-04-19_11:44:37.754 [NioProcessor-15] INFO - SessionId:2 TEST_2 
> 1681904875701
> Is there anything I did not mention in the context of UDP/DatagramAcceptor? 
> Or is there any setting, such that DatagramAcceptors can create/handle their 
> own session objects?



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

-
To unsubscribe, e-mail: dev-unsubscr...@mina.apache.org
For additional commands, e-mail: dev-h...@mina.apache.org



[jira] [Commented] (DIRMINA-1172) Multiple DatagramAcceptors and the creation of a session object

2023-04-26 Thread Jira


[ 
https://issues.apache.org/jira/browse/DIRMINA-1172?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17716912#comment-17716912
 ] 

Emmanuel Lécharny commented on DIRMINA-1172:


Quick comment: I wonder if it's not the 'normal' behaviour. We use a Session 
recycler to avoid creating sessions again and again. We have a default recycler 
instance which fetch session based on their remote address, not considering the 
port. Here is the cocde:

 
{code:java}
private IoSession newSessionWithoutLock(SocketAddress remoteAddress, 
SocketAddress localAddress) throws Exception {
DatagramChannel handle = boundHandles.get(localAddress);

if (handle == null) {
throw new IllegalArgumentException("Unknown local address: " + 
localAddress);
}

IoSession session;
synchronized (sessionRecycler) {
session = sessionRecycler.recycle(remoteAddress);
if (session != null) {
return session;
}
    ... {code}
 

and:

 
{code:java}
public final class NioDatagramAcceptor extends AbstractIoAcceptor implements 
DatagramAcceptor, IoProcessor {
/**
 * A session recycler that is used to retrieve an existing session, unless 
it's too old.
 **/
private static final IoSessionRecycler DEFAULT_RECYCLER = new 
ExpiringSessionRecycler();
 {code}
 

with:

 
{code:java}
/**
 * {@inheritDoc}
 */
@Overridepublic IoSession recycle(SocketAddress remoteAddress) {
return sessionMap.get(remoteAddress);
}{code}
 

So I wonder if we are not in this exact use case, where the events are 
propagated to all the sessions, because we 'recycle' sessions that are already 
used.

That means we should use the remote address plus the port to identify sessions.

Note that the reason we recycle sessions is that with UDP the session is pretty 
much a temporary construction: it last for a given period of time then is 
deleted (we can't know when the 'session' is closed by the client, because of 
the connectionless nature of UDP).

I can modify the code for testing purpose, if you don't mind playing with it.

 

> Multiple DatagramAcceptors and the creation of a session object
> ---
>
> Key: DIRMINA-1172
> URL: https://issues.apache.org/jira/browse/DIRMINA-1172
> Project: MINA
>  Issue Type: Bug
>  Components: Core
>Affects Versions: 2.1.5
>Reporter: Alexander B
>Priority: Major
>
> Hello,
> I am using two independently created NioDatagramAcceptors, which are created 
> by the following code :
> {code:java}
> AbstractIoService inputSource = new NioDatagramAcceptor();
> ((NioDatagramAcceptor) inputSource).getSessionConfig().setReuseAddress(true);
> DefaultIoFilterChainBuilder filterChainBuilderUDP = 
> ((NioDatagramAcceptor)inputSource).getFilterChain();
> filterChainBuilderUDP.addLast("logger", new LoggingFilter());
> ((NioDatagramAcceptor) 
> inputSource).getSessionConfig().setIdleTime(IdleStatus.READER_IDLE, 
> getIdleTimeout());
> ((NioDatagramAcceptor) inputSource).setHandler(this);
> try {
>   ((NioDatagramAcceptor)inputSource).bind(new InetSocketAddress(port));
> } catch (IOException e) {
>   log.error("Failed to connect {}", e);
> }
> {code}
> One Acceptor is listening on port 9800, the other one on 9801. If I now send 
> UDP packages (from a external application) to both ports (independently). It 
> seems, that both UDP port are "connected" to the same session.
> Information: The external app is sending:
> Message "TEST_1 " just to port 9800
> Message "TEST_2 " just to port 9801
> The overwritten method messageReceived will give the following output:
> {code:java}
> public void messageReceived(IoSession session, Object message) throws 
> Exception {
>   String msgStr = message.toString();
>   log.info("SessionId:" + session.getId() + " " + msgStr);
> }
> {code}
> 2023-04-19_11:47:35.035 [NioDatagramAcceptor-2] INFO - SessionId:1 TEST_1 
> 1681904855701
> 2023-04-19_11:47:35.035 [NioDatagramAcceptor-3] INFO - SessionId:1 TEST_2 
> 1681904855701
> So, both messages (for port 9800 and port 9801) are received by SessionId1. 
> If I do exactly the same with `NioSocketConnector`, I can see two different 
> sessions, such that both messages are handled independently:
> 2023-04-19_11:44:35.725 [NioProcessor-11] INFO - SessionId:1 TEST_1 
> 1681904875701
> 2023-04-19_11:44:37.754 [NioProcessor-15] INFO - SessionId:2 TEST_2 
> 1681904875701
> Is there anything I did not mention in the context of UDP/DatagramAcceptor? 
> Or is there any setting, such that DatagramAcceptors can create/handle their 
> own session objects?



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

-
To unsubscribe, 

[jira] [Commented] (DIRMINA-1172) Multiple DatagramAcceptors and the creation of a session object

2023-04-26 Thread Alexander B (Jira)


[ 
https://issues.apache.org/jira/browse/DIRMINA-1172?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17716621#comment-17716621
 ] 

Alexander B commented on DIRMINA-1172:
--

I can confirm, that the app is sending to both port from the same ip.

I will check in the next days, what happens, if I send to both port from 
different ips.

> Multiple DatagramAcceptors and the creation of a session object
> ---
>
> Key: DIRMINA-1172
> URL: https://issues.apache.org/jira/browse/DIRMINA-1172
> Project: MINA
>  Issue Type: Bug
>  Components: Core
>Affects Versions: 2.1.5
>Reporter: Alexander B
>Priority: Major
>
> Hello,
> I am using two independently created NioDatagramAcceptors, which are created 
> by the following code :
> {code:java}
> AbstractIoService inputSource = new NioDatagramAcceptor();
> ((NioDatagramAcceptor) inputSource).getSessionConfig().setReuseAddress(true);
> DefaultIoFilterChainBuilder filterChainBuilderUDP = 
> ((NioDatagramAcceptor)inputSource).getFilterChain();
> filterChainBuilderUDP.addLast("logger", new LoggingFilter());
> ((NioDatagramAcceptor) 
> inputSource).getSessionConfig().setIdleTime(IdleStatus.READER_IDLE, 
> getIdleTimeout());
> ((NioDatagramAcceptor) inputSource).setHandler(this);
> try {
>   ((NioDatagramAcceptor)inputSource).bind(new InetSocketAddress(port));
> } catch (IOException e) {
>   log.error("Failed to connect {}", e);
> }
> {code}
> One Acceptor is listening on port 9800, the other one on 9801. If I now send 
> UDP packages (from a external application) to both ports (independently). It 
> seems, that both UDP port are "connected" to the same session.
> Information: The external app is sending:
> Message "TEST_1 " just to port 9800
> Message "TEST_2 " just to port 9801
> The overwritten method messageReceived will give the following output:
> {code:java}
> public void messageReceived(IoSession session, Object message) throws 
> Exception {
>   String msgStr = message.toString();
>   log.info("SessionId:" + session.getId() + " " + msgStr);
> }
> {code}
> 2023-04-19_11:47:35.035 [NioDatagramAcceptor-2] INFO - SessionId:1 TEST_1 
> 1681904855701
> 2023-04-19_11:47:35.035 [NioDatagramAcceptor-3] INFO - SessionId:1 TEST_2 
> 1681904855701
> So, both messages (for port 9800 and port 9801) are received by SessionId1. 
> If I do exactly the same with `NioSocketConnector`, I can see two different 
> sessions, such that both messages are handled independently:
> 2023-04-19_11:44:35.725 [NioProcessor-11] INFO - SessionId:1 TEST_1 
> 1681904875701
> 2023-04-19_11:44:37.754 [NioProcessor-15] INFO - SessionId:2 TEST_2 
> 1681904875701
> Is there anything I did not mention in the context of UDP/DatagramAcceptor? 
> Or is there any setting, such that DatagramAcceptors can create/handle their 
> own session objects?



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

-
To unsubscribe, e-mail: dev-unsubscr...@mina.apache.org
For additional commands, e-mail: dev-h...@mina.apache.org



[jira] [Commented] (DIRMINA-1172) Multiple DatagramAcceptors and the creation of a session object

2023-04-26 Thread Jira


[ 
https://issues.apache.org/jira/browse/DIRMINA-1172?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17716609#comment-17716609
 ] 

Emmanuel Lécharny commented on DIRMINA-1172:


Interesting...

I have to check if the session ID is associated with the IP address, regardless 
of the port being used. Sounds like a bug to me...

> Multiple DatagramAcceptors and the creation of a session object
> ---
>
> Key: DIRMINA-1172
> URL: https://issues.apache.org/jira/browse/DIRMINA-1172
> Project: MINA
>  Issue Type: Bug
>  Components: Core
>Affects Versions: 2.1.5
>Reporter: Alexander B
>Priority: Major
>
> Hello,
> I am using two independently created NioDatagramAcceptors, which are created 
> by the following code :
> {code:java}
> AbstractIoService inputSource = new NioDatagramAcceptor();
> ((NioDatagramAcceptor) inputSource).getSessionConfig().setReuseAddress(true);
> DefaultIoFilterChainBuilder filterChainBuilderUDP = 
> ((NioDatagramAcceptor)inputSource).getFilterChain();
> filterChainBuilderUDP.addLast("logger", new LoggingFilter());
> ((NioDatagramAcceptor) 
> inputSource).getSessionConfig().setIdleTime(IdleStatus.READER_IDLE, 
> getIdleTimeout());
> ((NioDatagramAcceptor) inputSource).setHandler(this);
> try {
>   ((NioDatagramAcceptor)inputSource).bind(new InetSocketAddress(port));
> } catch (IOException e) {
>   log.error("Failed to connect {}", e);
> }
> {code}
> One Acceptor is listening on port 9800, the other one on 9801. If I now send 
> UDP packages (from a external application) to both ports (independently). It 
> seems, that both UDP port are "connected" to the same session.
> Information: The external app is sending:
> Message "TEST_1 " just to port 9800
> Message "TEST_2 " just to port 9801
> The overwritten method messageReceived will give the following output:
> {code:java}
> public void messageReceived(IoSession session, Object message) throws 
> Exception {
>   String msgStr = message.toString();
>   log.info("SessionId:" + session.getId() + " " + msgStr);
> }
> {code}
> 2023-04-19_11:47:35.035 [NioDatagramAcceptor-2] INFO - SessionId:1 TEST_1 
> 1681904855701
> 2023-04-19_11:47:35.035 [NioDatagramAcceptor-3] INFO - SessionId:1 TEST_2 
> 1681904855701
> So, both messages (for port 9800 and port 9801) are received by SessionId1. 
> If I do exactly the same with `NioSocketConnector`, I can see two different 
> sessions, such that both messages are handled independently:
> 2023-04-19_11:44:35.725 [NioProcessor-11] INFO - SessionId:1 TEST_1 
> 1681904875701
> 2023-04-19_11:44:37.754 [NioProcessor-15] INFO - SessionId:2 TEST_2 
> 1681904875701
> Is there anything I did not mention in the context of UDP/DatagramAcceptor? 
> Or is there any setting, such that DatagramAcceptors can create/handle their 
> own session objects?



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

-
To unsubscribe, e-mail: dev-unsubscr...@mina.apache.org
For additional commands, e-mail: dev-h...@mina.apache.org