Memory leaks openHABian2.2

  • Platform information:
    • Hardware: Raspbery PI 3 B
    • OS: Openhabian v1.4
    • Java Runtime Environment:
    • openHAB version: openHAB 2.2.0-1
  • Issue of the topic: Memory leaks. after 1-2 day openhab process OutOfMemory error
  • Please post configurations (if applicable):
    • Items configuration related to the issue

String ToSerial “To Serial [%s]” {serial="/dev/ttyAMA0@115200"}

String PowModeIn “Mode” (PowerGroup)
String PowNghtIn “PowNghtIn” (PowerGroup)
String PowOnOfIn “PowOnOfIn” (PowerGroup)
Number PowLitNIn “PowLitNIn” (PowerGroup)
Number PowLitDIn “PowLitDIn” (PowerGroup)
Number PowFulNIn “PowFulNIn” (PowerGroup)
Number PowFulDIn “PowFulDIn” (PowerGroup)
Number PowTMaxIn “PowTMaxIn” (PowerGroup,Grafana)
Number PowTmp1In “PowTmp1In” (PowerGroup,Grafana)
Number PowTmp2In “PowTmp2In” (PowerGroup,Grafana)
Number PowTmpPIn “PowTmpPIn” (PowerGroup,Grafana)
Number PowTmpOIn “PowTmpOIn” (PowerGroup,Grafana)
String PowOnOfDb “PowOnOfDb” (Grafana)
String WatLevlIn “WatLevlIn” (PowerGroup)
String WatTempIn “WatTempIn” (PowerGroup)
String WatModeIn “WatModeIn” (PowerGroup)
String WatPumpIn “WatPumpIn” (PowerGroup)

  • Sitemap configuration related to the issue

sitemap serial label=“Home” {
Frame label=“Frame1”{
Text item=PowTmp1In label=“Temp1 [%.1f °C]” {
Frame label=“Mode” {
Switch item=PowModeIn label=“Mode” mappings=[0=“Mode 0”, 1=“Mode 1”, 2=“Vjde 2”,3=“Mode 3”]
}
Frame label=“Set” {
Setpoint item= PowLitDIn label=“Mode 0 [%.1f °C]” visibility=[PowModeIn==1, PowModeIn==0 ] minValue=5 maxValue=30 step=1
Setpoint item= PowLitNIn label=“Mode 1 [%.1f °C]” visibility=[PowModeIn==0] minValue=5 maxValue=30 step=1
Setpoint item= PowFulDIn label=“Mode 2 [%.1f °C]” visibility=[PowModeIn==3, PowModeIn==2 ] minValue=5 maxValue=30 step=1
Setpoint item= PowFulNIn label=“Mode 3 [%.1f °C]” visibility=[PowModeIn==2] minValue=5 maxValue=30 step=1
Setpoint item= PowTMaxIn label=“TMax [%.1f °C]” minValue=10 maxValue=60 step=1
}
Frame label=“Tepms”{
Text item=PowNghtIn label="M1[%s]"
Text item=PowOnOfIn label="M2[%s]"
Text item=PowTmp1In label="T1[%.1f °C]"
Text item=PowTmp2In label="T2[%.1f °C]"
Text item=PowTmpPIn label="T3[%.1f °C]"
Text item=PowTmpOIn label=“T4[%.1f °C]”
}
}
}
Frame label=“Water”{
Text item= WatLevlIn label=“Level[%s m]”
}
Frame label=“Temp0”{
Text item= WatTempIn label=“Temp0[%s °C]”
}
Frame label=“Pumps”{
Text item= WatModeIn label=“Pump Mode[%s]” //mappings=[0=“Off”, 1=“On”]
Text item= WatPumpIn label=“Activity[%s]”
}
}

  • Rules code related to the issue

var statePowModeIn
var statePowLitNIn
var statePowLitDIn
var statePowFulDIn
var statePowFulNIn
var statePowTMaxIn

rule "startup"
when
System started
then

statePowModeIn=PowModeIn.state.toString()
statePowLitNIn=PowLitNIn.state.toString()
statePowLitDIn=PowLitDIn.state.toString()
statePowFulDIn=PowFulDIn.state.toString()
statePowFulNIn=PowFulNIn.state.toString()
statePowTMaxIn=PowTMaxIn.state.toString()
end

rule "Serial_control"
when
Item ToSerial received update
then
var String _inp
var String Comand
var String Param
var int i
var int j
var int y
var int _len

