[jira] [Work logged] (SSHD-902) Local port forwarding: EOF is not handled properly

2019-05-30 Thread ASF GitHub Bot (JIRA)


 [ 
https://issues.apache.org/jira/browse/SSHD-902?focusedWorklogId=251438=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-251438
 ]

ASF GitHub Bot logged work on SSHD-902:
---

Author: ASF GitHub Bot
Created on: 31/May/19 01:19
Start Date: 31/May/19 01:19
Worklog Time Spent: 10m 
  Work Description: yuminsang commented on issue #100: SSHD-902 Shutdown 
output when receiving SSH_MSG_CHANNEL_EOF
URL: https://github.com/apache/mina-sshd/pull/100#issuecomment-497540683
 
 
   Cloned https://github.com/lgoldstein/mina-sshd/tree/SSHD-902 and tested it 
locally, and it works for my case. Thanks.
 

This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Issue Time Tracking
---

Worklog Id: (was: 251438)
Time Spent: 40m  (was: 0.5h)

> Local port forwarding: EOF is not handled properly
> --
>
> Key: SSHD-902
> URL: https://issues.apache.org/jira/browse/SSHD-902
> Project: MINA SSHD
>  Issue Type: Bug
>Affects Versions: 2.1.0
> Environment: OS: both Windows 10 and Red Hat Enterprise Linux Server 
> release 7.4 (Maipo) Linux 4.1.12-124.19.2.el7uek.x86_64 x86_64
> JDK: 1.8.0_201
> SSHD: 2.1.0
>Reporter: Yumin Sang
>Priority: Critical
> Attachments: AbstractServerCloseTestSupport.java, 
> ApacheServerApacheClientTest.java, fixBasedOn2.1.0.zip, packets.PNG
>
>  Time Spent: 40m
>  Remaining Estimate: 0h
>
> Set remote port to a real listening port but is not for DB connection. Start 
> a local port forwarding. Try getting a connection through the established SSH 
> tunnel. This operation is expected to be finished with some error, but it 
> hangs.
> Reproduce steps:
>  # prepare a Linux server and find a listening port, such as 2049, which is 
> not of DB listener.
>  # get attached demo code: ApacheServerApacheClientTest.java and 
> AbstractServerCloseTestSupport.java. They are modified from the ones in 
> mina-sshd-2.1.0\sshd-core\src\test\java\org\apache\sshd\common\forward. 
> Please replace the corresponding ones.
>  # download ojdbc8.jar from 
> [https://www.oracle.com/technetwork/database/features/jdbc/jdbc-ucp-122-3110062.html?|https://www.oracle.com/technetwork/database/features/jdbc/jdbc-ucp-122-3110062.html]
>  and add it to classpath.
>  # set up a local port forwarding tunnel by Putty or other tools. Set the 
> forwarded local port to 3, remote server/port to the server/port in step 
> 1.
>  # run  ApacheServerApacheClientTest.java. It finishes with error like 
> java.io.IOException: Got minus one from a read call. This is expected 
> behavior.
>  # change 
> org.apache.sshd.common.forward.AbstractServerCloseTestSupport#testLocalPortForwardOneBuffer:
>  uncomment line "int serverPort = startLocalPF();" and comment line "int 
> serverPort = 3;"
>  # change 
> org.apache.sshd.common.forward.ApacheServerApacheClientTest#createClient, set 
> username, host and password to the ones in step 1.
>  # run  ApacheServerApacheClientTest.java again and it hangs.
> By capturing loopback packets, it can be found the interactions are same, but 
> SSHD make different process from what Putty does. In attached snapshot, the 
> "nfs" is of port 2049.
> Did a bit digging up, and it seems that EOF is not handled properly. Here is 
> a call stack:
> handleEof:873, AbstractChannel (org.apache.sshd.common.channel)
> channelEof:498, AbstractConnectionService 
> (org.apache.sshd.common.session.helpers)
> process:357, AbstractConnectionService 
> (org.apache.sshd.common.session.helpers)
> doHandleMessage:626, AbstractSession (org.apache.sshd.common.session.helpers)
> handleMessage:559, AbstractSession (org.apache.sshd.common.session.helpers)
> decode:1542, AbstractSession (org.apache.sshd.common.session.helpers)
> messageReceived:520, AbstractSession (org.apache.sshd.common.session.helpers)
> messageReceived:63, AbstractSessionIoHandler 
> (org.apache.sshd.common.session.helpers)
> handleReadCycleCompletion:339, Nio2Session (org.apache.sshd.common.io.nio2)
> onCompleted:318, Nio2Session$1 (org.apache.sshd.common.io.nio2)
> onCompleted:315, Nio2Session$1 (org.apache.sshd.common.io.nio2)
> lambda$completed$0:38, Nio2CompletionHandler (org.apache.sshd.common.io.nio2)
> run:-1, 391147216 
> (org.apache.sshd.common.io.nio2.Nio2CompletionHandler$$Lambda$73)
> doPrivileged:-1, AccessController (java.security)
> completed:37, Nio2CompletionHandler (org.apache.sshd.common.io.nio2)
> invokeUnchecked:126, Invoker (sun.nio.ch)
> run:218, Invoker$2 (sun.nio.ch)
> run:112, 

[jira] [Commented] (SSHD-902) Local port forwarding: EOF is not handled properly

2019-05-30 Thread Yumin Sang (JIRA)


[ 
https://issues.apache.org/jira/browse/SSHD-902?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16852537#comment-16852537
 ] 

Yumin Sang commented on SSHD-902:
-

Test with https://github.com/lgoldstein/mina-sshd/tree/SSHD-902 and it works.

> Local port forwarding: EOF is not handled properly
> --
>
> Key: SSHD-902
> URL: https://issues.apache.org/jira/browse/SSHD-902
> Project: MINA SSHD
>  Issue Type: Bug
>Affects Versions: 2.1.0
> Environment: OS: both Windows 10 and Red Hat Enterprise Linux Server 
> release 7.4 (Maipo) Linux 4.1.12-124.19.2.el7uek.x86_64 x86_64
> JDK: 1.8.0_201
> SSHD: 2.1.0
>Reporter: Yumin Sang
>Priority: Critical
> Attachments: AbstractServerCloseTestSupport.java, 
> ApacheServerApacheClientTest.java, fixBasedOn2.1.0.zip, packets.PNG
>
>  Time Spent: 0.5h
>  Remaining Estimate: 0h
>
> Set remote port to a real listening port but is not for DB connection. Start 
> a local port forwarding. Try getting a connection through the established SSH 
> tunnel. This operation is expected to be finished with some error, but it 
> hangs.
> Reproduce steps:
>  # prepare a Linux server and find a listening port, such as 2049, which is 
> not of DB listener.
>  # get attached demo code: ApacheServerApacheClientTest.java and 
> AbstractServerCloseTestSupport.java. They are modified from the ones in 
> mina-sshd-2.1.0\sshd-core\src\test\java\org\apache\sshd\common\forward. 
> Please replace the corresponding ones.
>  # download ojdbc8.jar from 
> [https://www.oracle.com/technetwork/database/features/jdbc/jdbc-ucp-122-3110062.html?|https://www.oracle.com/technetwork/database/features/jdbc/jdbc-ucp-122-3110062.html]
>  and add it to classpath.
>  # set up a local port forwarding tunnel by Putty or other tools. Set the 
> forwarded local port to 3, remote server/port to the server/port in step 
> 1.
>  # run  ApacheServerApacheClientTest.java. It finishes with error like 
> java.io.IOException: Got minus one from a read call. This is expected 
> behavior.
>  # change 
> org.apache.sshd.common.forward.AbstractServerCloseTestSupport#testLocalPortForwardOneBuffer:
>  uncomment line "int serverPort = startLocalPF();" and comment line "int 
> serverPort = 3;"
>  # change 
> org.apache.sshd.common.forward.ApacheServerApacheClientTest#createClient, set 
> username, host and password to the ones in step 1.
>  # run  ApacheServerApacheClientTest.java again and it hangs.
> By capturing loopback packets, it can be found the interactions are same, but 
> SSHD make different process from what Putty does. In attached snapshot, the 
> "nfs" is of port 2049.
> Did a bit digging up, and it seems that EOF is not handled properly. Here is 
> a call stack:
> handleEof:873, AbstractChannel (org.apache.sshd.common.channel)
> channelEof:498, AbstractConnectionService 
> (org.apache.sshd.common.session.helpers)
> process:357, AbstractConnectionService 
> (org.apache.sshd.common.session.helpers)
> doHandleMessage:626, AbstractSession (org.apache.sshd.common.session.helpers)
> handleMessage:559, AbstractSession (org.apache.sshd.common.session.helpers)
> decode:1542, AbstractSession (org.apache.sshd.common.session.helpers)
> messageReceived:520, AbstractSession (org.apache.sshd.common.session.helpers)
> messageReceived:63, AbstractSessionIoHandler 
> (org.apache.sshd.common.session.helpers)
> handleReadCycleCompletion:339, Nio2Session (org.apache.sshd.common.io.nio2)
> onCompleted:318, Nio2Session$1 (org.apache.sshd.common.io.nio2)
> onCompleted:315, Nio2Session$1 (org.apache.sshd.common.io.nio2)
> lambda$completed$0:38, Nio2CompletionHandler (org.apache.sshd.common.io.nio2)
> run:-1, 391147216 
> (org.apache.sshd.common.io.nio2.Nio2CompletionHandler$$Lambda$73)
> doPrivileged:-1, AccessController (java.security)
> completed:37, Nio2CompletionHandler (org.apache.sshd.common.io.nio2)
> invokeUnchecked:126, Invoker (sun.nio.ch)
> run:218, Invoker$2 (sun.nio.ch)
> run:112, AsynchronousChannelGroupImpl$1 (sun.nio.ch)
> runWorker:1149, ThreadPoolExecutor (java.util.concurrent)
> run:624, ThreadPoolExecutor$Worker (java.util.concurrent)
> run:748, Thread (java.lang)



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[GitHub] [mina-sshd] yuminsang commented on issue #100: SSHD-902 Shutdown output when receiving SSH_MSG_CHANNEL_EOF

2019-05-30 Thread GitBox
yuminsang commented on issue #100: SSHD-902 Shutdown output when receiving 
SSH_MSG_CHANNEL_EOF
URL: https://github.com/apache/mina-sshd/pull/100#issuecomment-497540683
 
 
   Cloned https://github.com/lgoldstein/mina-sshd/tree/SSHD-902 and tested it 
locally, and it works for my case. Thanks.


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[jira] [Commented] (SSHD-916) Followup of SSHD-912 Review usages of AbstractCloseable#lock and constrain them only to actually needed ones

2019-05-30 Thread Goldstein Lyor (JIRA)


[ 
https://issues.apache.org/jira/browse/SSHD-916?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16852031#comment-16852031
 ] 

Goldstein Lyor commented on SSHD-916:
-

Great - will do so in the next few days - thanks for validating the code

> Followup of SSHD-912 Review usages of AbstractCloseable#lock and constrain 
> them only to actually needed ones
> 
>
> Key: SSHD-916
> URL: https://issues.apache.org/jira/browse/SSHD-916
> Project: MINA SSHD
>  Issue Type: Bug
>Affects Versions: 2.2.0
>Reporter: Roberto Deandrea
>Assignee: Goldstein Lyor
>Priority: Major
> Attachments: spxp.usrdump.9503...@aix72.dmz.20190510114505768.log
>
>
> Hi Lyor,
> Yesterday I said you that no deadlock occurred with the new code changes, but 
> I spoke too early :(
> I found a third thread deadlock on SSH client running our long run test 
> always during client/server disconnection.
>  
> The deadlock is as follows :
> Thread #22175 name: sshd-SshClient[ad946082]-nio2-thread-2
> — 
> org.apache.sshd.common.session.helpers.AbstractSession.doWritePacket(AbstractSession.java:873)
>  WAITFOR(encodedLock)
> 
> — 
> org.apache.sshd.common.session.helpers.AbstractSession.handleMessage(AbstractSession.java:362)
>  LOCKED(sessionLock)
>  
> Thread #22180 name: sshd-SshClient[ad946082]-nio2-thread-7
> — 
> org.apache.sshd.client.session.ClientSessionImpl.signalAuthFailure(ClientSessionImpl.java:151)
>   WAITFOR(sessionLock)
> .
> — 
> org.apache.sshd.common.session.helpers.AbstractSession.doWritePacket(AbstractSession.java:876)
>  LOCKED(encodedLock)
>  
> Attached you can find a full thread dump regarding the new deadlock. (see 
> file spxp.usrdump.9503...@aix72.dmz.20190510114505768.log)
> Let me know if you prefer open a new ticket and troubleshoot this issue.
>  
> Kind Regards
> Roberto Deandrea



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[GitHub] [mina] elecharny closed pull request #21: Filter ProfilerTimerFilter ArithmeticException

2019-05-30 Thread GitBox
elecharny closed pull request #21: Filter ProfilerTimerFilter 
ArithmeticException
URL: https://github.com/apache/mina/pull/21
 
 
   


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [mina] elecharny closed pull request #4: Fix transmission id in coap retry filter

2019-05-30 Thread GitBox
elecharny closed pull request #4: Fix transmission id in coap retry filter
URL: https://github.com/apache/mina/pull/4
 
 
   


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[jira] [Comment Edited] (DIRMINA-1115) Filter ProfilerTimerFilter ArithmeticException

2019-05-30 Thread Jonathan Valliere (JIRA)


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

Jonathan Valliere edited comment on DIRMINA-1115 at 5/30/19 11:51 AM:
--

2.0.X 
[https://gitbox.apache.org/repos/asf?p=mina.git;a=commit;h=faf9e5cdaf40da3a816f789bd27c95e2f3b4d354]

2.1.X 
[https://gitbox.apache.org/repos/asf?p=mina.git;a=commit;h=a6aa78483aa91282376dfab959d9e4dad3ea30d2]


was (Author: johnnyv):
2.1.X 
[https://gitbox.apache.org/repos/asf?p=mina.git;a=commit;h=faf9e5cdaf40da3a816f789bd27c95e2f3b4d354]

2.0.X 
[https://gitbox.apache.org/repos/asf?p=mina.git;a=commit;h=a6aa78483aa91282376dfab959d9e4dad3ea30d2]

> Filter ProfilerTimerFilter ArithmeticException
> --
>
> Key: DIRMINA-1115
> URL: https://issues.apache.org/jira/browse/DIRMINA-1115
> Project: MINA
>  Issue Type: Bug
>  Components: Filter
>Affects Versions: 2.1.2
>Reporter: Jonas Alessi
>Assignee: Jonathan Valliere
>Priority: Minor
> Fix For: 2.0.23, 2.1.4
>
> Attachments: arithmeticException.png
>
>
> In my work we are using the filter ProfilerTimerFilter and when we call the 
> method org.apache.mina.filter.statistic.ProfilerTimerFilter.getAverageTime 
> before receiving the first message, it throws the ArithmeticException.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Resolved] (DIRMINA-1115) Filter ProfilerTimerFilter ArithmeticException

2019-05-30 Thread Jonathan Valliere (JIRA)


 [ 
https://issues.apache.org/jira/browse/DIRMINA-1115?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Jonathan Valliere resolved DIRMINA-1115.

Resolution: Fixed
  Assignee: Jonathan Valliere

2.1.X 
[https://gitbox.apache.org/repos/asf?p=mina.git;a=commit;h=faf9e5cdaf40da3a816f789bd27c95e2f3b4d354]

2.0.X 
[https://gitbox.apache.org/repos/asf?p=mina.git;a=commit;h=a6aa78483aa91282376dfab959d9e4dad3ea30d2]

> Filter ProfilerTimerFilter ArithmeticException
> --
>
> Key: DIRMINA-1115
> URL: https://issues.apache.org/jira/browse/DIRMINA-1115
> Project: MINA
>  Issue Type: Bug
>  Components: Filter
>Affects Versions: 2.1.2
>Reporter: Jonas Alessi
>Assignee: Jonathan Valliere
>Priority: Minor
> Fix For: 2.0.23, 2.1.4
>
> Attachments: arithmeticException.png
>
>
> In my work we are using the filter ProfilerTimerFilter and when we call the 
> method org.apache.mina.filter.statistic.ProfilerTimerFilter.getAverageTime 
> before receiving the first message, it throws the ArithmeticException.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Updated] (DIRMINA-1115) Filter ProfilerTimerFilter ArithmeticException

2019-05-30 Thread Jonathan Valliere (JIRA)


 [ 
https://issues.apache.org/jira/browse/DIRMINA-1115?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Jonathan Valliere updated DIRMINA-1115:
---
Fix Version/s: 2.1.4
   2.0.23

> Filter ProfilerTimerFilter ArithmeticException
> --
>
> Key: DIRMINA-1115
> URL: https://issues.apache.org/jira/browse/DIRMINA-1115
> Project: MINA
>  Issue Type: Bug
>  Components: Filter
>Affects Versions: 2.1.2
>Reporter: Jonas Alessi
>Priority: Minor
> Fix For: 2.0.23, 2.1.4
>
> Attachments: arithmeticException.png
>
>
> In my work we are using the filter ProfilerTimerFilter and when we call the 
> method org.apache.mina.filter.statistic.ProfilerTimerFilter.getAverageTime 
> before receiving the first message, it throws the ArithmeticException.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Comment Edited] (DIRMINA-1114) High CPU utilization because of Mina-core jar

2019-05-30 Thread Jonathan Valliere (JIRA)


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

Jonathan Valliere edited comment on DIRMINA-1114 at 5/30/19 11:29 AM:
--

Here are the instructions that works for me.
{noformat}
Instructions for Ubuntu Linux

$ sudo apt install linux-tools-common
$ sudo apt install build-essential
$ sudo apt install cmake
$ sudo apt install openjdk-8-jdk-headless

$ sudo apt install linux-tools-{your linux version}  e.g. 4.15.0-50-generic

Locate the installation path of the VM you wish to profile; in Ubuntu this is 
usually /usr/lib/jvm/*

Create a working directory "perf-flamegraph" somewhere on your system.

$ mkdir perf-flamegraph
$ cd perf-flamegraph

$ apt-get install cmake
$ export JAVA_HOME=/path-to-your-jdk
$ git clone --depth=1 https://github.com/jrudolph/perf-map-agent
$ cd perf-map-agent
$ cmake .
$ make

$ git clone --depth=1 https://github.com/brendangregg/FlameGraph

You should have two folders "perf-map-agent" and "FlameGraph"

Edit ./FlameGraph/jmaps and override JAVA_HOME and AGENT_HOME

 ./FlameGraph/jmaps 
JAVA_HOME=/path-to-your-jdk
AGENT_HOME=/path-to-perf-agent


Execute your Java Application with -XX:+PreserveFramePointer using the same JVM 
that was identified earlier. (it has to be the same JVM)

Create a new script "build-flamegraph"

$ touch build-flamegraph
$ chmod a+x build-flamegraph

Paste the following into file build-flamegraph

 ./build-flamegraph 
#!/bin/bash
sudo perf record -F 1000 -a -g -- sleep 30; sudo ./FlameGraph/jmaps
sudo perf script | ./FlameGraph/stackcollapse-perf.pl | 
./FlameGraph/flamegraph.pl --color=java --hash > flamegraph.svg
sudo rm perf.data


Your working directory should look like

FlameGraph
perf-map-agent
build-flamegraph

$ sudo ./build-flamegraph

{noformat}


was (Author: johnnyv):
Here are the instructions that works for me.

{noformat}
Instructions for Ubuntu Linux

$ sudo apt install linux-tools-common
$ sudo apt install build-essential
$ sudo apt install cmake
$ sudo apt install openjdk-8-jdk-headless

$ sudo apt install linux-tools-{your linux version}  e.g. 4.15.0-50-generic

Locate the installation path of the VM you wish to profile; in Ubuntu this is 
usually /usr/lib/jvm/*

Create a working directory "perf-flamegraph" somewhere on your system.

$ mkdir perf-flamegraph
$ cd perf-flamegraph

$ apt-get install cmake
$ export JAVA_HOME=/path-to-your-jdk
$ git clone --depth=1 https://github.com/jrudolph/perf-map-agent
$ cd perf-map-agent
$ cmake .
$ make

$ git clone --depth=1 https://github.com/brendangregg/FlameGraph

You should have two folders "perf-map-agent" and "FlameGraph"

Edit ./FlameGraph/jmaps and override JAVA_HOME and AGENT_HOME

 ./FlameGraph/jmaps 
JAVA_HOME=/path-to-your-jdk
AGENT_HOME=/path-to-perf-agent


Execute your Java Application with -XX:+PreserveFramePointer using the same JVM 
that was identified earlier. (it has to be the same JVM)

Create a new script "build-flamegraph"

$ touch build-flamegraph
$ chmod a+x build-flamegraph

Paste the following into file build-flamegraph

 ./build-flamegraph 
sudo perf record -F 1000 -a -g -- sleep 30; sudo ./FlameGraph/jmaps
sudo perf script | ./FlameGraph/stackcollapse-perf.pl | 
./FlameGraph/flamegraph.pl --color=java --hash > flamegraph.svg
sudo rm perf.data


Your working directory should look like

FlameGraph
perf-map-agent
build-flamegraph

$ sudo ./build-flamegraph

{noformat}


> High CPU utilization because of Mina-core jar
> -
>
> Key: DIRMINA-1114
> URL: https://issues.apache.org/jira/browse/DIRMINA-1114
> Project: MINA
>  Issue Type: Bug
>  Components: Core
>Affects Versions: 2.1.2
>Reporter: Hrushikesh Agrawal
>Assignee: Jonathan Valliere
>Priority: Major
> Attachments: 29thMay.zip, CPUAnalysys.zip, flamerelated.zip, 
> graph1_color.svg, htop.png, htop.png, nio-metal-example.svg, 
> step1_flamegraph.txt, threaddump_06_05_20191557137156089.log, 
> threaddump_06_05_20191557137173951.log
>
>
> Hi,
> We are have our own product  through which we are trying to communicate with 
> LDAP server by using the mina-core-2.1.2.jar and api-all-1.0.3.jar jars. When 
> we have invalid connection parameter, and tried to get the connection, CPU 
> core utilization is 100%.
> Then we have seen in JVisualVM and in Jprofiler that 
> "org.apache.mina.transport.socket.nio.NioSocketConnector" is in CPU more time.
> We can see below in thread dump-
> "NioSocketConnector-3" #152 prio=5 os_prio=0 tid=0x7f95940d4000 
> nid=0x77fb runnable 

[jira] [Commented] (DIRMINA-1114) High CPU utilization because of Mina-core jar

2019-05-30 Thread Jonathan Valliere (JIRA)


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

Jonathan Valliere commented on DIRMINA-1114:


Here are the instructions that works for me.

{noformat}
Instructions for Ubuntu Linux

$ sudo apt install linux-tools-common
$ sudo apt install build-essential
$ sudo apt install cmake
$ sudo apt install openjdk-8-jdk-headless

$ sudo apt install linux-tools-{your linux version}  e.g. 4.15.0-50-generic

Locate the installation path of the VM you wish to profile; in Ubuntu this is 
usually /usr/lib/jvm/*

Create a working directory "perf-flamegraph" somewhere on your system.

$ mkdir perf-flamegraph
$ cd perf-flamegraph

$ apt-get install cmake
$ export JAVA_HOME=/path-to-your-jdk
$ git clone --depth=1 https://github.com/jrudolph/perf-map-agent
$ cd perf-map-agent
$ cmake .
$ make

$ git clone --depth=1 https://github.com/brendangregg/FlameGraph

You should have two folders "perf-map-agent" and "FlameGraph"

Edit ./FlameGraph/jmaps and override JAVA_HOME and AGENT_HOME

 ./FlameGraph/jmaps 
JAVA_HOME=/path-to-your-jdk
AGENT_HOME=/path-to-perf-agent


Execute your Java Application with -XX:+PreserveFramePointer using the same JVM 
that was identified earlier. (it has to be the same JVM)

Create a new script "build-flamegraph"

$ touch build-flamegraph
$ chmod a+x build-flamegraph

Paste the following into file build-flamegraph

 ./build-flamegraph 
sudo perf record -F 1000 -a -g -- sleep 30; sudo ./FlameGraph/jmaps
sudo perf script | ./FlameGraph/stackcollapse-perf.pl | 
./FlameGraph/flamegraph.pl --color=java --hash > flamegraph.svg
sudo rm perf.data


Your working directory should look like

FlameGraph
perf-map-agent
build-flamegraph

$ sudo ./build-flamegraph

{noformat}


> High CPU utilization because of Mina-core jar
> -
>
> Key: DIRMINA-1114
> URL: https://issues.apache.org/jira/browse/DIRMINA-1114
> Project: MINA
>  Issue Type: Bug
>  Components: Core
>Affects Versions: 2.1.2
>Reporter: Hrushikesh Agrawal
>Assignee: Jonathan Valliere
>Priority: Major
> Attachments: 29thMay.zip, CPUAnalysys.zip, flamerelated.zip, 
> graph1_color.svg, htop.png, htop.png, nio-metal-example.svg, 
> step1_flamegraph.txt, threaddump_06_05_20191557137156089.log, 
> threaddump_06_05_20191557137173951.log
>
>
> Hi,
> We are have our own product  through which we are trying to communicate with 
> LDAP server by using the mina-core-2.1.2.jar and api-all-1.0.3.jar jars. When 
> we have invalid connection parameter, and tried to get the connection, CPU 
> core utilization is 100%.
> Then we have seen in JVisualVM and in Jprofiler that 
> "org.apache.mina.transport.socket.nio.NioSocketConnector" is in CPU more time.
> We can see below in thread dump-
> "NioSocketConnector-3" #152 prio=5 os_prio=0 tid=0x7f95940d4000 
> nid=0x77fb runnable [0x7f956f1fe000]
>    java.lang.Thread.State: RUNNABLE
> at sun.nio.ch.EPollArrayWrapper.epollWait(Native Method)
> at sun.nio.ch.EPollArrayWrapper.poll(EPollArrayWrapper.java:269)
> at sun.nio.ch.EPollSelectorImpl.doSelect(EPollSelectorImpl.java:93)
> at sun.nio.ch.SelectorImpl.lockAndDoSelect(SelectorImpl.java:86)
> - locked <0xebdf89e8> (a sun.nio.ch.Util$3)
> - locked <0xebdf89d8> (a java.util.Collections$UnmodifiableSet)
> - locked <0xebdf88c0> (a sun.nio.ch.EPollSelectorImpl)
> at sun.nio.ch.SelectorImpl.select(SelectorImpl.java:97)
> at 
> org.apache.mina.transport.socket.nio.NioSocketConnector.select(NioSocketConnector.java:292)
> at 
> org.apache.mina.core.polling.AbstractPollingIoConnector$Connector.run(AbstractPollingIoConnector.java:433)
> at 
> org.apache.mina.util.NamePreservingRunnable.run(NamePreservingRunnable.java:64)
> at 
> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
> at 
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
> at java.lang.Thread.run(Thread.java:748)
> We can see same issue with standalone java class and try to get the ldap 
> connection. Attaching couple of snapshot to understand the issue. 
> Please note this happens in Ubuntu and Centos. Also found same issue with 
> 2.0.21, 2.0.18 mina core jar.
> Can someone please help me on this.
>  
> Thanks,
> Hrushi
>  
>  
>  



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (DIRMINA-1114) High CPU utilization because of Mina-core jar

2019-05-30 Thread Jonathan Valliere (JIRA)


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

Jonathan Valliere commented on DIRMINA-1114:


 [^nio-metal-example.svg] I asked if it was a virtual machine because the 
flamegraphs generate incorrectly when tracing syscalls when running on VMs.  
Attached is an example of what syscalls should look like appearing above the 
java commands.

> High CPU utilization because of Mina-core jar
> -
>
> Key: DIRMINA-1114
> URL: https://issues.apache.org/jira/browse/DIRMINA-1114
> Project: MINA
>  Issue Type: Bug
>  Components: Core
>Affects Versions: 2.1.2
>Reporter: Hrushikesh Agrawal
>Assignee: Jonathan Valliere
>Priority: Major
> Attachments: 29thMay.zip, CPUAnalysys.zip, flamerelated.zip, 
> graph1_color.svg, htop.png, htop.png, nio-metal-example.svg, 
> step1_flamegraph.txt, threaddump_06_05_20191557137156089.log, 
> threaddump_06_05_20191557137173951.log
>
>
> Hi,
> We are have our own product  through which we are trying to communicate with 
> LDAP server by using the mina-core-2.1.2.jar and api-all-1.0.3.jar jars. When 
> we have invalid connection parameter, and tried to get the connection, CPU 
> core utilization is 100%.
> Then we have seen in JVisualVM and in Jprofiler that 
> "org.apache.mina.transport.socket.nio.NioSocketConnector" is in CPU more time.
> We can see below in thread dump-
> "NioSocketConnector-3" #152 prio=5 os_prio=0 tid=0x7f95940d4000 
> nid=0x77fb runnable [0x7f956f1fe000]
>    java.lang.Thread.State: RUNNABLE
> at sun.nio.ch.EPollArrayWrapper.epollWait(Native Method)
> at sun.nio.ch.EPollArrayWrapper.poll(EPollArrayWrapper.java:269)
> at sun.nio.ch.EPollSelectorImpl.doSelect(EPollSelectorImpl.java:93)
> at sun.nio.ch.SelectorImpl.lockAndDoSelect(SelectorImpl.java:86)
> - locked <0xebdf89e8> (a sun.nio.ch.Util$3)
> - locked <0xebdf89d8> (a java.util.Collections$UnmodifiableSet)
> - locked <0xebdf88c0> (a sun.nio.ch.EPollSelectorImpl)
> at sun.nio.ch.SelectorImpl.select(SelectorImpl.java:97)
> at 
> org.apache.mina.transport.socket.nio.NioSocketConnector.select(NioSocketConnector.java:292)
> at 
> org.apache.mina.core.polling.AbstractPollingIoConnector$Connector.run(AbstractPollingIoConnector.java:433)
> at 
> org.apache.mina.util.NamePreservingRunnable.run(NamePreservingRunnable.java:64)
> at 
> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
> at 
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
> at java.lang.Thread.run(Thread.java:748)
> We can see same issue with standalone java class and try to get the ldap 
> connection. Attaching couple of snapshot to understand the issue. 
> Please note this happens in Ubuntu and Centos. Also found same issue with 
> 2.0.21, 2.0.18 mina core jar.
> Can someone please help me on this.
>  
> Thanks,
> Hrushi
>  
>  
>  



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Updated] (DIRMINA-1114) High CPU utilization because of Mina-core jar

2019-05-30 Thread Jonathan Valliere (JIRA)


 [ 
https://issues.apache.org/jira/browse/DIRMINA-1114?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Jonathan Valliere updated DIRMINA-1114:
---
Attachment: nio-metal-example.svg

> High CPU utilization because of Mina-core jar
> -
>
> Key: DIRMINA-1114
> URL: https://issues.apache.org/jira/browse/DIRMINA-1114
> Project: MINA
>  Issue Type: Bug
>  Components: Core
>Affects Versions: 2.1.2
>Reporter: Hrushikesh Agrawal
>Assignee: Jonathan Valliere
>Priority: Major
> Attachments: 29thMay.zip, CPUAnalysys.zip, flamerelated.zip, 
> graph1_color.svg, htop.png, htop.png, nio-metal-example.svg, 
> step1_flamegraph.txt, threaddump_06_05_20191557137156089.log, 
> threaddump_06_05_20191557137173951.log
>
>
> Hi,
> We are have our own product  through which we are trying to communicate with 
> LDAP server by using the mina-core-2.1.2.jar and api-all-1.0.3.jar jars. When 
> we have invalid connection parameter, and tried to get the connection, CPU 
> core utilization is 100%.
> Then we have seen in JVisualVM and in Jprofiler that 
> "org.apache.mina.transport.socket.nio.NioSocketConnector" is in CPU more time.
> We can see below in thread dump-
> "NioSocketConnector-3" #152 prio=5 os_prio=0 tid=0x7f95940d4000 
> nid=0x77fb runnable [0x7f956f1fe000]
>    java.lang.Thread.State: RUNNABLE
> at sun.nio.ch.EPollArrayWrapper.epollWait(Native Method)
> at sun.nio.ch.EPollArrayWrapper.poll(EPollArrayWrapper.java:269)
> at sun.nio.ch.EPollSelectorImpl.doSelect(EPollSelectorImpl.java:93)
> at sun.nio.ch.SelectorImpl.lockAndDoSelect(SelectorImpl.java:86)
> - locked <0xebdf89e8> (a sun.nio.ch.Util$3)
> - locked <0xebdf89d8> (a java.util.Collections$UnmodifiableSet)
> - locked <0xebdf88c0> (a sun.nio.ch.EPollSelectorImpl)
> at sun.nio.ch.SelectorImpl.select(SelectorImpl.java:97)
> at 
> org.apache.mina.transport.socket.nio.NioSocketConnector.select(NioSocketConnector.java:292)
> at 
> org.apache.mina.core.polling.AbstractPollingIoConnector$Connector.run(AbstractPollingIoConnector.java:433)
> at 
> org.apache.mina.util.NamePreservingRunnable.run(NamePreservingRunnable.java:64)
> at 
> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
> at 
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
> at java.lang.Thread.run(Thread.java:748)
> We can see same issue with standalone java class and try to get the ldap 
> connection. Attaching couple of snapshot to understand the issue. 
> Please note this happens in Ubuntu and Centos. Also found same issue with 
> 2.0.21, 2.0.18 mina core jar.
> Can someone please help me on this.
>  
> Thanks,
> Hrushi
>  
>  
>  



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (SSHD-916) Followup of SSHD-912 Review usages of AbstractCloseable#lock and constrain them only to actually needed ones

2019-05-30 Thread Roberto Deandrea (JIRA)


[ 
https://issues.apache.org/jira/browse/SSHD-916?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16851736#comment-16851736
 ] 

Roberto Deandrea commented on SSHD-916:
---

Hi Lyor, I did not see any further deadlocks running our test suite. You can 
safely incorporate SSHD-916 changes into Apache SSHD 2.3.0.

Thanks.

Kind Regards

Roberto Deandrea

> Followup of SSHD-912 Review usages of AbstractCloseable#lock and constrain 
> them only to actually needed ones
> 
>
> Key: SSHD-916
> URL: https://issues.apache.org/jira/browse/SSHD-916
> Project: MINA SSHD
>  Issue Type: Bug
>Affects Versions: 2.2.0
>Reporter: Roberto Deandrea
>Assignee: Goldstein Lyor
>Priority: Major
> Attachments: spxp.usrdump.9503...@aix72.dmz.20190510114505768.log
>
>
> Hi Lyor,
> Yesterday I said you that no deadlock occurred with the new code changes, but 
> I spoke too early :(
> I found a third thread deadlock on SSH client running our long run test 
> always during client/server disconnection.
>  
> The deadlock is as follows :
> Thread #22175 name: sshd-SshClient[ad946082]-nio2-thread-2
> — 
> org.apache.sshd.common.session.helpers.AbstractSession.doWritePacket(AbstractSession.java:873)
>  WAITFOR(encodedLock)
> 
> — 
> org.apache.sshd.common.session.helpers.AbstractSession.handleMessage(AbstractSession.java:362)
>  LOCKED(sessionLock)
>  
> Thread #22180 name: sshd-SshClient[ad946082]-nio2-thread-7
> — 
> org.apache.sshd.client.session.ClientSessionImpl.signalAuthFailure(ClientSessionImpl.java:151)
>   WAITFOR(sessionLock)
> .
> — 
> org.apache.sshd.common.session.helpers.AbstractSession.doWritePacket(AbstractSession.java:876)
>  LOCKED(encodedLock)
>  
> Attached you can find a full thread dump regarding the new deadlock. (see 
> file spxp.usrdump.9503...@aix72.dmz.20190510114505768.log)
> Let me know if you prefer open a new ticket and troubleshoot this issue.
>  
> Kind Regards
> Roberto Deandrea



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (DIRMINA-1114) High CPU utilization because of Mina-core jar

2019-05-30 Thread Hrushikesh Agrawal (JIRA)


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

Hrushikesh Agrawal commented on DIRMINA-1114:
-

Hi [~johnnyv],

Thanks for looking into this.

 

I have executed below commands and its confirmed that, machine is NOT* Virtual 
machine, and its physical machine.



group03@group03:~/Downloads/LDAP-663$ imvirt
Physical
group03@group03:~/Downloads/LDAP-663$ dmesg | grep -i "Hypervisor detected"
group03@group03:~/Downloads/LDAP-663$ 
group03@group03:~/Downloads/LDAP-663$ hostnamectl status
 Static hostname: group03
 Icon name: computer-desktop
 Chassis: desktop
 Machine ID: 9982cd822cde4d3bb226805f177c5c5a
 Boot ID: fb57668868fb4ea1a80b9352ff13bba6
 Operating System: Ubuntu 18.04.1 LTS
 Kernel: Linux 4.15.0-50-generic
 Architecture: x86-64
group03@group03:~/Downloads/LDAP-663$ systemd-detect-virt 
none

Yes, every time you could see the 100% CPU usage, attaching the htop.png which 
shows the 100% CPU usage.

Thanks,

Hrushi

 

 

> High CPU utilization because of Mina-core jar
> -
>
> Key: DIRMINA-1114
> URL: https://issues.apache.org/jira/browse/DIRMINA-1114
> Project: MINA
>  Issue Type: Bug
>  Components: Core
>Affects Versions: 2.1.2
>Reporter: Hrushikesh Agrawal
>Assignee: Jonathan Valliere
>Priority: Major
> Attachments: 29thMay.zip, CPUAnalysys.zip, flamerelated.zip, 
> graph1_color.svg, htop.png, htop.png, step1_flamegraph.txt, 
> threaddump_06_05_20191557137156089.log, threaddump_06_05_20191557137173951.log
>
>
> Hi,
> We are have our own product  through which we are trying to communicate with 
> LDAP server by using the mina-core-2.1.2.jar and api-all-1.0.3.jar jars. When 
> we have invalid connection parameter, and tried to get the connection, CPU 
> core utilization is 100%.
> Then we have seen in JVisualVM and in Jprofiler that 
> "org.apache.mina.transport.socket.nio.NioSocketConnector" is in CPU more time.
> We can see below in thread dump-
> "NioSocketConnector-3" #152 prio=5 os_prio=0 tid=0x7f95940d4000 
> nid=0x77fb runnable [0x7f956f1fe000]
>    java.lang.Thread.State: RUNNABLE
> at sun.nio.ch.EPollArrayWrapper.epollWait(Native Method)
> at sun.nio.ch.EPollArrayWrapper.poll(EPollArrayWrapper.java:269)
> at sun.nio.ch.EPollSelectorImpl.doSelect(EPollSelectorImpl.java:93)
> at sun.nio.ch.SelectorImpl.lockAndDoSelect(SelectorImpl.java:86)
> - locked <0xebdf89e8> (a sun.nio.ch.Util$3)
> - locked <0xebdf89d8> (a java.util.Collections$UnmodifiableSet)
> - locked <0xebdf88c0> (a sun.nio.ch.EPollSelectorImpl)
> at sun.nio.ch.SelectorImpl.select(SelectorImpl.java:97)
> at 
> org.apache.mina.transport.socket.nio.NioSocketConnector.select(NioSocketConnector.java:292)
> at 
> org.apache.mina.core.polling.AbstractPollingIoConnector$Connector.run(AbstractPollingIoConnector.java:433)
> at 
> org.apache.mina.util.NamePreservingRunnable.run(NamePreservingRunnable.java:64)
> at 
> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
> at 
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
> at java.lang.Thread.run(Thread.java:748)
> We can see same issue with standalone java class and try to get the ldap 
> connection. Attaching couple of snapshot to understand the issue. 
> Please note this happens in Ubuntu and Centos. Also found same issue with 
> 2.0.21, 2.0.18 mina core jar.
> Can someone please help me on this.
>  
> Thanks,
> Hrushi
>  
>  
>  



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Updated] (DIRMINA-1114) High CPU utilization because of Mina-core jar

2019-05-30 Thread Hrushikesh Agrawal (JIRA)


 [ 
https://issues.apache.org/jira/browse/DIRMINA-1114?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Hrushikesh Agrawal updated DIRMINA-1114:

Attachment: htop.png

> High CPU utilization because of Mina-core jar
> -
>
> Key: DIRMINA-1114
> URL: https://issues.apache.org/jira/browse/DIRMINA-1114
> Project: MINA
>  Issue Type: Bug
>  Components: Core
>Affects Versions: 2.1.2
>Reporter: Hrushikesh Agrawal
>Assignee: Jonathan Valliere
>Priority: Major
> Attachments: 29thMay.zip, CPUAnalysys.zip, flamerelated.zip, 
> graph1_color.svg, htop.png, htop.png, step1_flamegraph.txt, 
> threaddump_06_05_20191557137156089.log, threaddump_06_05_20191557137173951.log
>
>
> Hi,
> We are have our own product  through which we are trying to communicate with 
> LDAP server by using the mina-core-2.1.2.jar and api-all-1.0.3.jar jars. When 
> we have invalid connection parameter, and tried to get the connection, CPU 
> core utilization is 100%.
> Then we have seen in JVisualVM and in Jprofiler that 
> "org.apache.mina.transport.socket.nio.NioSocketConnector" is in CPU more time.
> We can see below in thread dump-
> "NioSocketConnector-3" #152 prio=5 os_prio=0 tid=0x7f95940d4000 
> nid=0x77fb runnable [0x7f956f1fe000]
>    java.lang.Thread.State: RUNNABLE
> at sun.nio.ch.EPollArrayWrapper.epollWait(Native Method)
> at sun.nio.ch.EPollArrayWrapper.poll(EPollArrayWrapper.java:269)
> at sun.nio.ch.EPollSelectorImpl.doSelect(EPollSelectorImpl.java:93)
> at sun.nio.ch.SelectorImpl.lockAndDoSelect(SelectorImpl.java:86)
> - locked <0xebdf89e8> (a sun.nio.ch.Util$3)
> - locked <0xebdf89d8> (a java.util.Collections$UnmodifiableSet)
> - locked <0xebdf88c0> (a sun.nio.ch.EPollSelectorImpl)
> at sun.nio.ch.SelectorImpl.select(SelectorImpl.java:97)
> at 
> org.apache.mina.transport.socket.nio.NioSocketConnector.select(NioSocketConnector.java:292)
> at 
> org.apache.mina.core.polling.AbstractPollingIoConnector$Connector.run(AbstractPollingIoConnector.java:433)
> at 
> org.apache.mina.util.NamePreservingRunnable.run(NamePreservingRunnable.java:64)
> at 
> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
> at 
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
> at java.lang.Thread.run(Thread.java:748)
> We can see same issue with standalone java class and try to get the ldap 
> connection. Attaching couple of snapshot to understand the issue. 
> Please note this happens in Ubuntu and Centos. Also found same issue with 
> 2.0.21, 2.0.18 mina core jar.
> Can someone please help me on this.
>  
> Thanks,
> Hrushi
>  
>  
>  



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)