• Recent
    • Tags
    • Popular
    • Register
    • Login

    Please Note This forum exists for community support for the Mango product family and the Radix IoT Platform. Although Radix IoT employees participate in this forum from time to time, there is no guarantee of a response to anything posted here, nor can Radix IoT, LLC guarantee the accuracy of any information expressed or conveyed. Specific project questions from customers with active support contracts are asked to send requests to support@radixiot.com.

    Radix IoT Website Mango 3 Documentation Website Mango 4 Documentation Website Mango 5 Documentation Website

    Out of memory problem

    User help
    5
    13
    2.4k
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • terrypackerT
      terrypacker
      last edited by

      @petermcs please run jmap -histo pid to get the object count.

      1 Reply Last reply Reply Quote 0
      • TurboT
        Turbo
        last edited by

        Okay:

        Here's some stuff related to this after going through this:

        I just upgraded to Mango 3.6.5 running on our production server. We use persistent TCP to haul data back from outstations monitoring solar assets, and it works Very Well.

        However, there's a couple of things that popped up after the upgrade. We've identified (2) separate issues:

        Issue (1): Reporting tool causes Mango to run out of memory and crash itself. Mango apparently doesn't check these things internally, so if you run out of Ram, it just merrily gobbles it all up and blows up. We have a spreadsheet that's about 8 megs, that loads an additional meg of data from Mango, and then reports it out again. Running this spreadsheet uses 1500 megs of ram, according to the Mango's internal JVM free memory.

        We fixed this by setting the -Xms5g and -Xmx5g via the "memory-medium.sh". However, if we have more than one of two of those reports ran at the same time, the system will still Blow Up. So, I'd like to see Mango either (1) do something to manage these reports, if it means slowing them down or something to not eat that much memory, or (2) at least crash elegantly: When this occurs with our system, the thing completely shuts down, and then does not re-start itself. I'd rather the reporting tool not crash the system, but if it does, it'd be nice to recover gracefully. As a solution to this, we're going to keep jacking up -Xms and -Xmx until we run out of memory on our servers, then we'll do something else.

        Issue (2), And maybe this is a different thread:
        Mango opens LOTS of files. At night, when the outstations are set to synchronize historic back to our cloud server, we see >100,000 files open, as reported by pmap. This normally is ~1000, but at night, when the historical syncs happen, that number jumps by a lot. This causes a Java fault, as the thing bumps against the available files.

        We increased the max file limit by doing
        vm.max_map_count=131060
        to /etc/sysctl.conf

        and restarting.

        We're still regularly getting >100k open files, but at least now Java doesn't crash out. We have the tsdb running out our instance, and something must have changed between 3.5 and 3.6 to how this is done, as we haven't changed any settings that would cause additional data to be written via the persistent publisher.

        Just letting people know here about the work we did on this. Is there some way in Mango to limit the number of open files it does on a historical sync? My concern here is that as I add more sites (and keep historical sync active, to force the system to catch up on any weird outages that happen during the day as is common with cell-connected systems), this file open issue is going to increasingly get bigger and bigger. Did I miss something here about the best way to do this?

        Cheers,
        -Greg Linder

        1 Reply Last reply Reply Quote 0
        • TurboT
          Turbo
          last edited by Turbo

          Also:

          For those of you running into memory problems in Mango:

          Since the JVM doesn't ever "give memory back" to the operating system, whatever you set those -Xms and -Xmx to will be about what the JVM will take. once it reaches that Max of that, you will NEVER see that memory returned to the system unless you restart the JVM.

          Our system, when running reports, cranks right up to the limit, and then sits there. If you see CPU utilization pegged high, but the system in unresponsive, it's possible that the JVM has maxed out it's available memory (partially defined by -Xms and -Xmx settings), and the JVM is cranking around it's jobs trying to get your work done without anything getting actually complete.

          1 Reply Last reply Reply Quote 0
          • CraigWebC
            CraigWeb
            last edited by CraigWeb

            Hi Greg

            I think it will be helpful to know how large your system is. How many points and which database are you using. H2 or MySQL?

            @turbo said in Out of memory problem:

            Just letting people know here about the work we did on this. Is there some way in Mango to limit the number of open files it does on a historical sync? My concern here is that as I add more sites (and keep historical sync active, to force the system to catch up on any weird outages that happen during the day as is common with cell-connected systems), this file open issue is going to increasingly get bigger and bigger. Did I miss something here about the best way to do this?

            I would consider running the sync more often, I have been using a cron pattern of every 5 minutes
            and have not run into any issue with it. However, I have no idea how much data you are logging.
            Also, have you enabled "save real-time data" on the data source? This could be why the sync needs to open so many files.

            The current recommended way to run mango as a service does lack the ability to restart after crashing. Are you running Ubuntu or debian? Some work has been done on a new service script which you could use.

            1 Reply Last reply Reply Quote 0
            • terrypackerT
              terrypacker
              last edited by

              @Turbo

              Here is some general information on what you see, and I have been tracking these known problems for some time trying to find a solution.

              1. Excel Reports Module can use up all the JVM memory.

              This is mostly out of our control and a known problem with the Apache POI library that is the backbone of that module. They have recently released a more performant version that will eventually be part of our Excel Reports module. We have reworked our REST api using a new algorithm to manage memory that will in the not-to-distant future be ported over to the ExcelReports module and should solve all of the problems outside of the POI library limitations.

              1. Open Files - MangoNoSQL
                The time series database will open many files and leave them open for some time, they eventually do get closed but for performance reasons we don't close them immediately after use. As @CraigWeb mentioned better tuning can help during intense syncs. As for the problem being worse in 3.6, I was not aware of that and can confirm that the logic for opening and closing the files has not changes. It is likely that you system is just getting larger and you are now aware that this happens. There are a whole slew of settings for very large systems in the env.properties file with the prefix: db.nosql.*. I don't have time to go into them all here but I would suggest experimenting with them and posting questions about specific properties later.

              As for the JVM general memory use:

              We are starting to use Adopt OpenJDK 13 and are finding that it is much better at memory management. As for the -Xms and -Xmx settings, depending what you are trying to achieve they may not be ideal. By setting both to the same value you get a fully allocated JVM at startup which on a machine only running Mango is likely ideal. But for a system with other processes that need memory at other times the JVM cannot release memory with that configuration. We have found that on a very large machine using Adopt OpenJDK it is quite good expanding and contracting the JVM memory use for Mango's needs. But we are still evaluating the best configuration for it at this point.

              1 Reply Last reply Reply Quote 0
              • TurboT
                Turbo
                last edited by

                Greetings, all:

                Thanks for the answers here. I appreciate the clarity on this.

                As for "Sync every five minutes" vs "save real-time data"-- I'm a bit unclear on how these options interact with each other.

                I'd like to get all the data that my systems in the field are logging. The points out there are set with different poll and logging settings. So if I set to "sync every 5 minutes" (or something similar), does that mean that my data points will update every 5 minutes with the logged data? Vs the "save real time data" that saves all the data that comes in from every poll?

                Is that the proper way of using those options?

                Cheers,
                -Greg

                1 Reply Last reply Reply Quote 0
                • cbyrneC
                  cbyrne
                  last edited by

                  @terrypacker Hi Terry, I am just continuing @petermcs's work and have the jmap -hist outputs.

                  Before:

                   num     #instances         #bytes  class name
                  ----------------------------------------------
                     1:        173771      715822488  [I
                     2:       3748110      508063720  [C
                     3:       1945314      443221056  [B
                     4:       1733728       41609472  java.lang.String
                     5:       1973991       37379904  [Ljava.lang.Class;
                     6:        478710       23272440  [Ljava.lang.Object;
                     7:             1       16777232  [Lorg.h2.util.CacheObject;
                     8:        151493       11321608  [Ljava.util.HashMap$Node;
                     9:        228571       10971408  java.util.HashMap
                    10:        168383       10776512  java.net.URL
                    11:        318951       10206432  java.util.HashMap$Node
                    12:         99723        9573408  java.util.jar.JarFile$JarFileEntry
                    13:        101097        8896536  java.lang.reflect.Method
                    14:         99443        7955440  java.util.zip.ZipEntry
                    15:        194720        7788800  java.util.LinkedHashMap$Entry
                    16:        262144        6291456  org.apache.logging.log4j.core.async.AsyncLoggerConfigDisruptor$Log4jEventWrapper
                    17:        107562        6023472  java.util.LinkedHashMap
                    18:        211916        5085984  java.lang.StringBuilder
                    19:        155322        4970304  java.util.LinkedHashMap$LinkedEntryIterator
                    20:        132436        4237952  java.util.ArrayList$Itr
                    21:        106631        4096384  [Ljava.lang.String;
                    22:         48305        3915312  [S
                    23:        103984        3635760  [Ljava.lang.reflect.Method;
                    24:        148571        3565704  java.util.ArrayList
                    25:        145630        3495120  org.springframework.core.annotation.AnnotationUtils$AnnotationCacheKey
                    26:        213448        3415168  java.util.HashSet
                    27:         57295        3208520  org.springframework.asm.Label
                    28:          5081        3195656  [J
                    29:         37779        3022320  java.lang.reflect.Constructor
                    30:         89701        2870432  java.io.File
                    31:         59175        2840400  java.nio.HeapByteBuffer
                    32:        168665        2698640  java.lang.Integer
                    33:         16617        2641896  [Lorg.springframework.asm.Label;
                    34:         73858        2363456  java.util.concurrent.ConcurrentHashMap$Node
                    35:         89469        2147256  java.lang.Class$MethodArray
                    36:         44728        2146944  org.springframework.core.ResolvableType
                    37:         81522        1956528  java.util.LinkedList$Node
                    38:         32363        1812328  org.springframework.asm.SymbolTable$Entry
                    39:         15886        1783136  java.lang.Class
                    40:         52571        1682272  java.util.LinkedHashMap$LinkedKeyIterator
                    41:         22174        1596528  org.springframework.core.annotation.AnnotationAttributes
                    42:         32146        1543008  org.springframework.util.ConcurrentReferenceHashMap$SoftEntryReference
                    43:         57998        1391952  java.util.concurrent.CopyOnWriteArrayList$COWIterator
                    44:         42207        1350624  org.springframework.asm.Type
                    45:         29777        1191080  java.lang.ref.Finalizer
                    46:         36791        1177312  java.util.AbstractList$Itr
                    47:         65801        1052816  sun.reflect.ConstantPool
                    48:          9550         993200  sun.net.www.protocol.file.FileURLConnection
                    49:         19600         940800  org.springframework.asm.Frame
                    50:         22090         883600  com.serotonin.bacnet4j.util.sero.ByteQueue
                    51:         37028         864280  [Ljava.lang.reflect.Type;
                    52:         35583         853992  org.springframework.asm.Edge
                    53:          1968         826856  [Ljava.util.concurrent.ConcurrentHashMap$Node;
                    54:         25594         819008  java.util.concurrent.locks.AbstractQueuedSynchronizer$Node
                    55:         50928         814848  java.lang.Object
                    56:         25147         804704  java.util.LinkedHashMap$LinkedValueIterator
                    57:         24671         789472  java.util.LinkedList
                    58:         49091         785456  org.springframework.core.annotation.AnnotationUtils$DefaultValueHolder
                    59:         13853         775768  org.springframework.core.type.classreading.MethodMetadataReadingVisitor
                    60:         13740         769440  jdk.internal.org.objectweb.asm.Item
                    61:         31486         755664  java.util.Arrays$ArrayList
                    62:         46717         747472  java.util.LinkedHashSet
                    63:         17178         687120  java.lang.invoke.MethodType
                    64:          9400         676800  java.lang.reflect.Field
                    65:         27985         671640  sun.reflect.generics.tree.SimpleClassTypeSignature
                    66:         26545         637080  sun.reflect.generics.visitor.Reifier
                    67:          2806         628544  org.springframework.asm.MethodWriter
                    68:         11198         627088  java.lang.invoke.LambdaFormEditor$Transform
                    69:         24021         576504  sun.reflect.generics.factory.CoreReflectionFactory
                    70:         23902         573648  sun.reflect.generics.parser.SignatureParser
                    71:         10093         565208  java.util.zip.ZipFile$ZipFileInputStream
                    72:         10089         564984  java.util.zip.ZipFile$ZipFileInflaterInputStream
                    73:         23307         559368  sun.reflect.generics.scope.ClassScope
                    74:         17324         554368  java.lang.invoke.MethodType$ConcurrentWeakInternSet$WeakEntry
                    75:         13514         540560  java.util.HashMap$KeyIterator
                    76:         16637         532384  java.lang.ref.WeakReference
                    77:         13288         531520  java.util.HashMap$EntryIterator
                    78:          6026         530288  sun.net.www.protocol.jar.JarURLConnection
                    79:         16281         520992  java.util.RegularEnumSet
                    80:         31992         511872  java.util.LinkedHashMap$LinkedKeySet
                    81:         18654         507960  [Ljava.lang.annotation.Annotation;
                    82:         15760         504320  org.springframework.util.ConcurrentReferenceHashMap$1
                    83:         30116         498104  [Lsun.reflect.generics.tree.TypeArgument;
                    84:          7673         491072  org.springframework.core.MethodParameter
                    85:          5066         486336  sun.net.www.protocol.jar.URLJarFile$URLJarFileEntry
                    86:         14914         477248  java.util.LinkedList$ListItr
                    87:          5921         476640  [Ljava.util.WeakHashMap$Entry;
                    88:          7171         458944  com.serotonin.timer.OrderedTaskInfo
                    89:           394         452912  [Lorg.springframework.asm.SymbolTable$Entry;
                    90:         18617         446808  org.springframework.core.annotation.AnnotatedElementUtils$MergedAnnotationAttributesProcessor
                    91:         27787         444592  sun.reflect.generics.tree.ClassTypeSignature
                    92:         11069         442760  sun.nio.cs.UTF_8$Decoder
                    93:          6897         441408  java.util.regex.Matcher
                    94:         13780         440960  org.springframework.core.annotation.AnnotationUtils$$Lambda$48/1194398327
                    95:          5356         428480  sun.net.www.protocol.jar.URLJarFile
                    96:          7588         424928  com.serotonin.bacnet4j.npdu.NPCI
                    97:         19494         420832  [Lorg.springframework.asm.Type;
                    98:         12977         415264  java.lang.reflect.WeakCache$CacheKey
                    99:         17180         412320  org.springframework.security.access.method.DelegatingMethodSecurityMetadataSource$DefaultCacheKey
                   100:         12269         392608  java.util.Hashtable$Entry
                  
                  Total      16594285     2034054440
                  
                  

                  After opening a browser window and logging in, greeted by the admin page and an immediate "connectivity lost, restoring connection" toast message that never permenantly resolves.
                  It then takes about 3-5 minutes to max out

                  
                   num     #instances         #bytes  class name
                  ----------------------------------------------
                     1:      51017979     3130737016  [C
                     2:      51017618     1224422832  java.lang.String
                     3:      10175891      895478408  com.serotonin.m2m2.rt.event.EventInstance
                     4:      20380459      550396632  [Ljava.lang.Object;
                     5:      20352135      488451240  com.serotonin.m2m2.i18n.TranslatableMessage
                     6:      10175862      325627584  com.serotonin.m2m2.rt.event.type.DataSourceEventType
                     7:        469887      198080400  [B
                     8:       1599229       87706096  [Lorg.h2.value.Value;
                     9:       1248203       39942496  org.h2.result.RowImpl
                    10:        425490       30635280  org.h2.value.ValueLobDb
                    11:        828920       26525440  org.h2.result.SimpleRowValue
                    12:             1       16777232  [Lorg.h2.util.CacheObject;
                    13:         45454       15596376  [I
                    14:         31155       12509192  [J
                    15:        438464        7015424  org.h2.value.ValueInt
                    16:        265342        6368208  org.h2.value.ValueLong
                    17:        262144        6291456  org.apache.logging.log4j.core.async.AsyncLoggerConfigDisruptor$Log4jEventWrapper
                    18:         30244        5475296  [Lorg.h2.result.Row;
                    19:         85336        3413440  java.util.LinkedHashMap$Entry
                    20:          2874        3363200  [Lorg.h2.result.SearchRow;
                    21:         30243        3145272  org.h2.index.PageDataLeaf
                    22:         28393        2498584  java.lang.reflect.Method
                    23:         28704        2297592  [Ljava.util.HashMap$Node;
                    24:         66713        2134816  java.util.HashMap$Node
                    25:         60656        1940992  java.util.concurrent.ConcurrentHashMap$Node
                    26:         16839        1888904  java.lang.Class
                    27:         23457        1313592  java.util.LinkedHashMap
                    28:         33277        1064864  org.h2.store.Data
                    29:           608         741064  [Ljava.util.concurrent.ConcurrentHashMap$Node;
                    30:          8489         611208  org.springframework.core.annotation.AnnotationAttributes
                    31:         26206         593480  [Ljava.lang.Class;
                    32:          7131         513432  java.lang.reflect.Field
                    33:         31170         498720  java.lang.Object
                    34:         10792         476208  [Ljava.lang.String;
                    35:         18951         454824  java.util.ArrayList
                    36:          9363         449424  java.util.HashMap
                    37:         15410         369840  org.springframework.security.access.method.DelegatingMethodSecurityMetadataSource$DefaultCacheKey
                    38:          4273         341840  java.lang.reflect.Constructor
                    39:          9479         303328  java.util.LinkedList
                    40:          9008         288256  java.util.Hashtable$Entry
                    41:         11579         277896  java.util.LinkedList$Node
                    42:         17155         274480  org.springframework.core.annotation.AnnotationUtils$DefaultValueHolder
                    43:         11080         265920  org.h2.value.ValueRow
                    44:          2851         228080  org.h2.index.PageBtreeLeaf
                    45:          4539         181560  java.lang.ref.SoftReference
                    46:          2998         167888  java.lang.Class$ReflectionData
                    47:         10089         161424  java.util.LinkedHashMap$LinkedEntrySet
                    48:          9949         159184  java.util.LinkedHashSet
                    49:          3796         151840  javax.servlet.jsp.tagext.TagAttributeInfo
                    50:          2614         146384  java.lang.invoke.MemberName
                    51:          6080         145920  java.util.jar.Attributes$Name
                    52:          5878         141072  sun.reflect.generics.tree.SimpleClassTypeSignature
                    53:          3514         140560  java.util.TreeMap$Entry
                    54:          2734         140264  [Ljava.lang.reflect.Method;
                    55:             4         131136  [Ljava.util.concurrent.ForkJoinTask;
                    56:          1807         130104  org.springframework.web.method.HandlerMethod$HandlerMethodParameter
                    57:          3164         126560  jdk.nashorn.internal.runtime.CompiledFunction
                    58:          2488         119424  org.springframework.core.ResolvableType
                    59:          1796         114944  java.net.URL
                    60:          5878         109584  [Lsun.reflect.generics.tree.TypeArgument;
                    61:          1890         105840  jdk.nashorn.internal.runtime.ScriptFunction
                    62:           488         105720  [Ljava.util.Hashtable$Entry;
                    63:          4046          97104  sun.reflect.annotation.AnnotationInvocationHandler
                    64:          1483          94912  java.util.concurrent.ConcurrentHashMap
                    65:          3898          93696  [Lorg.springframework.core.annotation.AnnotationAttributes;
                    66:          1056          92928  org.h2.table.Column
                    67:          5702          91232  sun.reflect.generics.tree.ClassTypeSignature
                    68:           543          91224  org.springframework.beans.factory.support.RootBeanDefinition
                    69:          5543          88688  java.lang.Integer
                    70:          1485          83160  java.security.Provider$Service
                    71:          1904          76160  java.lang.invoke.BoundMethodHandle$Species_LL
                    72:          4608          73728  java.util.LinkedHashMap$LinkedKeySet
                    73:           973          70056  org.springframework.core.type.classreading.AnnotationMetadataReadingVisitor
                    74:          2944          70008  [Ljava.lang.reflect.Type;
                    75:          2890          69360  java.security.Provider$ServiceKey
                    76:           650          67600  org.h2.mvstore.Chunk
                    77:          4151          66416  java.util.jar.Attributes
                    78:          2063          66016  java.lang.ref.WeakReference
                    79:          2036          65152  com.serotonin.bacnet4j.obj.PropertyTypeDefinition
                    80:          2002          64064  jdk.nashorn.internal.runtime.FinalScriptFunctionData
                    81:          1099          61544  java.lang.Package
                    82:           162          61088  [Ljdk.nashorn.internal.runtime.PropertyHashMap$Element;
                    83:          1507          60280  java.lang.invoke.MethodType
                    84:          1497          59880  java.lang.ref.Finalizer
                    85:           710          58992  [Ljava.util.WeakHashMap$Entry;
                    86:            41          58216  [Ljava.nio.ByteBuffer;
                    87:          2464          56256  [Ljava.lang.reflect.Constructor;
                    88:           308          54208  org.springframework.context.annotation.ConfigurationClassBeanDefinitionReader$ConfigurationClassBeanDefinition
                    89:          1123          53904  org.springframework.util.ConcurrentReferenceHashMap$SoftEntryReference
                    90:          1648          52736  java.lang.invoke.DirectMethodHandle
                    91:          1638          52416  jdk.nashorn.internal.runtime.PropertyHashMap$Element
                    92:          1624          51968  java.lang.invoke.LambdaForm$Name
                    93:           205          50840  com.serotonin.m2m2.vo.DataPointVO
                    94:           880          49280  org.springframework.core.type.classreading.MethodMetadataReadingVisitor
                    95:          2036          48864  com.serotonin.bacnet4j.obj.ObjectPropertyTypeDefinition
                    96:          1519          48608  java.util.concurrent.locks.ReentrantLock$NonfairSync
                    97:           432          48384  org.springframework.context.annotation.ScannedGenericBeanDefinition
                    98:          1511          48352  java.lang.ref.ReferenceQueue
                    99:          1508          48256  java.lang.invoke.MethodType$ConcurrentWeakInternSet$WeakEntry
                   100:          1147          45880  java.math.BigInteger
                  
                  Total     169664483     7108600472
                  

                  I've limited it to the first 100 and totals, just to save post space. The full outputs ~7k can be sent on if needed.

                  htop when things max out:
                  0_1576156299362_htop.png

                  Software Developer for GLAS Energy Technology, Ireland

                  1 Reply Last reply Reply Quote 0
                  • terrypackerT
                    terrypacker
                    last edited by

                    @cbyrne the second jmap -hist output looks like the majority of the memory in use is from events. I'm just guessing here but it looks like you have a large number of events in the database that are being loaded and processed on login. Mango has known issues when the events table becomes large (which we are working to fix in Mango 4.0).

                    To confirm this I would restart Mango with the h2 web console enabled so you can look at the database without logging into Mango and causing it to eat up all the memory. This can be done via the env properties:

                    db.web.start=true
                    db.web.port=8091
                    

                    See also here: https://help.infiniteautomation.com/about-the-h2-database

                    Then login to the console make sure you set the JDBC url to point to the mango database on your file system, on a MangoES this would be jdbc:h2:/opt/mango/databases/mah2 basically the path to the db without the .h2.db on the end.

                    Then run this query: SELECT COUNT(*) FROM events;

                    If the number is very large and you are ok with removing all events from the system I suggest you delete all event data. Before doing this I would make a copy of the h2 database file as a backup. You can simply copy the file if Mango is down.

                    Then this post describes how to remove events from the database:
                    https://forum.infiniteautomation.com/topic/2266/full-storage-issue-on-mangoes
                    Basically run:

                    SET FOREIGN_KEY_CHECKS=0; 
                    CREATE TABLE eventsNewTable LIKE events; 
                    DROP TABLE events; 
                    RENAME TABLE eventsNewTable TO events; 
                    CREATE TABLE userEventsNewTable LIKE userEvents; 
                    DROP TABLE userEvents; 
                    RENAME TABLE userEventsNewTable TO userEvents; 
                    SET FOREIGN_KEY_CHECKS=1;
                    

                    If the events were the problem I suggest you take a look at this to better manage your events:
                    https://help.infiniteautomation.com/managing-disk-space

                    Another possibility that we can look at if my first assumption is not true is that something is generating many events on login. But since a big chunk of memory is being held by DataSourceEventTypes I expect this is from them being stored in the database.

                    1 Reply Last reply Reply Quote 0
                    • cbyrneC
                      cbyrne
                      last edited by cbyrne

                      Perfect, thanks @terrypacker! I'll try that and update this post.

                      update 1:
                      The H2 database shell doesn't recognise LIKE in CREATE TABLE. It may not be supported, The H2 command info for CREATE DATABASE doesn't show LIKE - https://www.h2database.com/html/commands.html#create_table

                      update 2
                      I just did a DELETE FROM EVENTS; instead.

                      So yeah, there might have been a few too many events... 12 million. The database has gone from ~6 Gb to 76 Mb.

                      Software Developer for GLAS Energy Technology, Ireland

                      1 Reply Last reply Reply Quote 1
                      • cbyrneC
                        cbyrne
                        last edited by cbyrne

                        @terrypacker Sorry for dredging up an old thread but I ran the same DELETE FROM EVENTS; as before but this time mango has failed to restart. It gets an out of bounds error when connecting to H2.

                        INFO  2020-06-10T18:38:06,912 (com.serotonin.m2m2.db.H2Proxy.initializeImpl:61) - Initializing H2 connection manager 
                        INFO  2020-06-10T18:38:06,953 (com.serotonin.m2m2.db.H2Proxy.initializeImpl:83) - Initializing H2 web server 
                        FATAL 2020-06-10T18:38:07,527 (com.serotonin.m2m2.db.AbstractDatabaseProxy.initialize:163) - Unable to connect to database of type H2 
                        org.springframework.jdbc.CannotGetJdbcConnectionException: Failed to obtain JDBC Connection; nested exception is org.h2.jdbc.JdbcSQLNonTransientException: General error: "java.lang.ArrayIndexOutOfBoundsException: 0" [50000-199]
                        	at org.springframework.jdbc.datasource.DataSourceUtils.getConnection(DataSourceUtils.java:81) ~[spring-jdbc-5.1.7.RELEASE.jar:5.1.7.RELEASE]
                        	at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:611) ~[spring-jdbc-5.1.7.RELEASE.jar:5.1.7.RELEASE]
                        	at org.springframework.jdbc.core.JdbcTemplate.query(JdbcTemplate.java:668) ~[spring-jdbc-5.1.7.RELEASE.jar:5.1.7.RELEASE]
                        	at org.springframework.jdbc.core.JdbcTemplate.query(JdbcTemplate.java:699) ~[spring-jdbc-5.1.7.RELEASE.jar:5.1.7.RELEASE]
                        	at org.springframework.jdbc.core.JdbcTemplate.query(JdbcTemplate.java:711) ~[spring-jdbc-5.1.7.RELEASE.jar:5.1.7.RELEASE]
                        	at com.serotonin.db.spring.ExtendedJdbcTemplate.queryForObject(ExtendedJdbcTemplate.java:39) ~[mango-3.6.5.jar:?]
                        	at com.serotonin.db.spring.ExtendedJdbcTemplate.queryForObject(ExtendedJdbcTemplate.java:63) ~[mango-3.6.5.jar:?]
                        	at com.serotonin.m2m2.db.H2Proxy.tableExists(H2Proxy.java:405) ~[mango-3.6.5.jar:?]
                        	at com.serotonin.m2m2.db.AbstractDatabaseProxy.newDatabaseCheck(AbstractDatabaseProxy.java:181) ~[mango-3.6.5.jar:?]
                        	at com.serotonin.m2m2.db.AbstractDatabaseProxy.initialize(AbstractDatabaseProxy.java:82) ~[mango-3.6.5.jar:?]
                        	at com.serotonin.m2m2.Lifecycle.databaseInitialize(Lifecycle.java:760) ~[ma-priv-3.6.5.jar:?]
                        	at com.serotonin.m2m2.Lifecycle.initialize(Lifecycle.java:312) ~[ma-priv-3.6.5.jar:?]
                        	at com.serotonin.m2m2.Main.main(Main.java:143) ~[ma-priv-3.6.5.jar:?]
                        Caused by: org.h2.jdbc.JdbcSQLNonTransientException: General error: "java.lang.ArrayIndexOutOfBoundsException: 0" [50000-199]
                        	at org.h2.message.DbException.getJdbcSQLException(DbException.java:502) ~[h2-1.4.199.jar:1.4.199]
                        	at org.h2.message.DbException.getJdbcSQLException(DbException.java:427) ~[h2-1.4.199.jar:1.4.199]
                        	at org.h2.message.DbException.get(DbException.java:194) ~[h2-1.4.199.jar:1.4.199]
                        	at org.h2.message.DbException.convert(DbException.java:347) ~[h2-1.4.199.jar:1.4.199]
                        	at org.h2.engine.Database.openDatabase(Database.java:345) ~[h2-1.4.199.jar:1.4.199]
                        	at org.h2.engine.Database.<init>(Database.java:313) ~[h2-1.4.199.jar:1.4.199]
                        	at org.h2.engine.Engine.openSession(Engine.java:69) ~[h2-1.4.199.jar:1.4.199]
                        	at org.h2.engine.Engine.openSession(Engine.java:201) ~[h2-1.4.199.jar:1.4.199]
                        	at org.h2.engine.Engine.createSessionAndValidate(Engine.java:178) ~[h2-1.4.199.jar:1.4.199]
                        	at org.h2.engine.Engine.createSession(Engine.java:161) ~[h2-1.4.199.jar:1.4.199]
                        	at org.h2.engine.Engine.createSession(Engine.java:31) ~[h2-1.4.199.jar:1.4.199]
                        	at org.h2.engine.SessionRemote.connectEmbeddedOrServer(SessionRemote.java:336) ~[h2-1.4.199.jar:1.4.199]
                        	at org.h2.jdbc.JdbcConnection.<init>(JdbcConnection.java:169) ~[h2-1.4.199.jar:1.4.199]
                        	at org.h2.jdbc.JdbcConnection.<init>(JdbcConnection.java:148) ~[h2-1.4.199.jar:1.4.199]
                        	at org.h2.Driver.connect(Driver.java:69) ~[h2-1.4.199.jar:1.4.199]
                        	at org.h2.jdbcx.JdbcDataSource.getJdbcConnection(JdbcDataSource.java:189) ~[h2-1.4.199.jar:1.4.199]
                        	at org.h2.jdbcx.JdbcDataSource.getXAConnection(JdbcDataSource.java:352) ~[h2-1.4.199.jar:1.4.199]
                        	at org.h2.jdbcx.JdbcDataSource.getPooledConnection(JdbcDataSource.java:384) ~[h2-1.4.199.jar:1.4.199]
                        	at org.h2.jdbcx.JdbcConnectionPool.getConnectionNow(JdbcConnectionPool.java:234) ~[h2-1.4.199.jar:1.4.199]
                        	at org.h2.jdbcx.JdbcConnectionPool.getConnection(JdbcConnectionPool.java:199) ~[h2-1.4.199.jar:1.4.199]
                        	at org.springframework.jdbc.datasource.DataSourceUtils.fetchConnection(DataSourceUtils.java:157) ~[spring-jdbc-5.1.7.RELEASE.jar:5.1.7.RELEASE]
                        	at org.springframework.jdbc.datasource.DataSourceUtils.doGetConnection(DataSourceUtils.java:115) ~[spring-jdbc-5.1.7.RELEASE.jar:5.1.7.RELEASE]
                        	at org.springframework.jdbc.datasource.DataSourceUtils.getConnection(DataSourceUtils.java:78) ~[spring-jdbc-5.1.7.RELEASE.jar:5.1.7.RELEASE]
                        	... 12 more
                        Caused by: java.lang.ArrayIndexOutOfBoundsException: 0
                        	at org.h2.index.PageDataLeaf.getRowAt(PageDataLeaf.java:329) ~[h2-1.4.199.jar:1.4.199]
                        	at org.h2.index.PageDataCursor.nextRow(PageDataCursor.java:67) ~[h2-1.4.199.jar:1.4.199]
                        	at org.h2.index.PageDataCursor.next(PageDataCursor.java:40) ~[h2-1.4.199.jar:1.4.199]
                        	at org.h2.table.PageStoreTable.addIndex(PageStoreTable.java:222) ~[h2-1.4.199.jar:1.4.199]
                        	at org.h2.engine.Database.open(Database.java:827) ~[h2-1.4.199.jar:1.4.199]
                        	at org.h2.engine.Database.openDatabase(Database.java:319) ~[h2-1.4.199.jar:1.4.199]
                        	at org.h2.engine.Database.<init>(Database.java:313) ~[h2-1.4.199.jar:1.4.199]
                        	at org.h2.engine.Engine.openSession(Engine.java:69) ~[h2-1.4.199.jar:1.4.199]
                        	at org.h2.engine.Engine.openSession(Engine.java:201) ~[h2-1.4.199.jar:1.4.199]
                        	at org.h2.engine.Engine.createSessionAndValidate(Engine.java:178) ~[h2-1.4.199.jar:1.4.199]
                        	at org.h2.engine.Engine.createSession(Engine.java:161) ~[h2-1.4.199.jar:1.4.199]
                        	at org.h2.engine.Engine.createSession(Engine.java:31) ~[h2-1.4.199.jar:1.4.199]
                        	at org.h2.engine.SessionRemote.connectEmbeddedOrServer(SessionRemote.java:336) ~[h2-1.4.199.jar:1.4.199]
                        	at org.h2.jdbc.JdbcConnection.<init>(JdbcConnection.java:169) ~[h2-1.4.199.jar:1.4.199]
                        	at org.h2.jdbc.JdbcConnection.<init>(JdbcConnection.java:148) ~[h2-1.4.199.jar:1.4.199]
                        	at org.h2.Driver.connect(Driver.java:69) ~[h2-1.4.199.jar:1.4.199]
                        	at org.h2.jdbcx.JdbcDataSource.getJdbcConnection(JdbcDataSource.java:189) ~[h2-1.4.199.jar:1.4.199]
                        	at org.h2.jdbcx.JdbcDataSource.getXAConnection(JdbcDataSource.java:352) ~[h2-1.4.199.jar:1.4.199]
                        	at org.h2.jdbcx.JdbcDataSource.getPooledConnection(JdbcDataSource.java:384) ~[h2-1.4.199.jar:1.4.199]
                        	at org.h2.jdbcx.JdbcConnectionPool.getConnectionNow(JdbcConnectionPool.java:234) ~[h2-1.4.199.jar:1.4.199]
                        	at org.h2.jdbcx.JdbcConnectionPool.getConnection(JdbcConnectionPool.java:199) ~[h2-1.4.199.jar:1.4.199]
                        	at org.springframework.jdbc.datasource.DataSourceUtils.fetchConnection(DataSourceUtils.java:157) ~[spring-jdbc-5.1.7.RELEASE.jar:5.1.7.RELEASE]
                        	at org.springframework.jdbc.datasource.DataSourceUtils.doGetConnection(DataSourceUtils.java:115) ~[spring-jdbc-5.1.7.RELEASE.jar:5.1.7.RELEASE]
                        	at org.springframework.jdbc.datasource.DataSourceUtils.getConnection(DataSourceUtils.java:78) ~[spring-jdbc-5.1.7.RELEASE.jar:5.1.7.RELEASE]
                        	... 12 more
                        ERROR 2020-06-10T18:38:07,527 (com.serotonin.m2m2.Main.main:146) - Error during initialization 
                        org.springframework.jdbc.CannotGetJdbcConnectionException: Failed to obtain JDBC Connection; nested exception is org.h2.jdbc.JdbcSQLNonTransientException: General error: "java.lang.ArrayIndexOutOfBoundsException: 0" [50000-199]
                        	at org.springframework.jdbc.datasource.DataSourceUtils.getConnection(DataSourceUtils.java:81) ~[spring-jdbc-5.1.7.RELEASE.jar:5.1.7.RELEASE]
                        	at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:611) ~[spring-jdbc-5.1.7.RELEASE.jar:5.1.7.RELEASE]
                        	at org.springframework.jdbc.core.JdbcTemplate.query(JdbcTemplate.java:668) ~[spring-jdbc-5.1.7.RELEASE.jar:5.1.7.RELEASE]
                        	at org.springframework.jdbc.core.JdbcTemplate.query(JdbcTemplate.java:699) ~[spring-jdbc-5.1.7.RELEASE.jar:5.1.7.RELEASE]
                        	at org.springframework.jdbc.core.JdbcTemplate.query(JdbcTemplate.java:711) ~[spring-jdbc-5.1.7.RELEASE.jar:5.1.7.RELEASE]
                        	at com.serotonin.db.spring.ExtendedJdbcTemplate.queryForObject(ExtendedJdbcTemplate.java:39) ~[mango-3.6.5.jar:?]
                        	at com.serotonin.db.spring.ExtendedJdbcTemplate.queryForObject(ExtendedJdbcTemplate.java:63) ~[mango-3.6.5.jar:?]
                        	at com.serotonin.m2m2.db.H2Proxy.tableExists(H2Proxy.java:405) ~[mango-3.6.5.jar:?]
                        	at com.serotonin.m2m2.db.AbstractDatabaseProxy.newDatabaseCheck(AbstractDatabaseProxy.java:181) ~[mango-3.6.5.jar:?]
                        	at com.serotonin.m2m2.db.AbstractDatabaseProxy.initialize(AbstractDatabaseProxy.java:82) ~[mango-3.6.5.jar:?]
                        	at com.serotonin.m2m2.Lifecycle.databaseInitialize(Lifecycle.java:760) ~[ma-priv-3.6.5.jar:?]
                        	at com.serotonin.m2m2.Lifecycle.initialize(Lifecycle.java:312) ~[ma-priv-3.6.5.jar:?]
                        	at com.serotonin.m2m2.Main.main(Main.java:143) ~[ma-priv-3.6.5.jar:?]
                        Caused by: org.h2.jdbc.JdbcSQLNonTransientException: General error: "java.lang.ArrayIndexOutOfBoundsException: 0" [50000-199]
                        	at org.h2.message.DbException.getJdbcSQLException(DbException.java:502) ~[h2-1.4.199.jar:1.4.199]
                        	at org.h2.message.DbException.getJdbcSQLException(DbException.java:427) ~[h2-1.4.199.jar:1.4.199]
                        	at org.h2.message.DbException.get(DbException.java:194) ~[h2-1.4.199.jar:1.4.199]
                        	at org.h2.message.DbException.convert(DbException.java:347) ~[h2-1.4.199.jar:1.4.199]
                        	at org.h2.engine.Database.openDatabase(Database.java:345) ~[h2-1.4.199.jar:1.4.199]
                        	at org.h2.engine.Database.<init>(Database.java:313) ~[h2-1.4.199.jar:1.4.199]
                        	at org.h2.engine.Engine.openSession(Engine.java:69) ~[h2-1.4.199.jar:1.4.199]
                        	at org.h2.engine.Engine.openSession(Engine.java:201) ~[h2-1.4.199.jar:1.4.199]
                        	at org.h2.engine.Engine.createSessionAndValidate(Engine.java:178) ~[h2-1.4.199.jar:1.4.199]
                        	at org.h2.engine.Engine.createSession(Engine.java:161) ~[h2-1.4.199.jar:1.4.199]
                        	at org.h2.engine.Engine.createSession(Engine.java:31) ~[h2-1.4.199.jar:1.4.199]
                        	at org.h2.engine.SessionRemote.connectEmbeddedOrServer(SessionRemote.java:336) ~[h2-1.4.199.jar:1.4.199]
                        	at org.h2.jdbc.JdbcConnection.<init>(JdbcConnection.java:169) ~[h2-1.4.199.jar:1.4.199]
                        	at org.h2.jdbc.JdbcConnection.<init>(JdbcConnection.java:148) ~[h2-1.4.199.jar:1.4.199]
                        	at org.h2.Driver.connect(Driver.java:69) ~[h2-1.4.199.jar:1.4.199]
                        	at org.h2.jdbcx.JdbcDataSource.getJdbcConnection(JdbcDataSource.java:189) ~[h2-1.4.199.jar:1.4.199]
                        	at org.h2.jdbcx.JdbcDataSource.getXAConnection(JdbcDataSource.java:352) ~[h2-1.4.199.jar:1.4.199]
                        	at org.h2.jdbcx.JdbcDataSource.getPooledConnection(JdbcDataSource.java:384) ~[h2-1.4.199.jar:1.4.199]
                        	at org.h2.jdbcx.JdbcConnectionPool.getConnectionNow(JdbcConnectionPool.java:234) ~[h2-1.4.199.jar:1.4.199]
                        	at org.h2.jdbcx.JdbcConnectionPool.getConnection(JdbcConnectionPool.java:199) ~[h2-1.4.199.jar:1.4.199]
                        	at org.springframework.jdbc.datasource.DataSourceUtils.fetchConnection(DataSourceUtils.java:157) ~[spring-jdbc-5.1.7.RELEASE.jar:5.1.7.RELEASE]
                        	at org.springframework.jdbc.datasource.DataSourceUtils.doGetConnection(DataSourceUtils.java:115) ~[spring-jdbc-5.1.7.RELEASE.jar:5.1.7.RELEASE]
                        	at org.springframework.jdbc.datasource.DataSourceUtils.getConnection(DataSourceUtils.java:78) ~[spring-jdbc-5.1.7.RELEASE.jar:5.1.7.RELEASE]
                        	... 12 more
                        Caused by: java.lang.ArrayIndexOutOfBoundsException: 0
                        	at org.h2.index.PageDataLeaf.getRowAt(PageDataLeaf.java:329) ~[h2-1.4.199.jar:1.4.199]
                        	at org.h2.index.PageDataCursor.nextRow(PageDataCursor.java:67) ~[h2-1.4.199.jar:1.4.199]
                        	at org.h2.index.PageDataCursor.next(PageDataCursor.java:40) ~[h2-1.4.199.jar:1.4.199]
                        	at org.h2.table.PageStoreTable.addIndex(PageStoreTable.java:222) ~[h2-1.4.199.jar:1.4.199]
                        	at org.h2.engine.Database.open(Database.java:827) ~[h2-1.4.199.jar:1.4.199]
                        	at org.h2.engine.Database.openDatabase(Database.java:319) ~[h2-1.4.199.jar:1.4.199]
                        	at org.h2.engine.Database.<init>(Database.java:313) ~[h2-1.4.199.jar:1.4.199]
                        	at org.h2.engine.Engine.openSession(Engine.java:69) ~[h2-1.4.199.jar:1.4.199]
                        	at org.h2.engine.Engine.openSession(Engine.java:201) ~[h2-1.4.199.jar:1.4.199]
                        	at org.h2.engine.Engine.createSessionAndValidate(Engine.java:178) ~[h2-1.4.199.jar:1.4.199]
                        	at org.h2.engine.Engine.createSession(Engine.java:161) ~[h2-1.4.199.jar:1.4.199]
                        	at org.h2.engine.Engine.createSession(Engine.java:31) ~[h2-1.4.199.jar:1.4.199]
                        	at org.h2.engine.SessionRemote.connectEmbeddedOrServer(SessionRemote.java:336) ~[h2-1.4.199.jar:1.4.199]
                        	at org.h2.jdbc.JdbcConnection.<init>(JdbcConnection.java:169) ~[h2-1.4.199.jar:1.4.199]
                        	at org.h2.jdbc.JdbcConnection.<init>(JdbcConnection.java:148) ~[h2-1.4.199.jar:1.4.199]
                        	at org.h2.Driver.connect(Driver.java:69) ~[h2-1.4.199.jar:1.4.199]
                        	at org.h2.jdbcx.JdbcDataSource.getJdbcConnection(JdbcDataSource.java:189) ~[h2-1.4.199.jar:1.4.199]
                        	at org.h2.jdbcx.JdbcDataSource.getXAConnection(JdbcDataSource.java:352) ~[h2-1.4.199.jar:1.4.199]
                        	at org.h2.jdbcx.JdbcDataSource.getPooledConnection(JdbcDataSource.java:384) ~[h2-1.4.199.jar:1.4.199]
                        	at org.h2.jdbcx.JdbcConnectionPool.getConnectionNow(JdbcConnectionPool.java:234) ~[h2-1.4.199.jar:1.4.199]
                        	at org.h2.jdbcx.JdbcConnectionPool.getConnection(JdbcConnectionPool.java:199) ~[h2-1.4.199.jar:1.4.199]
                        	at org.springframework.jdbc.datasource.DataSourceUtils.fetchConnection(DataSourceUtils.java:157) ~[spring-jdbc-5.1.7.RELEASE.jar:5.1.7.RELEASE]
                        	at org.springframework.jdbc.datasource.DataSourceUtils.doGetConnection(DataSourceUtils.java:115) ~[spring-jdbc-5.1.7.RELEASE.jar:5.1.7.RELEASE]
                        	at org.springframework.jdbc.datasource.DataSourceUtils.getConnection(DataSourceUtils.java:78) ~[spring-jdbc-5.1.7.RELEASE.jar:5.1.7.RELEASE]
                        	... 12 more
                        INFO  2020-06-10T18:38:07,527 (com.serotonin.m2m2.Lifecycle.terminate:427) - Mango Lifecycle terminating... 
                        INFO  2020-06-10T18:38:07,559 (com.serotonin.m2m2.db.H2Proxy.terminateImpl:394) - Terminating database. 
                        ERROR 2020-06-10T18:38:07,823 (com.serotonin.m2m2.Lifecycle.terminate:563) - Failed to terminate database. 
                        org.springframework.jdbc.CannotGetJdbcConnectionException: Failed to obtain JDBC Connection; nested exception is org.h2.jdbc.JdbcSQLNonTransientException: General error: "java.lang.ArrayIndexOutOfBoundsException: 0" [50000-199]
                        	at org.springframework.jdbc.datasource.DataSourceUtils.getConnection(DataSourceUtils.java:81) ~[spring-jdbc-5.1.7.RELEASE.jar:5.1.7.RELEASE]
                        	at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:370) ~[spring-jdbc-5.1.7.RELEASE.jar:5.1.7.RELEASE]
                        	at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:417) ~[spring-jdbc-5.1.7.RELEASE.jar:5.1.7.RELEASE]
                        	at com.serotonin.m2m2.db.H2Proxy.runScript(H2Proxy.java:280) ~[mango-3.6.5.jar:?]
                        	at com.serotonin.m2m2.db.H2Proxy.terminateImpl(H2Proxy.java:395) ~[mango-3.6.5.jar:?]
                        	at com.serotonin.m2m2.db.AbstractDatabaseProxy.terminate(AbstractDatabaseProxy.java:211) ~[mango-3.6.5.jar:?]
                        	at com.serotonin.m2m2.Lifecycle.databaseTerminate(Lifecycle.java:765) ~[ma-priv-3.6.5.jar:?]
                        	at com.serotonin.m2m2.Lifecycle.terminate(Lifecycle.java:561) ~[ma-priv-3.6.5.jar:?]
                        	at com.serotonin.m2m2.Main.main(Main.java:147) ~[ma-priv-3.6.5.jar:?]
                        Caused by: org.h2.jdbc.JdbcSQLNonTransientException: General error: "java.lang.ArrayIndexOutOfBoundsException: 0" [50000-199]
                        	at org.h2.message.DbException.getJdbcSQLException(DbException.java:502) ~[h2-1.4.199.jar:1.4.199]
                        	at org.h2.message.DbException.getJdbcSQLException(DbException.java:427) ~[h2-1.4.199.jar:1.4.199]
                        	at org.h2.message.DbException.get(DbException.java:194) ~[h2-1.4.199.jar:1.4.199]
                        	at org.h2.message.DbException.convert(DbException.java:347) ~[h2-1.4.199.jar:1.4.199]
                        	at org.h2.engine.Database.openDatabase(Database.java:345) ~[h2-1.4.199.jar:1.4.199]
                        	at org.h2.engine.Database.<init>(Database.java:313) ~[h2-1.4.199.jar:1.4.199]
                        	at org.h2.engine.Engine.openSession(Engine.java:69) ~[h2-1.4.199.jar:1.4.199]
                        	at org.h2.engine.Engine.openSession(Engine.java:201) ~[h2-1.4.199.jar:1.4.199]
                        	at org.h2.engine.Engine.createSessionAndValidate(Engine.java:178) ~[h2-1.4.199.jar:1.4.199]
                        	at org.h2.engine.Engine.createSession(Engine.java:161) ~[h2-1.4.199.jar:1.4.199]
                        	at org.h2.engine.Engine.createSession(Engine.java:31) ~[h2-1.4.199.jar:1.4.199]
                        	at org.h2.engine.SessionRemote.connectEmbeddedOrServer(SessionRemote.java:336) ~[h2-1.4.199.jar:1.4.199]
                        	at org.h2.jdbc.JdbcConnection.<init>(JdbcConnection.java:169) ~[h2-1.4.199.jar:1.4.199]
                        	at org.h2.jdbc.JdbcConnection.<init>(JdbcConnection.java:148) ~[h2-1.4.199.jar:1.4.199]
                        	at org.h2.Driver.connect(Driver.java:69) ~[h2-1.4.199.jar:1.4.199]
                        	at org.h2.jdbcx.JdbcDataSource.getJdbcConnection(JdbcDataSource.java:189) ~[h2-1.4.199.jar:1.4.199]
                        	at org.h2.jdbcx.JdbcDataSource.getXAConnection(JdbcDataSource.java:352) ~[h2-1.4.199.jar:1.4.199]
                        	at org.h2.jdbcx.JdbcDataSource.getPooledConnection(JdbcDataSource.java:384) ~[h2-1.4.199.jar:1.4.199]
                        	at org.h2.jdbcx.JdbcConnectionPool.getConnectionNow(JdbcConnectionPool.java:234) ~[h2-1.4.199.jar:1.4.199]
                        	at org.h2.jdbcx.JdbcConnectionPool.getConnection(JdbcConnectionPool.java:199) ~[h2-1.4.199.jar:1.4.199]
                        	at org.springframework.jdbc.datasource.DataSourceUtils.fetchConnection(DataSourceUtils.java:157) ~[spring-jdbc-5.1.7.RELEASE.jar:5.1.7.RELEASE]
                        	at org.springframework.jdbc.datasource.DataSourceUtils.doGetConnection(DataSourceUtils.java:115) ~[spring-jdbc-5.1.7.RELEASE.jar:5.1.7.RELEASE]
                        	at org.springframework.jdbc.datasource.DataSourceUtils.getConnection(DataSourceUtils.java:78) ~[spring-jdbc-5.1.7.RELEASE.jar:5.1.7.RELEASE]
                        	... 8 more
                        Caused by: java.lang.ArrayIndexOutOfBoundsException: 0
                        	at org.h2.index.PageDataLeaf.getRowAt(PageDataLeaf.java:329) ~[h2-1.4.199.jar:1.4.199]
                        	at org.h2.index.PageDataCursor.nextRow(PageDataCursor.java:67) ~[h2-1.4.199.jar:1.4.199]
                        	at org.h2.index.PageDataCursor.next(PageDataCursor.java:40) ~[h2-1.4.199.jar:1.4.199]
                        	at org.h2.table.PageStoreTable.addIndex(PageStoreTable.java:222) ~[h2-1.4.199.jar:1.4.199]
                        	at org.h2.engine.Database.open(Database.java:827) ~[h2-1.4.199.jar:1.4.199]
                        	at org.h2.engine.Database.openDatabase(Database.java:319) ~[h2-1.4.199.jar:1.4.199]
                        	at org.h2.engine.Database.<init>(Database.java:313) ~[h2-1.4.199.jar:1.4.199]
                        	at org.h2.engine.Engine.openSession(Engine.java:69) ~[h2-1.4.199.jar:1.4.199]
                        	at org.h2.engine.Engine.openSession(Engine.java:201) ~[h2-1.4.199.jar:1.4.199]
                        	at org.h2.engine.Engine.createSessionAndValidate(Engine.java:178) ~[h2-1.4.199.jar:1.4.199]
                        	at org.h2.engine.Engine.createSession(Engine.java:161) ~[h2-1.4.199.jar:1.4.199]
                        	at org.h2.engine.Engine.createSession(Engine.java:31) ~[h2-1.4.199.jar:1.4.199]
                        	at org.h2.engine.SessionRemote.connectEmbeddedOrServer(SessionRemote.java:336) ~[h2-1.4.199.jar:1.4.199]
                        	at org.h2.jdbc.JdbcConnection.<init>(JdbcConnection.java:169) ~[h2-1.4.199.jar:1.4.199]
                        	at org.h2.jdbc.JdbcConnection.<init>(JdbcConnection.java:148) ~[h2-1.4.199.jar:1.4.199]
                        	at org.h2.Driver.connect(Driver.java:69) ~[h2-1.4.199.jar:1.4.199]
                        	at org.h2.jdbcx.JdbcDataSource.getJdbcConnection(JdbcDataSource.java:189) ~[h2-1.4.199.jar:1.4.199]
                        	at org.h2.jdbcx.JdbcDataSource.getXAConnection(JdbcDataSource.java:352) ~[h2-1.4.199.jar:1.4.199]
                        	at org.h2.jdbcx.JdbcDataSource.getPooledConnection(JdbcDataSource.java:384) ~[h2-1.4.199.jar:1.4.199]
                        	at org.h2.jdbcx.JdbcConnectionPool.getConnectionNow(JdbcConnectionPool.java:234) ~[h2-1.4.199.jar:1.4.199]
                        	at org.h2.jdbcx.JdbcConnectionPool.getConnection(JdbcConnectionPool.java:199) ~[h2-1.4.199.jar:1.4.199]
                        	at org.springframework.jdbc.datasource.DataSourceUtils.fetchConnection(DataSourceUtils.java:157) ~[spring-jdbc-5.1.7.RELEASE.jar:5.1.7.RELEASE]
                        	at org.springframework.jdbc.datasource.DataSourceUtils.doGetConnection(DataSourceUtils.java:115) ~[spring-jdbc-5.1.7.RELEASE.jar:5.1.7.RELEASE]
                        	at org.springframework.jdbc.datasource.DataSourceUtils.getConnection(DataSourceUtils.java:78) ~[spring-jdbc-5.1.7.RELEASE.jar:5.1.7.RELEASE]
                        	... 8 more
                        INFO  2020-06-10T18:38:07,826 (com.serotonin.m2m2.Lifecycle.terminate:578) - Mango Lifecycle terminated. 
                        

                        Running the web console manually gives the same out of bounds error when the connection is tested.

                        General error: "java.lang.ArrayIndexOutOfBoundsException: 0" [50000-199] HY000/50000
                        

                        Update

                        Managed to get it fixed (after a database restore) by:

                        1. SET REFERENTIAL_INTEGRITY FALSE;
                        2. TRUNCATE TABLE EVENTS;
                        3. SET REFERENTIAL_INTEGRITY TRUE;
                        4. TRUNCATE TABLE USEREVENTS;
                        5. Restart Mango

                        Database went from 6Gb to 17Mb.

                        Software Developer for GLAS Energy Technology, Ireland

                        1 Reply Last reply Reply Quote 0
                        • First post
                          Last post