try {
_inp=ToSerial.state.toString()
_len=_inp.length()
y=0;
while (y<_len-1) {
j=_inp.indexOf(";",y)
if (j!=-1) {
i=_inp.indexOf("=",y)
if (i!=-1) {
Comand = _inp.substring(y,i)
Param = _inp.substring(i+1,j)
y=j+1
if(Comand ==“PT1I”) sendCommand(PowTmp1In, Param)
else if(Comand ==“PT2I”) sendCommand(PowTmp2In, Param)
else if(Comand ==“PTPI”) sendCommand(PowTmpPIn, Param)
else if(Comand ==“PTOI”) sendCommand(PowTmpOIn, Param)
else if(Comand ==“PMdI”) sendCommand(PowModeIn, Param)
else if(Comand ==“PNgI”) {
if (Param==“1”) sendCommand(PowNghtIn, “N”)
if (Param==“0”) sendCommand(PowNghtIn, “D”)
}
else if(Comand ==“POOI”) {
if (Param==“1”) {
sendCommand(PowOnOfIn, “On”);
sendCommand(PowOnOfDb, “50”);
}
if (Param==“0”) {
sendCommand(PowOnOfIn, “Off”);
sendCommand(PowOnOfDb, “0”);
}
}
else if(Comand ==“PLNI”) sendCommand(PowLitNIn, Param)
else if(Comand ==“PLDI”) sendCommand(PowLitDIn, Param)
else if(Comand ==“PFNI”) sendCommand(PowFulNIn, Param)
else if(Comand ==“PFDI”) sendCommand(PowFulDIn, Param)
else if(Comand ==“PTMI”) sendCommand(PowTMaxIn, Param)
else if(Comand ==“WLvI”) sendCommand(WatLevlIn, Param)
else if(Comand ==“WTmI”) sendCommand(WatTempIn, Param)
else if(Comand ==“WMdI”) sendCommand(WatModeIn, Param)
else if(Comand ==“WPmI”) sendCommand(WatPumpIn, Param)
else logInfo(“SerialRules”, "Wrong command to parse: " + Comand)
}
else {
y=_len-1
}
}
else {
y=_len-1
}
}
}
catch (Exception e) {
logInfo(“Exception.Ex1”, e.toString())

	try{
		logInfo("_inp=", _inp)
		logInfo("While", _inp + " ->" +  y.toString () + " " + i.toString () + " " + j.toString() )   
		logInfo("Comand",  Comand.toString ()  + "->" + Param.toString () )    
	}
	catch (Exception e1){
		logInfo("Exception.Ex2", e1.toString())
	}

}
_inp=null
Comand=null
Param=null
i=null
j=null
y=null
_len=null
end

rule "PowModeIn"
when
Item PowModeIn changed
then
if (statePowModeIn!=“NULL”) ToSerial.sendCommand(“Set PMdO=”+ PowModeIn.state.toString()+ ‘;’)
statePowModeIn=PowModeIn.state.toString()
end

rule "PowLitNIn"
when
Item PowLitNIn changed
then
if (statePowLitNIn!=“NULL”) ToSerial.sendCommand(“Set PLNO=”+ PowLitNIn.state.toString()+ ‘;’)
statePowLitNIn=PowLitNIn.state.toString()
end
rule "PowLitDIn"
when
Item PowLitDIn changed
then
if (statePowLitDIn!=“NULL”) ToSerial.sendCommand(“Set PLDO=”+ PowLitDIn.state.toString()+ ‘;’)
statePowLitDIn=PowLitDIn.state.toString()
end

rule "PowFulNIn"
when
Item PowFulNIn changed
then
if (statePowFulNIn!=“NULL”) ToSerial.sendCommand(“Set PFNO=”+ PowFulNIn.state.toString()+ ‘;’)
statePowFulNIn=PowFulNIn.state.toString()
end

rule "PowFulDIn"
when
Item PowFulDIn changed
then
if (statePowFulDIn!=“NULL”) ToSerial.sendCommand(“Set PFDO=”+ PowFulDIn.state.toString()+ “;”)
statePowFulDIn=PowFulDIn.state.toString()

end

