openhab / openhab-linuxpkg

Repo for Linux packages
Eclipse Public License 2.0
18 stars 33 forks source link

nrjavaserial in OH2.5 #171

Closed mstormi closed 4 years ago

mstormi commented 4 years ago

OH 2.5 on Java 11 is suspected to fail on using the serial interface because of an older version of the nrjavaserial library to cause this. While a newer fixed version of the lib exists -confirmed to work with OH3-, unfortunately as the OH core is frozen this will not be put to use with OH 2.5 any more by means of OH packages. @wborn has provided a "back-versioned" nrjavaserial to work with 2.5 at https://github.com/wborn/nrjavaserial/releases/download/reversioned521/nrjavaserial-3.15.0.OH2.jar but AFAIK it has not yet found its way into 2.5 where we're just asking people to test-drive Java 11.

I'd like you to include this with the current OH2.5 packages.

FWIW, here's my openhabian script sniplet.

But I think you could simply replace the jar at its location.

## switch nrjavaserial lib used in openHAB
## arguments "backport", "orig"
##
select_nrjavaserial() {
  local pass=habopen
  local client=${OPENHAB_RUNTIME}/bin/client
  local url=https://github.com/wborn/nrjavaserial/releases/download/reversioned521/nrjavaserial-3.15.0.OH2.jar
  local location=/usr/share/openhab2/runtime/system/org/openhab/nrjavaserial/3.15.0.OH2
  local origbundle=nrjavaserial-3.15.0.OH2.jar
  local newbundle=nrjavaserial-3.15.0.OH2-wborn.jar

  if [[ "$1" == "backport" ]]; then
    wget -O "${location}/${newbundle}" "${url}"
    cmd="bundle:update $id file:${location}/${newbundle}"
  elif [[ "$1" == "orig" ]]; then
    cmd="bundle:update $id file:${location}/${origbundle}"
  fi
  id=$($client -p "$pass" "bundle:list | grep nrjavaserial" | tail -1|cut -d' ' -f1)
  $client -p "$pass" "$cmd"
}
wborn commented 4 years ago

AFAIK it only crashes with Java 11 on Windows (https://github.com/openhab/openhab-core/issues/1384).

nrjavaserial 5.2.1 has a file descriptor leak https://github.com/NeuronRobotics/nrjavaserial/issues/111 so instead increasing stability you might decrease it with this new version. :wink:

mstormi commented 4 years ago

Ooookay ... so is OH 2.5 to crash on LINUX Java 11 due to serial fake news or worth pursuing ?

wborn commented 4 years ago

It might be a misinterpretation of words if it's based on this comment by @J-N-K who uses Windows IIRC.

mstormi commented 4 years ago

No @J-N-K told me in further private communication that it's about Windows only and that he has no knowledge about crashes on Linux. But I thought I read it elsewhere, too. So Wouter you also are not aware of Linux serial crashes/exceptions ?

wborn commented 4 years ago

I have never seen nrjavaserial crash on Linux with Java 11. So it would be nice to know who did see it crash and what JVM/architecture/OS/32|64-bit combo this is.

mstormi commented 4 years ago

ok so I'll put this issue here on hold. Should we get feedback as part of our Java testdrive then I'll let you know.