[ 
https://issues.apache.org/jira/browse/DIRMINA-1173?focusedWorklogId=918949&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-918949
 ]

ASF GitHub Bot logged work on DIRMINA-1173:
-------------------------------------------

                Author: ASF GitHub Bot
            Created on: 11/May/24 23:53
            Start Date: 11/May/24 23:53
    Worklog Time Spent: 10m 
      Work Description: elecharny commented on code in PR #44:
URL: https://github.com/apache/mina/pull/44#discussion_r1597523524


##########
mina-core/src/main/java/org/apache/mina/transport/socket/DefaultSocketSessionConfig.java:
##########
@@ -37,7 +37,7 @@ public class DefaultSocketSessionConfig extends 
AbstractSocketSessionConfig {
 
     private static final int DEFAULT_SO_LINGER = -1;
 
-    private static final boolean DEFAULT_TCP_NO_DELAY = false;
+    private static final boolean DEFAULT_TCP_NO_DELAY = true; // Disable Nagle 
algorithm by default

Review Comment:
   I missed the MSS part. Ok, so makes sense to keep the parameter as is, but I 
do agree that *not* setting a default at all would be a better option. At 
least, you let the developer makes a choice depending on what they actually 
measure. 
   
   Thanks Jon!





Issue Time Tracking
-------------------

    Worklog Id:     (was: 918949)
    Time Spent: 1.5h  (was: 1h 20m)

> Apache mina 2.2.1 threads blocking on ConnectFuture.awaitUninterruptibly() 
> for ever
> -----------------------------------------------------------------------------------
>
>                 Key: DIRMINA-1173
>                 URL: https://issues.apache.org/jira/browse/DIRMINA-1173
>             Project: MINA
>          Issue Type: Bug
>          Components: Core
>    Affects Versions: 2.2.1
>            Reporter: KMVS
>            Priority: Critical
>         Attachments: dumpLatest-1.log
>
>          Time Spent: 1.5h
>  Remaining Estimate: 0h
>
> Hi All,
> I have attached thread dump too for analysis.
> I have migrated from 2.0.21 to 2.023 for solving CVE, i have seen thread 
> blocking issue, So used latest mina verstion 2.2.1 but still threads were 
> blocked here is the sample code.Thread hungs at {*}awaitUninterruptibly{*}.  
> Once this issue comes  in sub sequest launches nothing will work all threads 
> will be blocked forever,i have to restart the process to make it work. For 
> single thread working fine,if i start 50-100 threads this thread blocking 
> issue will surface.I am using the same NioSocketConnector across the threads.
> Here is an scenario, I have one gate way IP which i connect initially ,this 
> gate way will return list of ips.
> now i will close the previous IOsession and will create a nio connection with 
> the first ip in the list.if it did n't work then again i will try to 
> connect to next ip etc..
> All these are in the critical section. i.e i will acquire a lock and then 
> after successful connection i will release the lock.
> But problem i have noticed is with the awaitUninterruptibly().
> I have a state machine too. So connection set up is in one thread and 
> response processing is in another thread.
>  
> *Thread 1:*
>  Public class g10CaptureService
>  {
>  
> private static final ProtocolCodecFilter probeCodecFilter = new 
> ProtocolCodecFilter(new ProbeCodecFactory(G10Message.class));
>     *private static final ExecutorFilter executorFilter = new 
> ExecutorFilter(16,32);*
>     private static final G10GPBMessageIoFilter gpbMessageFilter = new 
> G10GPBMessageIoFilter(G10ParserContextFactory.getG10ParsingAndEncodingInstance());
>  static
> {
> initConnectors()
> }
> protected static void initConnectors()
> {
> StateMachine stateMachine = 
> StateMachineFactory.getInstance(IoHandlerTransition.class).create(
>                 G10MinaClient.CONNECTED, new G10MinaClient(processor));
>         IoHandler ioHandler = new 
> StateMachineProxyBuilder().setStateContextLookup(
>                 new IoSessionStateContextLookup(new StateContextFactory() {
>                     @Override
>                     public StateContext create() {
>                         final G10StateContext stateContext = new 
> G10StateContext();
>                         stateContext.setStartedTime(new Date());
>                         return stateContext;
>                     }
>                 })).create(IoHandler.class, stateMachine);
>                 
>                 
> //Global connector across the system, i.e multiple threads uses the same 
> connector.            
> NioSocketConnector connector = new NioSocketConnector();
>         connector.getFilterChain().addLast("LoggingFilter", 
> G10CaptureService.loggingFilter);
>         connector.getFilterChain().addLast("codecFilter", 
> G10CaptureService.probeCodecFilter);
>         connector.getFilterChain().addLast("executorFilter", 
> G10CaptureService.executorFilter);
>         connector.getFilterChain().addLast("gpbMessageFilter", 
> G10CaptureService.gpbMessageFilter);
>         connector.getFilterChain().addLast("keepAliveFilter", 
> G10CaptureService.keepAliveFilter);
>         connector.setHandler(ioHandler);
> }
>         
> public void StartRecordCapture()
> {
> connectionLock.lock();
> try
> {
> ConnectFuture primaryConnectFuture = connector.connect(primaryAddress, 
> initializer);
> //hungs forever if the no. of threads are more than 30
> primaryConnectFuture.awaitUninterruptibly();//no time out specified
> if (!primaryConnectFuture.isConnected()) 
> {
>                
>                     if (handleIOException(searchExpression, captureHandler)) {
>                         return;
>                     }
>                     LOG.info("{} Apache mina connection setup time out 
> happend.",
>                     handleConnectionFailed(primaryAddress, captureHandler, 
> "Primary IP connection timeout");
>                     return;
> }
> }catch(Exception e)
> {
> }finally
> {
> connectionLock.unLock();
> }
> }        
> *Thread 2:*
> public void processGatewaySrQueryResponseSuccess(G10StateContext context, 
> IoSession session, GatewaySrQueryResponse response) {
> //get the g10CaptureService  from the Thread1 IOsession 
> if(response.getIpPortCount() > 0) {
>         try {
>         List<IpAddrPort> msgIpPorts = response.getIpPortList();
>         List<InetSocketAddress> probeIpPorts = new 
> ArrayList<InetSocketAddress>();
>         for (IpAddrPort ipp : msgIpPorts) {
>            InetSocketAddress inetSockAddr = new 
> InetSocketAddress(InetAddress.getByAddress(ipp.getIp().toByteArray()), 
> ipp.getPort());
>         probeIpPorts.add(inetSockAddr);
>         }
>         g10CaptureService.setProbeIps(probeIpPorts);
>         } catch (Exception ex) {
>         LOG.error("{} Exception occured while creating probe 
> IP/Port.Exception:{}", getLogStr(session), ex);
>         }
>       context.addGeoBladeGwSession(session);        
>  
>         g10CaptureService.closeConnectionForSession(session); //cose thread1 
> io session
>         g10CaptureService.setIsGeoBladeIdlSession(true);
>         g10CaptureService.startRecordCapture(searchExpression, 
> captureHandler, captureId); //connect to the probe again using 
>         same thread 1 instance with different ip
> }



--
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

Reply via email to