cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
krish_indus
Level 4

Setting License Client connect timeout.

Hi All,

If there is no License server running or if we try to connect to dummy ip, the subsequent checkout didn't return and at times the checkout method taking more time get time out( >20 minutes ). Please let me know, how can i specify the timeout for the license client.

Thanks in advance.
Krish.
Labels (1)
0 Kudos
(14) Replies
RobertDickau
Flexera Alumni

Could you provide a bit more detail about your setup? For example, it appears you're using the Java FLEXnet API---is that correct? How are you specifying the invalid server IP information?
0 Kudos
krish_indus
Level 4

Hi ,

Thanks for your response on this. Yes, i am using the Java FlexNet API. Here is flow which i have followed.
1.During the License client initialization the, LicenseSource object is created using the LicenseSource.createLicenseSource(String licenseServerName,VendorInfo vendorInfo,ConnectionData connData) method.
2. Then will create the FeatureSpecifier object using FeatureSpecifier(String featureName,String version).
3. Then create the License object using License(FeatureSpecifier fs, LicenseSource ls).

Please let me know if you need more deatils.

Thanks agin for your quick response.

Regards,
Krish.
0 Kudos
RobertDickau
Flexera Alumni

If you look at the sample ConnDataExample.java source file in the toolkit, the getServerTimeout method is implemented to return a hard-coded 20-minute timeout value; perhaps change to a smaller value in your implementation class that sets up ConnectionData behavior?

(Presumably that timeout is for the server side, but the 20-minute figure is quite a coincidence. As a test, does it make any difference if you don't use a ConnectionData object?)
0 Kudos
krish_indus
Level 4

Hi Robert,

I have overrided the getServerTimeout() method as to return the timeout value as 1 minute. After this also the license client connect didn't timeout and it is taking time.

Also i tried without the ConnectionData object, but the result is same.

Please help me in over coming this issue.

Thanks,
Krish.
0 Kudos
RobertDickau
Flexera Alumni

What is the error message when the connection finally times out? For my example (which returns very quickly, 10 or 15 seconds), the message is:

Can't Connect to License Server (-15,3002) (fakehost)
0 Kudos
krish_indus
Level 4

Hi Robert ,

Yes, i do get the same error after the time out. Given below is the exception trace.

Can't Connect to License Server (-15,3002) (Connection timed out)
com.macrovision.flexlm.FlexlmException: Can't Connect to License Server (-15,3002) (Connection timed out).


Regards,
Krish.
0 Kudos
RobertDickau
Flexera Alumni

A couple of the usual questions: does this happen on multiple systems? Does it happen with a simple application (my example is a modified version of BasicExample.java from the toolkit)? I'm not aware of any attribute settings that affect the client-timeout interval, only the server-timeout interval...
0 Kudos
krish_indus
Level 4

Hi Robert,

I have tried in 3 different machines but the result is same. Also, the it is taking time with modified version of BasicExample to get timeout. I just want to know whether is there is any way available in License client api to set the timeout for the Socket created from the License client to License Server.

prio=1 tid=0x086f4d18 nid=0x68fd runnable [0x79302000..0x79303470]
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:333)
- locked <0x60d02bf8> (a java.net.SocksSocketImpl)
at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:195)
at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:182)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:364)
at java.net.Socket.connect(Socket.java:507)
at java.net.Socket.connect(Socket.java:457)
at java.net.Socket.(Socket.java:365)
at java.net.Socket.(Socket.java:178)
at com.macrovision.flexlm.licsource.LicenseServer.connect(LicenseServer.java:378)
at com.macrovision.flexlm.licsource.LicenseServer.sendMessage(LicenseServer.java:2080)
- locked <0x602e1b88> (a com.macrovision.flexlm.licsource.LicenseServer)
at com.macrovision.flexlm.licsource.LicenseServer.tryCheckout(LicenseServer.java:931)
- locked <0x602e1b88> (a com.macrovision.flexlm.licsource.LicenseServer)
at com.macrovision.flexlm.licsource.LicenseServer.checkout(LicenseServer.java:874)
at com.macrovision.flexlm.License.reconnect(License.java:324)
at com.macrovision.flexlm.License.checkout(License.java:284)


The above thread dump is taken when the problem occured. From the above trace I believe the Socket object creation taking time with the invalid ipadress . Please help me if we can set a time out with the flexlm api for this Socket creation.

Thanks for your continued support on this.

Regards,
Krish.
0 Kudos
RobertDickau
Flexera Alumni

Hello, Krish,

Looking through the Javadoc help for the FLEXnet Java API, I see no setting to control the client's TCP timeout; since the BasicExample code behaves differently on your system from mine, I'm led to believe it's a network-specific issue. Does any other socket-based Java program behave similarly?

I think Sun's Java Tutorial has a simple client example, or below is one that might work as a quick test.

Or if possible, could you try the application on a system on a different network?

Robert

[code]// FakeClient.java
// usage: java FakeClient localhost 27000

import java.io.*;
import java.net.*;

