profesorfalken / jProcesses

Get crossplatform processes details with Java
Apache License 2.0
63 stars 26 forks source link

Null Pointer Exceptions #23

Open petercambal opened 6 years ago

petercambal commented 6 years ago

Hello, I am using you library at Linux: Linux ip----*** 4.9.77-31.58.amzn1.x86_64 x86_64 x86_64 x86_64 GNU/Linux


From time to time I got exception: java.lang.NullPointerException at org.jutils.jprocesses.info.UnixProcessesService.parseList(UnixProcessesService.java:49) at org.jutils.jprocesses.info.AbstractProcessesService.getList(AbstractProcessesService.java:50) at org.jutils.jprocesses.info.AbstractProcessesService.getList(AbstractProcessesService.java:43) at org.jutils.jprocesses.info.AbstractProcessesService.getList(AbstractProcessesService.java:35) at org.jutils.jprocesses.JProcesses.getProcessList(JProcesses.java:136)


Edit: I found another One java.lang.NullPointerException at org.jutils.jprocesses.info.UnixProcessesService.loadFullCommandData(UnixProcessesService.java:171) at org.jutils.jprocesses.info.UnixProcessesService.parseList(UnixProcessesService.java:88) at org.jutils.jprocesses.info.AbstractProcessesService.getList(AbstractProcessesService.java:50) at org.jutils.jprocesses.info.AbstractProcessesService.getList(AbstractProcessesService.java:43) at org.jutils.jprocesses.info.AbstractProcessesService.getList(AbstractProcessesService.java:35)


It would be great if you could check this issue, why is this happening and how to prevent this.

profesorfalken commented 6 years ago

Hello,

What happens if you launch from your bash console the following command.?:

ps -e -o pid,command
petercambal commented 6 years ago

It prints list of processes, attributes processID and command. I will put a screenshot below.

screenshot_1

profesorfalken commented 6 years ago

Hi,

This is weird. The only thing that can cause this NPE is an error executing the command.

Normally the stack of the IOException should be logged at severe level:

Logger.getLogger(ProcessesUtils.class.getName()).log(Level.SEVERE, null, ex);

Could you check if you have a log somewhere of type: "Cannot run program"... ?

Thanks

profesorfalken commented 6 years ago

Another question. Does it happen systematically?

I have build a new version that should give us more clues.

If you are using maven, just add the dependency as:

<dependency>
         <groupId>org.jprocesses</groupId>
         <artifactId>jProcesses</artifactId>
        <version>1.6.5-SNAPSHOT</version>
  </dependency>

If not, you can download the JAR file directly from here: https://oss.sonatype.org/content/repositories/snapshots/org/jprocesses/jProcesses/1.6.5-SNAPSHOT/jProcesses-1.6.5-20180326.171140-2.jar

petercambal commented 6 years ago

It hapenned 24x over last 4 days, on 4 servers. Others seems fine. I did not notice any log with "Cannot run program" message. I am going to deploy code with new version and I will keep you updated.

Edit: I updated version in maven xml file, but it can not find dependency with this version.