rule "PowTMaxIn"
when
Item PowTMaxIn changed
then
if (statePowTMaxIn!=“NULL”) ToSerial.sendCommand(“Set PTMO=”+ PowTMaxIn.state.toString()+ ‘;’)
statePowTMaxIn=PowTMaxIn.state.toString()
end

  • Services configuration related to the issue

  • If logs where generated please post these here using code fences:
    2018-02-12 23:00:56.652 [INFO ] [e.smarthome.model.script.SerialRules] - Wrong command to parse: Set PLNO
    2018-02-12 23:01:00.039 [INFO ] [e.smarthome.model.script.SerialRules] - Wrong command to parse: Set PLNO
    2018-02-12 23:01:13.391 [INFO ] [e.smarthome.model.script.SerialRules] - Wrong command to parse: Set PLNO
    2018-02-13 03:12:10.558 [WARN ] [ore.internal.events.OSGiEventManager] - Dispatching event to subscriber ‘org.eclipse.smarthome.core.internal.items.ItemUpdater@1854553’ takes more than 5000ms.
    2018-02-13 03:35:20.949 [WARN ] [ore.internal.events.OSGiEventManager] - Dispatching event to subscriber ‘org.openhab.core.events.internal.EventBridge@faa03’ takes more than 5000ms.
    2018-02-13 03:41:27.186 [WARN ] [ore.internal.events.OSGiEventManager] - Dispatching event to subscriber ‘org.eclipse.smarthome.core.internal.items.ItemUpdater@1854553’ takes more than 5000ms.
    2018-02-13 03:45:26.499 [WARN ] [ore.internal.events.OSGiEventManager] - Dispatching event to subscriber ‘org.eclipse.smarthome.core.internal.items.ItemUpdater@1854553’ takes more than 5000ms.
    2018-02-13 03:55:30.102 [WARN ] [ore.internal.events.OSGiEventManager] - Dispatching event to subscriber ‘org.openhab.core.events.internal.EventBridge@faa03’ takes more than 5000ms.
    2018-02-13 03:57:00.431 [WARN ] [ore.internal.events.OSGiEventManager] - Dispatching event to subscriber ‘org.eclipse.smarthome.core.autoupdate.internal.AutoUpdateBinding@d8b9ab’ takes more than 5000ms.
    2018-02-13 03:57:14.073 [WARN ] [ore.internal.events.OSGiEventManager] - Dispatching event to subscriber ‘org.eclipse.smarthome.core.autoupdate.internal.AutoUpdateBinding@d8b9ab’ takes more than 5000ms.
    2018-02-13 03:57:20.422 [WARN ] [ore.internal.events.OSGiEventManager] - Dispatching event to subscriber ‘org.eclipse.smarthome.core.internal.items.ItemUpdater@1854553’ takes more than 5000ms.
    2018-02-13 03:57:34.013 [WARN ] [ore.internal.events.OSGiEventManager] - Dispatching event to subscriber ‘org.eclipse.smarthome.core.internal.items.ItemUpdater@1854553’ takes more than 5000ms.
    2018-02-13 03:57:46.591 [WARN ] [ore.internal.events.OSGiEventManager] - Dispatching event to subscriber ‘org.eclipse.smarthome.core.internal.items.ItemUpdater@1854553’ takes more than 5000ms.
    2018-02-13 03:58:00.128 [WARN ] [ore.internal.events.OSGiEventManager] - Dispatching event to subscriber ‘org.openhab.core.events.internal.EventBridge@faa03’ takes more than 5000ms.
    2018-02-13 03:58:26.405 [WARN ] [ore.internal.events.OSGiEventManager] - Dispatching event to subscriber ‘org.eclipse.smarthome.model.rule.runtime.internal.engine.RuleEngineImpl@ba51cc’ takes more than 5000ms.
    2018-02-13 03:58:32.732 [WARN ] [ore.internal.events.OSGiEventManager] - Dispatching event to subscriber ‘org.eclipse.smarthome.core.autoupdate.internal.AutoUpdateBinding@d8b9ab’ takes more than 5000ms.
    2018-02-13 03:58:45.283 [WARN ] [ore.internal.events.OSGiEventManager] - Dispatching event to subscriber ‘org.openhab.core.events.internal.EventBridge@faa03’ takes more than 5000ms.
    2018-02-13 03:58:52.626 [WARN ] [ore.internal.events.OSGiEventManager] - Dispatching event to subscriber ‘org.eclipse.smarthome.core.internal.items.ItemUpdater@1854553’ takes more than 5000ms.
    2018-02-13 03:58:58.923 [WARN ] [ore.internal.events.OSGiEventManager] - Dispatching event to subscriber ‘org.eclipse.smarthome.core.autoupdate.internal.AutoUpdateBinding@d8b9ab’ takes more than 5000ms.
    2018-02-13 03:59:11.553 [WARN ] [ore.internal.events.OSGiEventManager] - Dispatching event to subscriber ‘org.eclipse.smarthome.model.rule.runtime.internal.engine.RuleEngineImpl@ba51cc’ takes more than 5000ms.
    2018-02-13 04:00:54.212 [WARN ] [ore.internal.events.OSGiEventManager] - Dispatching event to subscriber ‘org.eclipse.smarthome.core.internal.items.ItemUpdater@1854553’ takes more than 5000ms.
    2018-02-13 04:01:40.122 [WARN ] [ore.internal.events.OSGiEventManager] - Dispatching event to subscriber ‘org.eclipse.smarthome.core.internal.items.ItemUpdater@1854553’ takes more than 5000ms.
    2018-02-13 04:02:06.142 [WARN ] [ore.internal.events.OSGiEventManager] - Dispatching event to subscriber ‘org.openhab.core.events.internal.EventBridge@faa03’ takes more than 5000ms.
    2018-02-13 04:02:32.351 [WARN ] [ore.internal.events.OSGiEventManager] - Dispatching event to subscriber ‘org.openhab.core.events.internal.EventBridge@faa03’ takes more than 5000ms.
    2018-02-13 04:02:52.212 [WARN ] [ore.internal.events.OSGiEventManager] - Dispatching event to subscriber ‘org.eclipse.smarthome.core.autoupdate.internal.AutoUpdateBinding@d8b9ab’ takes more than 5000ms.
    2018-02-13 04:03:43.913 [WARN ] [ore.internal.events.OSGiEventManager] - Dispatching event to subscriber ‘org.openhab.core.events.internal.EventBridge@faa03’ takes more than 5000ms.
    2018-02-13 04:04:42.181 [WARN ] [ore.internal.events.OSGiEventManager] - Dispatching event to subscriber ‘org.eclipse.smarthome.core.internal.items.ItemUpdater@1854553’ takes more than 5000ms.
    2018-02-13 04:05:14.713 [WARN ] [ore.internal.events.OSGiEventManager] - Dispatching event to subscriber ‘org.eclipse.smarthome.core.autoupdate.internal.AutoUpdateBinding@d8b9ab’ takes more than 5000ms.
    2018-02-13 04:05:28.311 [WARN ] [ore.internal.events.OSGiEventManager] - Dispatching event to subscriber ‘org.eclipse.smarthome.core.autoupdate.internal.AutoUpdateBinding@d8b9ab’ takes more than 5000ms.
    2018-02-13 04:05:54.561 [WARN ] [ore.internal.events.OSGiEventManager] - Dispatching event to subscriber ‘org.eclipse.smarthome.core.internal.items.ItemUpdater@1854553’ takes more than 5000ms.
    2018-02-13 04:07:36.155 [WARN ] [ore.internal.events.OSGiEventManager] - Dispatching event to subscriber ‘org.openhab.core.events.internal.EventBridge@faa03’ takes more than 5000ms.
    2018-02-13 04:08:46.845 [WARN ] [ore.internal.events.OSGiEventManager] - Dispatching event to subscriber ‘org.eclipse.smarthome.model.rule.runtime.internal.engine.RuleEngineImpl@ba51cc’ takes more than 5000ms.
    2018-02-13 04:09:05.572 [WARN ] [ore.internal.events.OSGiEventManager] - Dispatching event to subscriber ‘org.eclipse.smarthome.core.thing.internal.CommunicationManager@1403428’ takes more than 5000ms.
    2018-02-13 04:10:15.317 [WARN ] [ore.internal.events.OSGiEventManager] - Dispatching event to subscriber ‘org.eclipse.smarthome.core.autoupdate.internal.AutoUpdateBinding@d8b9ab’ takes more than 5000ms.
    2018-02-13 04:10:21.556 [WARN ] [ore.internal.events.OSGiEventManager] - Dispatching event to subscriber ‘org.eclipse.smarthome.core.thing.internal.CommunicationManager@1403428’ takes more than 5000ms.
    2018-02-13 04:10:28.879 [WARN ] [ore.internal.events.OSGiEventManager] - Dispatching event to subscriber ‘org.openhab.core.events.internal.EventBridge@faa03’ takes more than 5000ms.
    2018-02-13 04:10:41.427 [WARN ] [ore.internal.events.OSGiEventManager] - Dispatching event to subscriber ‘org.eclipse.smarthome.core.autoupdate.internal.AutoUpdateBinding@d8b9ab’ takes more than 5000ms.
    2018-02-13 04:10:55.002 [WARN ] [ore.internal.events.OSGiEventManager] - Dispatching event to subscriber ‘org.eclipse.smarthome.core.thing.internal.CommunicationManager@1403428’ takes more than 5000ms.
    2018-02-13 04:11:13.963 [WARN ] [ore.internal.events.OSGiEventManager] - Dispatching event to subscriber ‘org.eclipse.smarthome.core.internal.items.ItemUpdater@1854553’ takes more than 5000ms.
    2018-02-13 04:11:13.975 [WARN ] [ore.internal.events.OSGiEventManager] - Dispatching event to subscriber ‘org.eclipse.smarthome.core.internal.items.ItemUpdater@1854553’ takes more than 5000ms.
    2018-02-13 04:11:46.399 [WARN ] [ore.internal.events.OSGiEventManager] - Dispatching event to subscriber ‘org.eclipse.smarthome.core.internal.items.ItemUpdater@1854553’ takes more than 5000ms.
    2018-02-13 04:12:18.774 [WARN ] [ore.internal.events.OSGiEventManager] - Dispatching event to subscriber ‘org.eclipse.smarthome.core.thing.internal.CommunicationManager@1403428’ takes more than 5000ms.
    2018-02-13 04:12:38.685 [WARN ] [ore.internal.events.OSGiEventManager] - Dispatching event to subscriber ‘org.eclipse.smarthome.core.autoupdate.internal.AutoUpdateBinding@d8b9ab’ takes more than 5000ms.
    2018-02-13 04:12:57.604 [WARN ] [ore.internal.events.OSGiEventManager] - Dispatching event to subscriber ‘org.eclipse.smarthome.core.internal.items.ItemUpdater@1854553’ takes more than 5000ms.
    2018-02-13 04:13:42.729 [WARN ] [ore.internal.events.OSGiEventManager] - Dispatching event to subscriber ‘org.eclipse.smarthome.core.internal.items.ItemUpdater@1854553’ takes more than 5000ms.
    2018-02-13 04:14:08.913 [WARN ] [ore.internal.events.OSGiEventManager] - Dispatching event to subscriber ‘org.eclipse.smarthome.core.internal.items.ItemUpdater@1854553’ takes more than 5000ms.
    2018-02-13 04:14:28.822 [WARN ] [ore.internal.events.OSGiEventManager] - Dispatching event to subscriber ‘org.eclipse.smarthome.core.thing.internal.CommunicationManager@1403428’ takes more than 5000ms.
    2018-02-13 04:14:54.832 [WARN ] [ore.internal.events.OSGiEventManager] - Dispatching event to subscriber ‘org.eclipse.smarthome.io.monitor.internal.EventLogger@ae9d23’ takes more than 5000ms.
    2018-02-13 04:15:01.108 [WARN ] [ore.internal.events.OSGiEventManager] - Dispatching event to subscriber ‘org.eclipse.smarthome.core.thing.internal.CommunicationManager@1403428’ takes more than 5000ms.
    2018-02-13 04:15:14.750 [WARN ] [ore.internal.events.OSGiEventManager] - Dispatching event to subscriber ‘org.eclipse.smarthome.core.internal.items.ItemUpdater@1854553’ takes more than 5000ms.
    2018-02-13 04:15:53.433 [WARN ] [ore.internal.events.OSGiEventManager] - Dispatching event to subscriber ‘org.eclipse.smarthome.core.autoupdate.internal.AutoUpdateBinding@d8b9ab’ takes more than 5000ms.
    2018-02-13 04:16:07.059 [WARN ] [ore.internal.events.OSGiEventManager] - Dispatching event to subscriber ‘org.openhab.core.events.internal.EventBridge@faa03’ takes more than 5000ms.
    2018-02-13 04:16:58.355 [WARN ] [ore.internal.events.OSGiEventManager] - Dispatching event to subscriber ‘org.eclipse.smarthome.core.internal.items.ItemUpdater@1854553’ takes more than 5000ms.
    2018-02-13 04:17:43.228 [WARN ] [ore.internal.events.OSGiEventManager] - Dispatching event to subscriber ‘org.eclipse.smarthome.core.internal.items.ItemUpdater@1854553’ takes more than 5000ms.
    2018-02-13 04:18:21.734 [WARN ] [ore.internal.events.OSGiEventManager] - Dispatching event to subscriber ‘org.eclipse.smarthome.core.internal.items.ItemUpdater@1854553’ takes more than 5000ms.
    2018-02-13 04:18:54.062 [WARN ] [ore.internal.events.OSGiEventManager] - Dispatching event to subscriber ‘org.eclipse.smarthome.core.internal.items.ItemUpdater@1854553’ takes more than 5000ms.
    2018-02-13 04:19:32.739 [WARN ] [ore.internal.events.OSGiEventManager] - Dispatching event to subscriber ‘org.openhab.core.events.internal.EventBridge@faa03’ takes more than 5000ms.
    2018-02-13 04:20:55.399 [WARN ] [ore.internal.events.OSGiEventManager] - Dispatching event to subscriber ‘org.eclipse.smarthome.core.autoupdate.internal.AutoUpdateBinding@d8b9ab’ takes more than 5000ms.
    2018-02-13 04:21:15.208 [WARN ] [ore.internal.events.OSGiEventManager] - Dispatching event to subscriber ‘org.eclipse.smarthome.io.rest.sse.internal.listeners.SseEventSubscriber@126e6d0’ takes more than 5000ms.
    2018-02-13 04:22:26.235 [WARN ] [ore.internal.events.OSGiEventManager] - Dispatching event to subscriber ‘org.eclipse.smarthome.core.autoupdate.internal.AutoUpdateBinding@d8b9ab’ takes more than 5000ms.
    2018-02-13 04:23:11.181 [WARN ] [ore.internal.events.OSGiEventManager] - Dispatching event to subscriber ‘org.eclipse.smarthome.core.autoupdate.internal.AutoUpdateBinding@d8b9ab’ takes more than 5000ms.
    2018-02-13 04:23:30.999 [WARN ] [ore.internal.events.OSGiEventManager] - Dispatching event to subscriber ‘org.eclipse.smarthome.core.autoupdate.internal.AutoUpdateBinding@d8b9ab’ takes more than 5000ms.
    2018-02-13 04:23:50.787 [WARN ] [ore.internal.events.OSGiEventManager] - Dispatching event to subscriber ‘org.eclipse.smarthome.core.autoupdate.internal.AutoUpdateBinding@d8b9ab’ takes more than 5000ms.
    2018-02-13 04:25:51.302 [WARN ] [ore.internal.events.OSGiEventManager] - Dispatching event to subscriber ‘org.eclipse.smarthome.core.thing.internal.CommunicationManager@1403428’ takes more than 5000ms.
    2018-02-13 04:27:39.901 [WARN ] [ore.internal.events.OSGiEventManager] - Dispatching event to subscriber ‘org.eclipse.smarthome.core.autoupdate.internal.AutoUpdateBinding@d8b9ab’ takes more than 5000ms.
    2018-02-13 04:31:14.547 [WARN ] [ore.internal.events.OSGiEventManager] - Dispatching event to subscriber ‘org.eclipse.smarthome.core.internal.items.ItemUpdater@1854553’ takes more than 5000ms.
    2018-02-13 04:31:20.785 [WARN ] [ore.internal.events.OSGiEventManager] - Dispatching event to subscriber ‘org.openhab.core.events.internal.EventBridge@faa03’ takes more than 5000ms.
    2018-02-13 04:32:06.793 [WARN ] [ore.internal.events.OSGiEventManager] - Dispatching event to subscriber ‘org.eclipse.smarthome.core.autoupdate.internal.AutoUpdateBinding@d8b9ab’ takes more than 5000ms.
    2018-02-13 04:34:00.671 [WARN ] [ore.internal.events.OSGiEventManager] - Dispatching event to subscriber ‘org.eclipse.smarthome.core.autoupdate.internal.AutoUpdateBinding@d8b9ab’ takes more than 5000ms.
    2018-02-13 04:34:45.669 [WARN ] [ore.internal.events.OSGiEventManager] - Dispatching event to subscriber ‘org.eclipse.smarthome.core.autoupdate.internal.AutoUpdateBinding@d8b9ab’ takes more than 5000ms.
    2018-02-13 04:35:56.792 [WARN ] [ore.internal.events.OSGiEventManager] - Dispatching event to subscriber ‘org.eclipse.smarthome.core.autoupdate.internal.AutoUpdateBinding@d8b9ab’ takes more than 5000ms.
    2018-02-13 04:36:48.092 [WARN ] [ore.internal.events.OSGiEventManager] - Dispatching event to subscriber ‘org.eclipse.smarthome.core.autoupdate.internal.AutoUpdateBinding@d8b9ab’ takes more than 5000ms.
    2018-02-13 04:38:24.310 [WARN ] [ore.internal.events.OSGiEventManager] - Dispatching event to subscriber ‘org.eclipse.smarthome.model.rule.runtime.internal.engine.RuleEngineImpl@ba51cc’ takes more than 5000ms.
    2018-02-13 04:39:16.370 [WARN ] [ore.internal.events.OSGiEventManager] - Dispatching event to subscriber ‘org.eclipse.smarthome.core.autoupdate.internal.AutoUpdateBinding@d8b9ab’ takes more than 5000ms.
    2018-02-13 04:39:48.660 [WARN ] [ore.internal.events.OSGiEventManager] - Dispatching event to subscriber ‘org.eclipse.smarthome.core.thing.internal.CommunicationManager@1403428’ takes more than 5000ms.
    2018-02-13 04:41:49.347 [WARN ] [ore.internal.events.OSGiEventManager] - Dispatching event to subscriber ‘org.openhab.core.events.internal.EventBridge@faa03’ takes more than 5000ms.
    2018-02-13 04:49:59.832 [ERROR] [ntime.internal.engine.RuleEngineImpl] - Rule ‘Serial_control’: An error occurred during the script execution: Java heap space
    2018-02-13 04:50:50.931 [WARN ] [ore.internal.events.OSGiEventManager] - Dispatching event to subscriber ‘org.eclipse.smarthome.core.autoupdate.internal.AutoUpdateBinding@d8b9ab’ takes more than 5000ms.
    2018-02-13 04:52:39.310 [WARN ] [ore.internal.events.OSGiEventManager] - Dispatching event to subscriber ‘org.eclipse.smarthome.core.autoupdate.internal.AutoUpdateBinding@d8b9ab’ takes more than 5000ms.
    2018-02-13 04:55:36.181 [ERROR] [ntime.internal.engine.RuleEngineImpl] - Rule ‘Serial_control’: An error occurred during the script execution: Java heap space
    2018-02-13 04:59:04.131 [ERROR] [ntime.internal.engine.RuleEngineImpl] - Rule ‘Serial_control’: An error occurred during the script execution: Java heap space
    2018-02-13 05:09:03.026 [ERROR] [ntime.internal.engine.RuleEngineImpl] - Rule ‘Serial_control’: An error occurred during the script execution: Java heap space
    2018-02-13 05:10:01.273 [WARN ] [ore.internal.events.OSGiEventManager] - Dispatching event to subscriber ‘org.eclipse.smarthome.core.thing.internal.CommunicationManager@1403428’ takes more than 5000ms.
    2018-02-13 05:09:21.721 [ERROR] [org.apache.felix.fileinstall ] - In main loop, we have serious trouble
    java.lang.OutOfMemoryError: Java heap space
    2018-02-13 05:11:49.868 [WARN ] [ore.internal.events.OSGiEventManager] - Dispatching event to subscriber ‘org.eclipse.smarthome.core.autoupdate.internal.AutoUpdateBinding@d8b9ab’ takes more than 5000ms.
    2018-02-13 05:12:41.183 [WARN ] [ore.internal.events.OSGiEventManager] - Dispatching event to subscriber ‘org.eclipse.smarthome.core.autoupdate.internal.AutoUpdateBinding@d8b9ab’ takes more than 5000ms.
    2018-02-13 05:13:07.204 [WARN ] [ore.internal.events.OSGiEventManager] - Dispatching event to subscriber ‘org.eclipse.smarthome.core.autoupdate.internal.AutoUpdateBinding@d8b9ab’ takes more than 5000ms.
    2018-02-13 05:13:45.762 [WARN ] [ore.internal.events.OSGiEventManager] - Dispatching event to subscriber ‘org.eclipse.smarthome.model.rule.runtime.internal.engine.RuleEngineImpl@ba51cc’ takes more than 5000ms.
    2018-02-13 05:14:18.157 [WARN ] [ore.internal.events.OSGiEventManager] - Dispatching event to subscriber ‘org.eclipse.smarthome.core.autoupdate.internal.AutoUpdateBinding@d8b9ab’ takes more than 5000ms.
    2018-02-13 05:15:59.473 [WARN ] [ore.internal.events.OSGiEventManager] - Dispatching event to subscriber ‘org.eclipse.smarthome.core.autoupdate.internal.AutoUpdateBinding@d8b9ab’ takes more than 5000ms.
    2018-02-13 05:17:10.484 [WARN ] [ore.internal.events.OSGiEventManager] - Dispatching event to subscriber ‘org.eclipse.smarthome.core.internal.items.ItemUpdater@1854553’ takes more than 5000ms.
    2018-02-13 05:17:22.959 [WARN ] [ore.internal.events.OSGiEventManager] - Dispatching event to subscriber ‘org.eclipse.smarthome.core.autoupdate.internal.AutoUpdateBinding@d8b9ab’ takes more than 5000ms.
    2018-02-13 05:18:07.696 [WARN ] [ore.internal.events.OSGiEventManager] - Dispatching event to subscriber ‘org.eclipse.smarthome.core.thing.internal.CommunicationManager@1403428’ takes more than 5000ms.
    2018-02-13 05:19:05.304 [WARN ] [ore.internal.events.OSGiEventManager] - Dispatching event to subscriber ‘org.eclipse.smarthome.core.autoupdate.internal.AutoUpdateBinding@d8b9ab’ takes more than 5000ms.
    2018-02-13 05:20:02.641 [WARN ] [ore.internal.events.OSGiEventManager] - Dispatching event to subscriber ‘org.eclipse.smarthome.core.autoupdate.internal.AutoUpdateBinding@d8b9ab’ takes more than 5000ms.
    2018-02-13 05:23:36.236 [WARN ] [ore.internal.events.OSGiEventManager] - Dispatching event to subscriber ‘org.eclipse.smarthome.core.autoupdate.internal.AutoUpdateBinding@d8b9ab’ takes more than 5000ms.
    2018-02-13 05:25:05.895 [WARN ] [ore.internal.events.OSGiEventManager] - Dispatching event to subscriber ‘org.openhab.core.events.internal.EventBridge@faa03’ takes more than 5000ms.
    2018-02-13 05:28:41.396 [WARN ] [ore.internal.events.OSGiEventManager] - Dispatching event to subscriber ‘org.eclipse.smarthome.core.internal.items.ItemUpdater@1854553’ takes more than 5000ms.
    2018-02-13 05:36:14.701 [ERROR] [ntime.internal.engine.RuleEngineImpl] - Rule ‘Serial_control’: An error occurred during the script execution: Java heap space
    2018-02-13 05:37:24.600 [WARN ] [ore.internal.events.OSGiEventManager] - Dispatching event to subscriber ‘org.eclipse.smarthome.core.thing.internal.CommunicationManager@1403428’ takes more than 5000ms.
    2018-02-13 05:45:32.716 [ERROR] [ntime.internal.engine.RuleEngineImpl] - Rule ‘Serial_control’: An error occurred during the script execution: Java heap space
    2018-02-13 05:46:11.438 [WARN ] [ore.internal.events.OSGiEventManager] - Dispatching event to subscriber ‘org.eclipse.smarthome.core.internal.items.ItemUpdater@1854553’ takes more than 5000ms.
    2018-02-13 05:51:50.352 [WARN ] [ore.internal.events.OSGiEventManager] - Dispatching event to subscriber ‘org.eclipse.smarthome.core.internal.items.ItemUpdater@1854553’ takes more than 5000ms.
    2018-02-13 05:58:37.431 [WARN ] [ore.internal.events.OSGiEventManager] - Dispatching event to subscriber ‘org.eclipse.smarthome.core.internal.items.ItemUpdater@1854553’ takes more than 5000ms.
    2018-02-13 06:02:10.700 [ERROR] [ntime.internal.engine.RuleEngineImpl] - Rule ‘Serial_control’: An error occurred during the script execution: Java heap space
    2018-02-13 06:42:32.509 [ERROR] [ntime.internal.engine.RuleEngineImpl] - Rule ‘Serial_control’: An error occurred during the script execution: Java heap space
    2018-02-13 06:50:41.323 [WARN ] [ore.internal.events.OSGiEventManager] - Dispatching event to subscriber ‘org.openhab.core.events.internal.EventBridge@faa03’ takes more than 5000ms.
    2018-02-13 06:53:31.787 [WARN ] [ore.internal.events.OSGiEventManager] - Dispatching event to subscriber ‘org.eclipse.smarthome.core.internal.items.ItemUpdater@1854553’ takes more than 5000ms.
    2018-02-13 06:55:12.741 [WARN ] [ore.internal.events.OSGiEventManager] - Dispatching event to subscriber ‘org.eclipse.smarthome.core.internal.items.ItemUpdater@1854553’ takes more than 5000ms.
    2018-02-13 07:17:27.350 [WARN ] [ore.internal.events.OSGiEventManager] - Dispatching event to subscriber ‘org.openhab.core.events.internal.EventBridge@faa03’ takes more than 5000ms.
    2018-02-13 07:23:01.006 [WARN ] [ore.internal.events.OSGiEventManager] - Dispatching event to subscriber ‘org.eclipse.smarthome.core.internal.items.ItemUpdater@1854553’ takes more than 5000ms.
    2018-02-13 07:43:10.801 [WARN ] [ore.internal.events.OSGiEventManager] - Dispatching event to subscriber ‘org.eclipse.smarthome.core.internal.items.ItemUpdater@1854553’ takes more than 5000ms.
    2018-02-13 07:47:54.338 [WARN ] [e.jetty.util.thread.QueuedThreadPool] - java.lang.OutOfMemoryError: Java heap space

