C-Gate out of memory exception

Discussion in 'C-Bus Toolkit and C-Gate Software' started by cmlp, Jun 20, 2017.

  1. cmlp

    cmlp

    Joined:
    Feb 5, 2008
    Messages:
    32
    Likes Received:
    2
    Location:
    Melbourne, Australia.
    Hi,

    I'm seeing an out of memory exception with C-Gate v2.11.1 (build 3240).

    Host: Raspberry Pi v3 (also on a v2)
    JDK: openjdk-8-jre-headless:armhf 8u40~b04-2 armhf OpenJDK Java runtime, using Hotspot Zero (headless)

    Code:
    20170620-213549 702 //26NICH/254/56 737a0700-37da-1035-a0c1-f4e44d31cc89 [lighting] loaded application
    20170620-213549 702 //26NICH/254/56 737a0700-37da-1035-a0c1-f4e44d31cc89 [lighting] automatic phantom group created at address 28
    20170620-213549 730 //26NICH/254/56/28 737f1010-37da-1035-a0e1-f4e44d31cc89 new level=0 sourceunit=7 ramptime=0
    Exception in thread "CmdSocket.console" java.lang.OutOfMemoryError: Java heap space
    	at java.util.Arrays.copyOf(Arrays.java:3332)
    	at java.lang.AbstractStringBuilder.expandCapacity(AbstractStringBuilder.java:137)
    	at java.lang.AbstractStringBuilder.ensureCapacityInternal(AbstractStringBuilder.java:121)
    	at java.lang.AbstractStringBuilder.append(AbstractStringBuilder.java:569)
    	at java.lang.StringBuffer.append(StringBuffer.java:369)
    	at java.io.BufferedReader.readLine(BufferedReader.java:370)
    	at java.io.BufferedReader.readLine(BufferedReader.java:389)
    	at gR.run(ProGuard:248)
    	at java.lang.Thread.run(Thread.java:745)
    
    I have tried upping the heap space with -Xmx1024m and -Xms1024m etc but then the process gets killed by the linux reaper! No exception occurs before that though, but that's not very helpful. There might be a sweet spot where the heap is big enough and the process can live.

    This didn't occur previously with openjdk-7 and earlier versions of c-gate (v2.10.6 etc).

    C-gate seems to keep running after the exception, so I'm not sure if this is critical or not.

    I do find that connection to the PCI is lost and can't be re-established without a reboot after a few days with this version also, at least on the Pi v2. I've swapped to a v3 to see if this makes any difference.

    cmlp
     
    cmlp, Jun 20, 2017
    #1
  2. cmlp

    DarylMc

    Joined:
    Mar 24, 2006
    Messages:
    1,308
    Likes Received:
    49
    Location:
    Cleveland, QLD, Australia
    cmlp
    That is a fairly new version of CGate.
    I've been using 2.11.0 3233 with PI3 and Oracle Java 8 for some weeks with no problem so far.
     
    Last edited by a moderator: Jun 21, 2017
    DarylMc, Jun 20, 2017
    #2
  3. cmlp

    DarylMc

    Joined:
    Mar 24, 2006
    Messages:
    1,308
    Likes Received:
    49
    Location:
    Cleveland, QLD, Australia
    DarylMc, Jun 20, 2017
    #3
  4. cmlp

    DarylMc

    Joined:
    Mar 24, 2006
    Messages:
    1,308
    Likes Received:
    49
    Location:
    Cleveland, QLD, Australia
    cmlp
    I loaded CGate exe 2.11.1 onto PI3.
    It seems to be working fine but might take a while to see if any problems pop up.

    How do you get your project database onto the remote CGate?
    I use Toolkit to do it.

    Might be worth mentioning CGate 2.11.1 release notes say it is only compatible with the very latest Toolkit.
     
    DarylMc, Jun 21, 2017
    #4
  5. cmlp

    cmlp

    Joined:
    Feb 5, 2008
    Messages:
    32
    Likes Received:
    2
    Location:
    Melbourne, Australia.
    I'm copying the XML file directly into the cgate tag directory. I am not using Toolkit at all.

    The exception appears within a few minutes (with default heap size), but seems to be delayed further with increasing heaps size specification.

    Which JDK are you using?
     
    cmlp, Jun 21, 2017
    #5
  6. cmlp

    DarylMc

    Joined:
    Mar 24, 2006
    Messages:
    1,308
    Likes Received:
    49
    Location:
    Cleveland, QLD, Australia
    Code:
    sudo apt-get install oracle-java8-jdk
    https://www.raspberrypi.org/blog/oracle-java-on-raspberry-pi/
    There is info in the comments if you are going to install over open java.

    CGate 2.11.0 and 2.11.1 use java8
    Previous to that I was using CGate 2.10.2 and java7

    Then following these instructions http://addictedtopi.tumblr.com/post/96351714013/installing-c-gate-on-a-raspberry-pi
    I skip the first bit because I am using a CNI.

    This is unrelated but which CBus interface are you using?
    Just wondering what other people have set up.

    Regarding your xml I presume that is one you created earlier with Toolkit?
    There is a lot of info in there and I've been a bit scared to just copy it over to a different platform.
    Mainly because I don't know any better.

    I just looked through CGate logs and didn't see any similar error.
    Homebridge is running on the PI as well and it all seems to be running OK.
    Will let you know if CGate has any trouble staying connected.
     
    Last edited by a moderator: Jun 21, 2017
    DarylMc, Jun 21, 2017
    #6
  7. cmlp

    DarylMc

    Joined:
    Mar 24, 2006
    Messages:
    1,308
    Likes Received:
    49
    Location:
    Cleveland, QLD, Australia
    CGate 2.11.1 is still running nicely.
    It has taken me 4 years to get around to doing it but CGate on Pi seems to work very well.
    I've tried a few different CGate versions recently on the Pi 3 and all have been really solid.

    I don't know enough to say for sure but I think your recent problems could be due to open java or the XML file.
    I'm testing in my office with 9 CBus units and only 10 group addresses.
    Obviously the traffic is not so high and that may be something to consider.
    Tomorrow I will check it out at a larger site.

    I don't know how much this matters but CGate manual says not to use a number at the start of a project name.
     
    Last edited by a moderator: Jun 23, 2017
    DarylMc, Jun 23, 2017
    #7
  8. cmlp

    cmlp

    Joined:
    Feb 5, 2008
    Messages:
    32
    Likes Received:
    2
    Location:
    Melbourne, Australia.
    The exception occurs early after launch, but c-gate keeps running afterward, so it's hard to tell if it really matters or not.
     
    cmlp, Jun 24, 2017
    #8
  9. cmlp

    cmlp

    Joined:
    Feb 5, 2008
    Messages:
    32
    Likes Received:
    2
    Location:
    Melbourne, Australia.
    Which java package are you using?

    [Edit: oops, see you posted that above, thanks].

    Interesting given that Toolkit created the network for me originally!
     
    cmlp, Jun 24, 2017
    #9
  10. cmlp

    cmlp

    Joined:
    Feb 5, 2008
    Messages:
    32
    Likes Received:
    2
    Location:
    Melbourne, Australia.
    I'm using a PCI and then ser2net to provide a TCP interface to /dev/ttyUSB0.

    Yes.

    I didn't know any better and tried a few years ago and it worked fine ever since. Until I upgraded recently, that is!

    Yes, I'm running homebridge too. All was good prior to upgrading c-gate and openjdk, so the issue is int here somewhere. No big deal, it's only for fun at home. No customers to please except the family :)
     
    cmlp, Jun 24, 2017
    #10
  11. cmlp

    DarylMc

    Joined:
    Mar 24, 2006
    Messages:
    1,308
    Likes Received:
    49
    Location:
    Cleveland, QLD, Australia
    I was talking to CIS tech support recently and they also said it is ok to copy and use the windows project xml.
     
    DarylMc, Jul 5, 2017
    #11
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.