Comments (3)
Thanks for the bug report.
The quickest way to get this in would be to fork, write a test, write
updated code that makes the test pass, and request a merge.
Jez.
On 22 August 2011 18:19, ebwweb <
[email protected]>wrote:
The parse method throws NumberFormatExceptions if the process name in the
/proc//stat file has spaces (for example the "MpxTestDaemon " (with 2
spaces at the end) process on EMC/StorNext metadata controllers).Recommend changing the parse method to:
public ProcessInfo parse() { int openParen = stat.indexOf("("); int closeParen = stat.lastIndexOf(")"); //Start splitting after close of proc name String[] statElements = stat.substring(closeParen + 2).split(" "); String pidStr = stat.substring(0,openParen - 1); return new ProcessInfo(Integer.parseInt(pidStr), Integer.parseInt(statElements[1]), trim(cmdline), getFirstMatch(STATUS_NAME_MATCHER, status), (String) uids.get(getFirstMatch(STATUS_UID_MATCHER, status)), Long.parseLong(statElements[11]) * (1000 / userHz), Long.parseLong(statElements[12]) * (1000 / userHz), Long.parseLong(getFirstMatch(STATUS_VM_RSS_MATCHER, status)) * 1024, Long.parseLong(getFirstMatch(STATUS_VM_SIZE_MATCHER, status)) * 1024); }Reply to this email directly or view it on GitHub:
#10
Jez Humble
Co-author, Continuous Delivery http://continuousdelivery.com/
http://continuousdelivery.com/
http://jezhumble.net/
from javasysmon.
Having recently adopted javasysmon, we had a customer report this issue. I checked out the Linux source for parsing stat entries and they do it essentially as ebwweb has outlined above - by searching from both ends of the string to find the parens around the process name. This is required as the name can include spaces, parens, numbers, pretty much anything. I've adapted ebwweb's solution into a larger patch which includes tests and handling of various potentially unexpected conditions. The aim is for things to be as lenient as possible (i.e. only require the fields we are trying to use) and to soldier on in the face of problem entries (i.e. skip difficult processes and continue gathering the rest).
from javasysmon.
Thanks for the patch Jason! I merged it in.
from javasysmon.
Related Issues (20)
- Access violation in call to processTable() - (Win7 64bit) HOT 6
- Process handle leak when killing a process on Windows
- NPE when try to kill linux process running JDK8 HOT 5
- When SWAP is totally disabled under Windows JavaSysMon returns incorrect SWAP values
- When java is started as a service under Windows, JavaSysMon may not find the current process
- x86 Version HOT 7
- Clean way to exec a new sub process and get its PID to be able to kill it?
- Uncompatible DLL loaded on Windows 64-bit HOT 12
- windows 32bit dll was incorrectly compiled as 64bit HOT 3
- No match found on RHEL 6.6
- http://continuousdelivery.com/downloads/javasysmon/javasysmon-0.3.5.jar is dead HOT 1
- NullPointerException in ProcessInfo.stringFormat HOT 2
- Jar File Download Links is Dead(404)
- object.swap() returns not free memory, but occupied memory HOT 1
- Network and Disk stats
- Add a function to getCurrentOsProcess()
- com.jezhumble.javasysmon.WindowsMonitor.processTable() leads sometimes to access violation under Windows10
- ProcessInfo.getCommand() leads to ??? under Windows 10
- fix links in the readme file
- missing javadocs
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from javasysmon.