Are you sure your serial connection is working on the RPi ?
As far as I concern, serial connections from Java require some preparation to the JVM installation.

First there are some problem in the rule-definition:

statePowModeIn=PowModeIn.state.toString()
statePowLitNIn=PowLitNIn.state.toString()
statePowLitDIn=PowLitDIn.state.toString()
statePowFulDIn=PowFulDIn.state.toString()
statePowFulNIn=PowFulNIn.state.toString()
statePowTMaxIn=PowTMaxIn.state.toString()

Type mismatch: type String is not applicable at this location

i=null
j=null
y=null
_len=null

Type mismatch: cannot convert from null to int

First:
I’ve seen you used untyped variables:

var statePowModeIn

Even if this may work I suppose to use

var String statePowModeIn

Second:
You try to make assignments to these variables in a rule triggered by “System started”. You may imply that at the time this rule fires all binding and item initialization is already done - but this is not the case. There are some other threads here regarding the system startup behavior.
So you should be aware that you always have to deal with situations when an item is not yet updated with it’s initial state rather from the binding nor from the persistence layer (restore on startup).

To track down the problems I would deactivate (move away) all rules and ensure that the system comes up and the items are updated by the binding (see /var/log/openhab2/event.log). Then the rules can be enabled stepwise.

Yes, Serial connector work fine! Сommunication through it is quite intense