Open martinste1n opened 4 months ago
Hi @martinste1n ,
AdsCallDllFunction.adsAddLocalRoute
calls this function in the Linux ADS library:
https://github.com/Beckhoff/ADS/blob/20d4a67970a6b954b32f6e51caf622da26adc13c/AdsLib/standalone/AmsRouter.cpp#L27
That function does not have a timeout parameter. Please create an issue in the ADS project. If they add a timeout parameter, i can make it accessible in Java.
Maybe you can set a system-wide timeout for DNS lookups? That might be a workaround for your use case.
Best regards, Jannik
Hi,
first thank you very much for the effort you put into this library. It has been a tremendous help!
Nevertheless we are facing an in issue with the following function: https://github.com/Beckhoff/AdsToJava/blob/5a385ffef249f660dc500547ad7f7d3904143204/src/main/java/de/beckhoff/jni/tcads/AdsCallDllFunction.java#L1481
Actually I'm not sure if can be fixed here or in the general ads-lib.
Problem We connect to multiple TC devices and everything works just as expected as long as the machine are online. Yet when the machines are offline / not reachable the call to AdsCallDllFunction.adsAddLocalRoute will block indefinetly. We do not receive a timeout exception or similar.
Here is an excerpt of the code in which we face the issue:
We already implemented our own way to test if the machine is online before we try to connect, yet there are edge cases where the machine is just available yet it wont respond to request yet. If this case arise, the call will block and the whole thread will block. In Java there is no option to interrupt the thread while the JNI Call is ongoing. Therefore we need to kill the whole application, which is not suitable for our use cases.
Possible Solution In our case the optimal solution would be an timeout, after which an exception is thrown or an error code is returned. Yet, I don't know if this can be done inside the ads2java lib or needs to be implemented in the ads-lib additionally.
Thanks in advance! Martin