IBM / codenet-minerva-code-analyzer

Java source code (and/or binary) to JSON based system dependency graph generator.
Apache License 2.0
1 stars 3 forks source link

Out of Memory exception when running over a bigger project and limited machine resources #46

Open fabio-franco opened 1 month ago

fabio-franco commented 1 month ago

The issue was reported when running on a container, but it probably would happen in a bare metal environment with limited resources.

issue:

When performing generation for the first time, codeanalyzer is invoked to build analysis.json . For a bigger project (for example cargotracker) default settings will result in OOM exception. How to resolve this:

  1. Make sure your docker runtime (podman or rancher) has necessary memory available (in my case it was 2GB which is too small)
  2. In the devcontainer.json add "-m", "4g" (for example) to runArgs Keep in mind that specifying more memory in runArgs then is available for your docker runtime will be silently ignored
cherylking commented 1 month ago

What we really need to understand is the memory requirements for our end user desktop/laptop. @rangeetpan @rahlk Can you have some numbers for us to go over at the "WCA4EJA Architecture Leadership Weekly" meeting on Monday Aug. 19th at 9:30am ? I will add you both to the invite.

rahlk commented 3 weeks ago

Here are the largest projects we have tested on with a 4gb stack for Java:

┏━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━┳━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━┓
┃ Project              ┃ No. Tests ┃ No. Methods ┃ Test prevalence rate (%) ┃
┡━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━╇━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━━┩
│ armeria              │ 607       │ 109923      │ 0.5521997016120228       │
│ hive-cdh5.6.0-relea… │ 37        │ 60986       │ 0.06066866709298703      │
│ besu                 │ 1880      │ 29759       │ 6.317204301075269        │
│ cdk                  │ 2637      │ 29706       │ 8.876695728279529        │
│ styx                 │ 1163      │ 24888       │ 4.672746996665193        │
│ speedment            │ 2905      │ 23909       │ 12.149728147218736       │
│ dubbo                │ 1060      │ 20227       │ 5.240261024322721        │
│ citrus               │ 843       │ 18666       │ 4.515990785878824        │
│ tddl5                │ 35        │ 17270       │ 0.20265184413178158      │
│ nuls-v2              │ 37        │ 16838       │ 0.21972801235227746      │
│ doma                 │ 646       │ 15125       │ 4.270792013751157        │
│ xs2a                 │ 2321      │ 15031       │ 15.44039382650346        │
│ Gaffer               │ 1374      │ 13986       │ 9.823407449774791        │
│ java-sdk             │ 895       │ 13557       │ 6.60126862369081         │
│ ctakes               │ 33        │ 13523       │ 0.2440106477373558       │
│ hasor                │ 31        │ 13275       │ 0.2335040674902079       │
│ ecms                 │ 36        │ 12112       │ 0.297201353917279        │
│ jopa                 │ 1264      │ 11385       │ 11.101352538204813       │
│ olingo-odata2        │ 995       │ 11340       │ 8.773476765717309        │
│ TLS-Attacker         │ 935       │ 11273       │ 8.293418485009758        │
│ onboard              │ 38        │ 10462       │ 0.36318455509892         │
│ jPOS                 │ 2187      │ 10460       │ 20.906223114425007       │
│ nuxeo-core           │ 34        │ 10308       │ 0.3298089048404307       │
│ hibernate-types      │ 37        │ 10295       │ 0.35936285936285933      │
│ XCoLab               │ 34        │ 10039       │ 0.3386454183266932       │
│ qpid-jms             │ 1071      │ 9648        │ 11.09959581303762        │
│ gwt-bean-validators  │ 37        │ 9354        │ 0.3955104222340994       │
│ giraph               │ 33        │ 9265        │ 0.3561407295488884       │
│ medsavant            │ 37        │ 8805        │ 0.42016806722689076      │
│ fatts                │ 37        │ 8756        │ 0.4225191275550988       │
│ ums-backend          │ 1893      │ 8497        │ 22.275829606966347       │
│ cta-otp              │ 36        │ 8316        │ 0.43284838283034743      │
│ diirt                │ 755       │ 8020        │ 9.412791422515895        │
│ abdera               │ 36        │ 7674        │ 0.4690553745928339       │
│ jpmml-model          │ 37        │ 7502        │ 0.49313607890177263      │
│ migration-tools      │ 32        │ 7119        │ 0.44943820224719105      │
│ BlackLab             │ 37        │ 7104        │ 0.5207600281491906       │
│ cloud-odata-java     │ 598       │ 6844        │ 8.736303871439006        │
│ iis                  │ 736       │ 6767        │ 10.874704491725769       │
│ duracloud            │ 588       │ 6576        │ 8.940246312908622        │
│ java-restify         │ 825       │ 6545        │ 12.603116406966086       │
│ brave                │ 787       │ 6525        │ 12.059454489733374       │
│ jnosql-artemis-exte… │ 37        │ 6405        │ 0.5775835154542617       │
│ apicurio-registry    │ 34        │ 6358        │ 0.534675263406196        │
│ api-layer            │ 603       │ 6342        │ 9.506542645435914        │
│ jmeter-plugins       │ 1185      │ 6030        │ 19.648482838666887       │
│ httpcomponents-clie… │ 605       │ 5896        │ 10.259453959640496       │
│ FluentLenium         │ 658       │ 5737        │ 11.467410247472987       │
│ summer               │ 34        │ 5660        │ 0.6006006006006006       │
│ opencensus-java      │ 964       │ 5648        │ 17.06496725084086        │
│ act-platform         │ 996       │ 5532        │ 18.00108440267486        │
│ xbee-java            │ 820       │ 5529        │ 14.828209764918626       │
│ tessera              │ 813       │ 5226        │ 15.553854983738283       │
│ verify-hub           │ 611       │ 5140        │ 11.8848473059716         │
│ ff4j                 │ 31        │ 5105        │ 0.6071288679984332       │
│ swordfish            │ 37        │ 5051        │ 0.7323832145684878       │
│ phosphor             │ 35        │ 4974        │ 0.7035175879396985       │
│ lightblue-core       │ 619       │ 4812        │ 12.86100145439435        │
│ jdbc-yugabytedb      │ 33        │ 4777        │ 0.6906655504395145       │
│ jpo-ode              │ 655       │ 4773        │ 13.720150816925011       │
│ wikibrain            │ 35        │ 4761        │ 0.7349853002939941       │
│ conquery             │ 35        │ 4754        │ 0.7360672975814931       │
│ tlc.open.java        │ 34        │ 4711        │ 0.7215619694397283       │
│ Wilma                │ 1074      │ 4704        │ 22.826780021253985       │
│ learnlib             │ 36        │ 4586        │ 0.7848266841072596       │
│ org.ops4j.pax.web    │ 37        │ 4542        │ 0.814439797490645        │
│ TomP2P               │ 34        │ 4493        │ 0.7565643079661771       │
│ FirefoxLite          │ 31        │ 4465        │ 0.6941334527541424       │
│ anno4j               │ 33        │ 4396        │ 0.7505117125312712       │
│ launchkey-java       │ 736       │ 4281        │ 17.18822979915927        │
│ fastods              │ 593       │ 4217        │ 14.058795637743007       │
│ spring-shell         │ 31        │ 4211        │ 0.7359924026590694       │
│ wro4j                │ 686       │ 4073        │ 16.83848797250859        │
│ craft-atom           │ 34        │ 4058        │ 0.8376447400837644       │
│ riposte              │ 735       │ 4026        │ 18.25180034765334        │
│ atmosphere           │ 30        │ 4019        │ 0.7462686567164178       │
│ build-info           │ 37        │ 3870        │ 0.9558253681219323       │
│ core-ng-project      │ 639       │ 3834        │ 16.66232073011734        │
│ endpoints-java       │ 601       │ 3694        │ 16.265223274695533       │
│ JCTools              │ 35        │ 3586        │ 0.9757457485363814       │
│ unix4j               │ 30        │ 3482        │ 0.8613264427217916       │
│ summerb              │ 35        │ 3458        │ 1.0118531367447239       │
│ chouette             │ 38        │ 3428        │ 1.1081948089822107       │
│ incubator-samoa      │ 36        │ 3340        │ 1.0775217000897934       │
│ Java-Lang            │ 33        │ 3303        │ 0.9987893462469734       │
│ funk                 │ 763       │ 3302        │ 23.1002119285498         │
│ vraptor4             │ 608       │ 3206        │ 18.9585282195198         │
│ jPOS-EE              │ 31        │ 3197        │ 0.969355847404628        │
│ spectre              │ 34        │ 3148        │ 1.079707843759924        │
│ astrix               │ 38        │ 3050        │ 1.2454932808915111       │
│ openmuc              │ 31        │ 3013        │ 1.028533510285335        │
│ thorntail-poc        │ 36        │ 2895        │ 1.2430939226519337       │
│ openapi-generator    │ 1569      │ 2889        │ 54.29065743944636        │
│ inversion-engine     │ 32        │ 2871        │ 1.1142061281337048       │
│ geostore             │ 35        │ 2859        │ 1.2237762237762237       │
│ javaee7-samples      │ 32        │ 2844        │ 1.124780316344464        │
│ samoa                │ 38        │ 2788        │ 1.3624955181068483       │
│ cogroo4              │ 38        │ 2759        │ 1.3768115942028984       │
│ spring-cloud-huawei  │ 31        │ 2581        │ 1.2006196746707978       │
│ janusgraph-util      │ 35        │ 2564        │ 1.364522417153996        │
│ sdn-rx               │ 32        │ 2549        │ 1.2549019607843137       │
│ jaqy                 │ 36        │ 2518        │ 1.4291385470424771       │
│ restheart            │ 31        │ 2464        │ 1.2576064908722109       │
│ splout-db            │ 35        │ 2462        │ 1.4210312626877792       │
│ voxelshop            │ 33        │ 2430        │ 1.3574660633484164       │
│ Design               │ 37        │ 2366        │ 1.563160118293198        │
│ fluo                 │ 38        │ 2364        │ 1.6067653276955602       │
│ Java-education       │ 36        │ 2358        │ 1.526070368800339        │
│ pebble               │ 37        │ 2340        │ 1.5805211448099103       │
│ java.client          │ 34        │ 2318        │ 1.466149202242346        │
│ elasticsearch-sql    │ 36        │ 2291        │ 1.5706806282722512       │
│ 3d-bin-container-pa… │ 37        │ 2185        │ 1.6925892040256174       │
│ TerrainControl       │ 33        │ 2165        │ 1.5235457063711912       │
│ action-controller    │ 36        │ 2132        │ 1.6877637130801686       │
│ gralog               │ 34        │ 2077        │ 1.6361886429258903       │
│ sylph                │ 35        │ 2047        │ 1.708984375              │
│ jetty.toolchain      │ 31        │ 2013        │ 1.5392254220456802       │
│ jfunk                │ 34        │ 2012        │ 1.689021361152509        │
│ eo                   │ 36        │ 1993        │ 1.8054162487462388       │
│ ambari-metrics       │ 32        │ 1944        │ 1.6452442159383032       │
│ elastic-job-lite     │ 630       │ 1936        │ 32.52452245740836        │
│ Multiverse-3         │ 35        │ 1919        │ 1.8229166666666667       │
│ liferay-graphql      │ 859       │ 1908        │ 44.99738082765846        │
│ accumulo-recipes     │ 35        │ 1893        │ 1.8479408658922916       │
│ nfctools             │ 35        │ 1837        │ 1.9042437431991295       │
│ codeless             │ 32        │ 1829        │ 1.7486338797814207       │
│ coherence-tools      │ 34        │ 1815        │ 1.8722466960352422       │
│ openapi4j            │ 31        │ 1779        │ 1.741573033707865        │
│ smallrye-jwt         │ 32        │ 1726        │ 1.8529241459177763       │
│ RDFUnit              │ 37        │ 1708        │ 2.1650087770626096       │
│ beam                 │ 3749      │ 1690        │ 221.7031342400946        │
│ ckb-sdk-java         │ 30        │ 1668        │ 1.797483523067705        │
│ sidewinder           │ 37        │ 1575        │ 2.3477157360406093       │
│ cryptomator          │ 36        │ 1560        │ 2.3062139654067906       │
│ bahir-flink          │ 34        │ 1555        │ 2.185089974293059        │
│ citrus-admin         │ 33        │ 1439        │ 2.2916666666666665       │
│ netshell             │ 32        │ 1399        │ 2.2857142857142856       │
│ ohc                  │ 34        │ 1395        │ 2.4355300859598854       │
│ tatami               │ 37        │ 1392        │ 2.656137832017229        │
│ dandelion            │ 33        │ 1363        │ 2.4193548387096775       │
│ ethsigner            │ 32        │ 1339        │ 2.3880597014925375       │
│ dagger2-sample       │ 35        │ 1320        │ 2.6495079485238455       │
│ bobcat               │ 34        │ 1306        │ 2.601377199693956        │
│ SensorPlanningServi… │ 38        │ 1288        │ 2.948021722265322        │
│ OnlineGuru           │ 38        │ 1265        │ 3.0015797788309637       │
│ netx                 │ 37        │ 1263        │ 2.9272151898734178       │
│ teamcity-msteams-no… │ 38        │ 1247        │ 3.0448717948717947       │
│ ddal                 │ 33        │ 1233        │ 2.674230145867099        │
│ Moo                  │ 34        │ 1211        │ 2.8052805280528053       │
│ newts                │ 34        │ 1201        │ 2.828618968386023        │
│ fabric8-kit          │ 31        │ 1172        │ 2.6427962489343564       │
│ openmrs-module-open… │ 35        │ 1145        │ 3.054101221640489        │
│ OpenWebStart         │ 38        │ 1138        │ 3.336259877085163        │
│ web                  │ 35        │ 1122        │ 3.1166518254674975       │
│ extract              │ 33        │ 1111        │ 2.9676258992805753       │
│ requirementsascode   │ 37        │ 1089        │ 3.3944954128440368       │
│ karamel              │ 35        │ 1089        │ 3.211009174311927        │
│ totorom              │ 34        │ 1051        │ 3.2319391634980987       │
│ legacy-jclouds-chef  │ 37        │ 1037        │ 3.5645472061657033       │
│ modelserver          │ 34        │ 1031        │ 3.2945736434108532       │
│ fahrschein           │ 37        │ 1026        │ 3.6027263875365136       │
│ benten               │ 37        │ 996         │ 3.711133400200602        │
│ jirm                 │ 32        │ 989         │ 3.2323232323232323       │
│ nifi-minio           │ 34        │ 988         │ 3.4378159757330633       │
│ carml                │ 36        │ 972         │ 3.6998972250770814       │
│ Reconciliation-and-… │ 38        │ 968         │ 3.9215686274509802       │
│ atlas                │ 642       │ 966         │ 66.39089968976215        │
│ NLIWOD               │ 37        │ 925         │ 3.995680345572354        │
│ titanite             │ 36        │ 897         │ 4.008908685968819        │
│ tbschedule           │ 36        │ 883         │ 4.072398190045249        │
│ cukes                │ 34        │ 876         │ 3.8768529076396807       │
│ geolatte-mapserver   │ 35        │ 866         │ 4.036908881199539        │
│ jpasskit             │ 33        │ 853         │ 3.864168618266979        │
│ karaf-decanter       │ 31        │ 848         │ 3.651354534746761        │
│ niubi-job            │ 38        │ 828         │ 4.583835946924005        │
│ extjfx               │ 35        │ 817         │ 4.278728606356968        │
│ actors               │ 37        │ 817         │ 4.52322738386308         │
│ luwak                │ 31        │ 770         │ 4.020752269779507        │
│ android-fore         │ 35        │ 746         │ 4.685408299866131        │
│ staffjoy             │ 35        │ 743         │ 4.704301075268817        │
│ opensharding-spi-im… │ 38        │ 740         │ 5.128205128205128        │
│ component            │ 36        │ 722         │ 4.979253112033195        │
│ smock                │ 31        │ 716         │ 4.323570432357044        │
│ crypto-conditions    │ 35        │ 712         │ 4.908835904628331        │
│ dialogflow-java-cli… │ 38        │ 710         │ 5.344585091420535        │
│ s3auth               │ 37        │ 705         │ 5.240793201133145        │
│ marklogic-rdf4j      │ 31        │ 686         │ 4.512372634643377        │
│ missinglink          │ 35        │ 677         │ 5.162241887905605        │
│ roboy_dialog         │ 36        │ 670         │ 5.365126676602086        │
│ jersey2-restfull-ex… │ 31        │ 645         │ 4.798761609907121        │
│ parity               │ 35        │ 642         │ 5.443234836702955        │
│ coroutines           │ 35        │ 640         │ 5.46021840873635         │
│ jumi-actors          │ 37        │ 634         │ 5.826771653543307        │
│ OAI-PMH2             │ 37        │ 630         │ 5.863708399366086        │
│ ressor               │ 35        │ 627         │ 5.573248407643312        │
│ newrelic-alerts-con… │ 34        │ 625         │ 5.431309904153355        │
│ DeFiBus              │ 38        │ 624         │ 6.08                     │
│ raygun4java          │ 34        │ 622         │ 5.457463884430177        │
│ commons-proxy        │ 37        │ 621         │ 5.94855305466238         │
│ unleash-maven-plugin │ 31        │ 604         │ 5.12396694214876         │
│ fluentxml4j          │ 32        │ 594         │ 5.378151260504202        │
│ esBench              │ 37        │ 589         │ 6.271186440677965        │
│ Mutters              │ 36        │ 576         │ 6.239168110918544        │
│ composit             │ 36        │ 544         │ 6.605504587155964        │
│ jax-rs-linker        │ 37        │ 541         │ 6.826568265682657        │
│ json-fixtures        │ 33        │ 533         │ 6.179775280898876        │
│ circe                │ 35        │ 514         │ 6.796116504854369        │
│ openrest             │ 38        │ 505         │ 7.5098814229249005       │
│ JDBC-Performance-Lo… │ 37        │ 493         │ 7.489878542510121        │
│ gp-java-tools        │ 38        │ 487         │ 7.786885245901639        │
│ cli                  │ 35        │ 469         │ 7.446808510638298        │
│ chronos              │ 38        │ 454         │ 8.35164835164835         │
│ fernet-java8         │ 31        │ 439         │ 7.045454545454545        │
│ java-diff-utils      │ 38        │ 437         │ 8.67579908675799         │
│ nanofix              │ 35        │ 418         │ 8.353221957040573        │
│ heat                 │ 31        │ 410         │ 7.542579075425791        │
│ org.vaadin.mvp       │ 33        │ 400         │ 8.229426433915211        │
│ swage                │ 31        │ 398         │ 7.769423558897243        │
│ java-obd-adapter     │ 30        │ 393         │ 7.614213197969544        │
│ sunstone             │ 36        │ 390         │ 9.207161125319693        │
│ webster              │ 30        │ 386         │ 7.751937984496124        │
│ kafka-connect-stora… │ 38        │ 379         │ 10.0                     │
│ JenkinsHue           │ 33        │ 367         │ 8.967391304347826        │
│ therapi-runtime-jav… │ 37        │ 364         │ 10.136986301369863       │
│ pixel-captcha-proje… │ 31        │ 345         │ 8.959537572254336        │
│ MarvelApiClientAndr… │ 33        │ 337         │ 9.763313609467456        │
│ space                │ 33        │ 325         │ 10.122699386503067       │
│ lambda-local         │ 37        │ 316         │ 11.67192429022082        │
│ vcat                 │ 35        │ 312         │ 11.182108626198083       │
│ slf4j-lambda         │ 32        │ 311         │ 10.256410256410255       │
│ confagrid            │ 35        │ 297         │ 11.74496644295302        │
│ mesos-rxjava         │ 31        │ 293         │ 10.54421768707483        │
│ stecker              │ 34        │ 285         │ 11.888111888111888       │
│ fitchy               │ 37        │ 272         │ 13.553113553113553       │
│ moneta               │ 32        │ 265         │ 12.030075187969924       │
│ extension-springclo… │ 32        │ 259         │ 12.307692307692308       │
│ alexa-skill          │ 38        │ 258         │ 14.671814671814673       │
│ cas-security-spring… │ 37        │ 243         │ 15.163934426229508       │
│ sonar-ldap           │ 31        │ 235         │ 13.135593220338984       │
│ soja                 │ 35        │ 232         │ 15.021459227467812       │
│ spring-batch-rest    │ 30        │ 228         │ 13.100436681222707       │
│ sonar-packageanalyz… │ 35        │ 222         │ 15.695067264573993       │
│ selenium-grid-exten… │ 31        │ 222         │ 13.901345291479823       │
│ cloud-trace-java-in… │ 34        │ 218         │ 15.52511415525114        │
│ RESTAPIUnifier       │ 30        │ 217         │ 13.761467889908257       │
│ bolt-jna             │ 33        │ 202         │ 16.25615763546798        │
│ brownie              │ 35        │ 201         │ 17.326732673267326       │
│ oath                 │ 31        │ 201         │ 15.346534653465346       │
│ snowizard            │ 37        │ 199         │ 18.5                     │
│ jjson                │ 38        │ 199         │ 19.0                     │
│ restify              │ 37        │ 196         │ 18.781725888324875       │
│ mmo-game-server      │ 35        │ 196         │ 17.766497461928935       │
│ glacieruploader      │ 36        │ 176         │ 20.33898305084746        │
│ declarative-pipelin… │ 30        │ 160         │ 18.633540372670808       │
│ spanners             │ 31        │ 159         │ 19.375                   │
│ pipeline             │ 32        │ 142         │ 22.377622377622377       │
│ burst                │ 32        │ 141         │ 22.535211267605636       │
│ keycloak-user-migra… │ 34        │ 134         │ 25.185185185185183       │
│ aws-sdk-java-samples │ 33        │ 134         │ 24.444444444444443       │
│ kata-tcg             │ 33        │ 133         │ 24.62686567164179        │
│ teamcity-highlighter │ 36        │ 122         │ 29.268292682926827       │
│ java-dns-cache-mani… │ 30        │ 111         │ 26.785714285714285       │
│ camunda-bpm-migrati… │ 31        │ 101         │ 30.392156862745097       │
│ libgfapi-jni         │ 35        │ 92          │ 37.634408602150536       │
│ jib                  │ 646       │ 85          │ 751.1627906976744        │
│ morpheus             │ 38        │ 85          │ 44.18604651162791        │
│ jargon2-backends     │ 36        │ 74          │ 48.0                     │
│ aem-healthcheck      │ 32        │ 57          │ 55.172413793103445       │
│ cartographer         │ 32        │ 47          │ 66.66666666666666        │
│ fabric               │ 36        │ 28          │ 124.13793103448276       │
├──────────────────────┼───────────┼─────────────┼──────────────────────────┤
│ Total                │ 59655     │             │                          │
└──────────────────────┴───────────┴─────────────┴──────────────────────────┘
Total number of test cases: 59655
cherylking commented 3 weeks ago

Per discussion in our meeting today, the memory requirement is mainly for the build of the application. For GA, the build must be done by the end user before the test generation or code explanation is called. Therefore, we do not expect an OOM problem with this code. It would not hurt though to specify a larger maxHeapSize (e.g. 4gb) on the Java process when invoking the codeanalyzer from the IDE extension.

Also, do we need to doc dev container based memory requirements? Probably a good idea. Affects VS Code only.

On the topic of providing a pop-up dialog for the end user when a full analysis needs to be done, giving the end user control, it would be nice but not mandatory for GA. As a compromise, we could at least send a notification providing some info on the need to do a full analysis of their app to give better output, thus setting expectations.