public class FakeClient {
public static void main(String[] args) throws IOException {

Socket testSocket = null;

if (args.length != 2)
{
System.out.println("Usage: java FakeClient ");
System.exit(0);
}

try {
testSocket = new Socket(args[0], Integer.parseInt(args[1]));
} catch (UnknownHostException e) {
System.err.println("Unknown host " + args[0] + ".");
e.printStackTrace( );
System.exit(1);
} catch (IOException e) {
System.err.println("I/O problems with " +
"the connection to: " + args[0] + ".");
e.printStackTrace( );
System.exit(1);
}
System.out.println("Host and port seem okay.");
testSocket.close( );
}
}[/code]
0 Kudos
krish_indus
Level 4

Hi Robert,

I have tried with the modified verison(just added the start time and end time) of the given fake client example and here is the output.

I was in the 192.168.118.0 network . i have tried this example with non-existent ips in the same subnet(192.168.118.5) and in a different subnet(192.168.113.241 & 192.168.114.241).

Out put from same subnet ::
----------------------------------------
java test.FakeClient 192.168.118.5 27000
Start time Thu, 28 Jun 2007 19:11:32 +0000
I/O problems with the connection to: 192.168.118.5.
java.net.NoRouteToHostException: No route to host
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:333)
at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:195)
at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:182)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:364)
at java.net.Socket.connect(Socket.java:507)
at java.net.Socket.connect(Socket.java:457)
at java.net.Socket.(Socket.java:365)
at java.net.Socket.(Socket.java:178)
at test.FakeClient.main(FakeClient.java:25)
End time Thu, 28 Jun 2007 19:11:35 +0000


Out put from different subnet ::
-----------------------------------------------------------------
java test.FakeClient 192.168.113.241 27000
Start time Thu, 28 Jun 2007 17:28:49 +0000
I/O problems with the connection to: 192.168.113.241.
java.net.ConnectException: Connection timed out
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:333)
at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:195)
at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:182)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:364)
at java.net.Socket.connect(Socket.java:507)
at java.net.Socket.connect(Socket.java:457)
at java.net.Socket.(Socket.java:365)
at java.net.Socket.(Socket.java:178)
at test.FakeClient.main(FakeClient.java:25)
End time Thu, 28 Jun 2007 17:31:58 +0000
------------------------------------------------------------------
java test.FakeClient 192.168.114.241 27000
Start time Thu, 28 Jun 2007 17:32:18 +0000
I/O problems with the connection to: 192.168.114.241.
java.net.ConnectException: Connection timed out
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:333)
at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:195)
at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:182)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:364)
at java.net.Socket.connect(Socket.java:507)
at java.net.Socket.connect(Socket.java:457)
at java.net.Socket.(Socket.java:365)
at java.net.Socket.(Socket.java:178)
at test.FakeClient.main(FakeClient.java:25)
End time Thu, 28 Jun 2007 17:35:27 +0000
---------------------------------------------------------------------

It is taking time when we tried with the non-exitent ip in a different subnet . Is it possible for to you test the this example in your envoronment for a non-existent ip in a different subnet.

Thanks,
Krish.
0 Kudos
RobertDickau
Flexera Alumni

Krish,

I can verify similar behavior when running the sample program to try to connect to a nonexistent server on a different subnet: on one test Linux system, there's about a 10-minute delay between the socket creation and the message "java.net.ConnectException: Connect timed out". Trying the same test on a Windows client system seems to return very quickly (the same 10-15 seconds I mentioned before).

From memory, I don't know enough about socket-handing in Java to see how to control the timeout; but since it seems independent of the FLEXnet library, perhaps there is a way to quickly test the connection with plain Java before making the FLEXnet checkout request...

Robert
0 Kudos
krish_indus
Level 4

Hi Robert,

Thanks for the test in your environment.

I believe you mean that, before the checkout request, the application need to check if the given license server ip reachable or not by creating a Socket object. In that case if we try to create a Socket before every checkout request it will turnout to be a costly opertaion if the the license server is running.

Moreover, in our application we may need to checkout > 2000 licenses. So checking the license server avilablity before every checkout request will take time and costly.

So it will be helpful if we have some option to set timeout thru flexlm api for the socket creation.


Thanks,
Krish.
0 Kudos
RobertDickau
Flexera Alumni

Hi, Krish,

Actually, I would hope that a single socket-existence-test before the first checkout would be sufficient, as opposed to before each checkout.

I agree that a timeout setting would be useful to have, if possible. The reason I posted the socket-test code is to investigate if Java is capable of expressing a timeout that would speed up the process. (In that sample code I posted, even if I add testSocket.setSoTimeout(1000) to specify a short timeout, the long delay occurs on the Linux system. Perhaps a different constructor would make a difference?)

In any case, I'll see if I can get this into the investigation queue at this end, and you might consider submitting a feature request through your support plan, or otherwise providing feedback here: http://www.macrovision.com/feedback/index.shtml.

Thanks,

Robert
0 Kudos
krish_indus
Level 4

Hi Robert,

Thanks for all your help on this. Really appreciate it.

Regards,
Krish.
0 Kudos