GreenDelta / olca-modules

Source code of the openLCA modules
openlca.org
Mozilla Public License 2.0
31 stars 30 forks source link

Calculation via IPC Server Fails With `NullPointerException` #35

Closed kpodl-inoqo closed 1 year ago

kpodl-inoqo commented 2 years ago

[Updated because I messed up the list of "bad" commits]

Hi there,

We are in the process of automating our calculations using the standalone IPC server (org.openlca.ipc) running in a Docker container. Recent commits on master (as of this writing 1a4ac5873f5f690ab7109852c6bb2ca45f97dd90 is the most recent commit) throw exceptions when attempting to run the calculation.

The IPC client (Python olca-ipc==0.0.11) reports an -32000: Unhandled server error: null.

More interestingly, on the server's side:

[NanoHttpd Request Processor (#36)] ERROR org.openlca.ipc.handlers.Calculator - Calculation failed
java.lang.NullPointerException
    at java.base/java.util.Objects.requireNonNull(Objects.java:208)
    at org.openlca.core.matrix.index.TechIndex.of(TechIndex.java:105)
    at org.openlca.core.math.SystemCalculator.with(SystemCalculator.java:89)
    at org.openlca.core.math.SystemCalculator.calculateFull(SystemCalculator.java:84)
    at org.openlca.ipc.handlers.Calculator.calculate(Calculator.java:257)
    at org.openlca.ipc.handlers.Calculator.calculate(Calculator.java:99)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.base/java.lang.reflect.Method.invoke(Method.java:568)
    at org.openlca.ipc.Server$Handler.invoke(Server.java:153)
    at org.openlca.ipc.Server.getResponse(Server.java:127)
    at org.openlca.ipc.Server.serve(Server.java:113)
    at fi.iki.elonen.NanoHTTPD$HTTPSession.execute(NanoHTTPD.java:945)
    at fi.iki.elonen.NanoHTTPD$ClientHandler.run(NanoHTTPD.java:192)
    at java.base/java.lang.Thread.run(Thread.java:833)

Using git bisect I have narrowed the issue down to the following commits (some commits cannot be compiled):

commit 19d4a50cde68b4dc34bedf124272c0ac65197d6c
Author: msrocka <michael.srocka@gmail.com>
Date:   Tue Mar 1 09:58:14 2022 +0100

    fix compiler error in proto-io

commit df31361f2be0c936f08191522266591afe582da1 
Author: msrocka <michael.srocka@gmail.com>
Date:   Mon Feb 28 18:05:15 2022 +0100

    upgrade field names III

commit 9145b972ca43de5e89d42f6b15d6198a5b2c1178
Author: msrocka <michael.srocka@gmail.com>
Date:   Mon Feb 28 18:05:01 2022 +0100

    upgrade field names III

commit 30a7ff2a4c1f742e29c794c3ac7937b36c1790b0
Author: msrocka <michael.srocka@gmail.com>
Date:   Mon Feb 28 16:53:52 2022 +0100

    upgrade field names II

commit 3a508fda642b8b2a3641e03c40168485ce3e9095
Author: msrocka <michael.srocka@gmail.com>
Date:   Mon Feb 28 16:26:43 2022 +0100

    upgrade field names I

commit 5aaf46c6fdd8ef8249439c7494889dffb5d96502
Author: msrocka <michael.srocka@gmail.com>
Date:   Mon Feb 28 14:32:16 2022 +0100

    sync category paths in import

commit 4fb7b4aff059b864224f4888c40b066d9d3b081d (HEAD, refs/bisect/bad)
Author: msrocka <michael.srocka@gmail.com>
Date:   Mon Feb 28 12:55:33 2022 +0100

    add a CategorySync

The last commit that we can run calculations with is:

commit 2d3bb62e33be7e48a6ddc37034133ce05aae83e7 (refs/bisect/good-2d3bb62e33be7e48a6ddc37034133ce05aae83e7)
Author: msrocka <michael.srocka@gmail.com>
Date:   Mon Feb 28 11:24:09 2022 +0100

    replace category references with paths

This is not a particularly urgent issue for us but I thought I'd let you know.

Appreciate your work on openLCA!

msrocka commented 1 year ago

There is an example Docker setup for the IPC server available now: https://github.com/GreenDelta/olca-ipc-container

Please note that not every commit represents a stable or working version. You tested this when version 2 was under development in the main branch. We push the stable libraries to the Maven Central now regularly: https://central.sonatype.com/search?q=olca&namespace=org.openlca