universAAL / remote

Remote Interoperability Managers that interconnect universAAL across networks
2 stars 1 forks source link

Multitenant Gateway never closes if something goes wrong #484

Closed Alfiva closed 7 years ago

Alfiva commented 7 years ago

Right now this is what happens in MT GW Exporter.java when it is stopped:

while (!executor.awaitTermination(10, TimeUnit.SECONDS)) {
                LogUtils.logInfo(Gateway.getInstance().context, getClass(), "stop",
                        "Timeout waiting for session end operations, waiting some more.");
            }

Which means that, if something is wrong while terminating, it waits 10 seconds and tries again. If what went wrong is not time-dependent and is always going to be wrong, this becomes an infinite loop. I suggest to remove this "while" and simply try the awaitTermination once, with a geneorus timeout. Because right now I always seem to have some problem terminating, so this infinite loop kicks in, and Karaf cannot shutdown, and it leaves the GW port occupied.

Alfiva commented 7 years ago

By the way, I tested my suggestion and seems to work fine, althoguh I have not tested it in real environments yet so I don't know what a good value for timeout would be

Alfiva commented 7 years ago

Fixed in branch b7abe032 (3.4.1-S). Merge into master if this is good enough (45 second timeout)

amedranogil commented 7 years ago

Timeout time should be configurable, the problem is where? MTGW does not have a "central" configuration file for the gateway it self, rather the files configure each connection. Maybe we can reuse the system properties for timeout?

Alfiva commented 7 years ago

I have come to rely on system.properties for all my configurations, so I support that idea