Nullpointer in vmstat when exiting
-
Whenever I shutdown mango the vmstat daemon thread crashes with a nullpointer exception. this isn't a big deal since I am shutting it down anyway, but it also happens when disabling the data source:
stack:
this VMStatDataSourceRT (id=189) addedChangedPoints ArrayList<E> (id=200) elementData Object[10] (id=233) modCount 0 size 0 attributePositions HashMap<K,V> (id=210) entrySet HashMap$EntrySet (id=309) keySet null loadFactor 0.75 modCount 16 size 16 table HashMap$Entry<K,V>[32] (id=311) threshold 24 values null dataPoints ArrayList<E> (id=214) elementData Object[10] (id=308) modCount 0 size 0 eventTypes ArrayList<E> (id=215) elementData Object[10] (id=307) modCount 2 size 2 in BufferedReader (id=216) cb (id=303) in InputStreamReader (id=305) lock InputStreamReader (id=305) markedChar -1 markedSkipLF false nChars 78 nextChar 78 readAheadLimit 0 skipBuffer null skipLF false log Log4JLogger (id=221) logger Logger (id=298) name "com.serotonin.mango.rt.dataSource.vmstat.VMStatDataSourceRT" (id=302) pointListChangeLock Boolean (id=224) value false removedPoints ArrayList<E> (id=227) elementData Object[10] (id=297) modCount 0 size 0 terminated true vmstatProcess UNIXProcess (id=194) exitcode 143 hasExited true pid 18998 stderr_fd FileDescriptor (id=286) stderr_stream FileInputStream (id=288) stdin_fd FileDescriptor (id=291) stdin_stream BufferedOutputStream (id=292) stdout_fd FileDescriptor (id=312) stdout_stream BufferedInputStream (id=313) vo VMStatDataSourceVO (id=228) alarmLevels HashMap<K,V> (id=274) enabled true id 6 name "vmstat" (id=282) outputScale 2 pollSeconds 60 xid "DS_742792" (id=285) vo VMStatDataSourceVO (id=228) alarmLevels HashMap<K,V> (id=274) entrySet HashMap$EntrySet (id=275) keySet null loadFactor 0.75 modCount 2 size 2 table HashMap$Entry<K,V>[16] (id=279) threshold 12 values null enabled true id 6 name "vmstat" (id=282) outputScale 2 pollSeconds 60 xid "DS_742792" (id=285) line null
As you can see line is null. the nullpointer occurs at the readParts(line.split) line below, every time when I shut down.
public void run() { try { while (true) { String line = in.readLine(); readParts(line.split("\\s+")); readError(); } }
The appropriate fix isn't obvious to me.
-
Hi Craig,
I already have a fix for this in for the next version. I did this:
while (true) { String line = in.readLine(); if (line == null) { if (terminated) break; else throw new IOException("no data"); } readParts(line.split("\\s+")); readError(); }