JPPF, java, parallel computing, distributed computing, grid computing, parallel, distributed, cluster, grid, cloud, open source, android, .net
JPPF

The open source
grid computing
solution

 Home   About   Features   Download   Documentation   Forums 
October 18, 2019, 03:55:00 PM *
Welcome,
Please login or register.

Login with username, password and session length
Advanced search  
News: New users, please read this message. Thank you!
  Home Help Search Login Register  
Pages: [1]   Go Down

Author Topic: JPPF 5.1.2 awaitConnectionPools  (Read 932 times)

tom

  • JPPF Master
  • ***
  • Posts: 35
JPPF 5.1.2 awaitConnectionPools
« on: June 14, 2016, 09:43:53 PM »

lolo - I have a project on Windows that uses the following snippet of code:

try (JPPFClient jppfClient = new JPPFClient()){
   List<JPPFConnectionPool> pools = jppfClient.awaitConnectionPools (5000L, JPPFClientConnectionStatus.ACTIVE);
   if (!pools.isEmpty()){
      ! Do work

I start the JPPF driver with 30 slaves enabled (the slave log files and the driver log file shows everything connected fine).

When I do this on windows my program runs just fine. When I do this on linux the pools list is empty (even when I change the wait time from 5000 to 50000)! Both OS have the same properties file settings so not sure what the problem could be. [Note: I am running Centos7 for the linux side and Windows 7 for the windows side]. Please advise!
Logged

lolo

  • Administrator
  • JPPF Council Member
  • *****
  • Posts: 2256
    • JPPF Web site
Re: JPPF 5.1.2 awaitConnectionPools
« Reply #1 on: June 15, 2016, 08:50:43 AM »

Hello,

It seems on Linux your client is unable to connect to the driver. Can you tell us which configuration proeprties you are using in your client ?
In the meantime, here are some possible causes you might want to check:
- you are using server discovery (jppf.discovery.enabled = true) and UDP multicast is not allowed or not enabled on your Linux machine
- the driver is running locally and you specify the loopback address for the driver address, i.e. driver1.jppf.server.host = 127.0.0.1. Some Linux distros use another loopback address (I've had this with Ubuntu in the past), try specifiying "driver1.jppf.server.host = localhost" instead
- your specify a host name for the driver, but the host name cannot be resolved. Try using an IP address instead, or adding the host name to your hosts file.

Sincerely,
-Laurent
Logged

tom

  • JPPF Master
  • ***
  • Posts: 35
Re: JPPF 5.1.2 awaitConnectionPools
« Reply #2 on: June 15, 2016, 04:42:50 PM »

Thanks for your prompt response lolo!

I have the client configuration as default (I didn't change any settings in the jppf.properties file).

I believe multicast is enabled, when I do an ifconfig I get:
 enp0s25: <UP, BROADCAST, RUNNING, MULTICAST> inet 169.254.10.58 netmask 255.255.0.0 broadcast 169.254.255.255 . . .
 lo: <UP, LOOPBACK, RUNNING> inet 127.0.0.1 netmask 255.0.0.0 . . .

I still have the same issue when I disable discovery (jppf.discovery.enabled = false) and set "driver1.jppf.server.host=127.0.0.1" or "driver1.jppf.server.host=localhost" or "driver1.jppf.server.host=169.254.10.58".
Logged

tom

  • JPPF Master
  • ***
  • Posts: 35
Re: JPPF 5.1.2 awaitConnectionPools
« Reply #3 on: June 15, 2016, 05:38:14 PM »

So the enp0s25 is the ethernet cord (which has the loopback). I googled and found how to add multicast to the loopback (lo) with the following:
Quote
# route add -net 224.0.0.0 netmask 240.0.0.0 dev lo
# ifconfig lo multicast

which made the lo line read
Quote
lo: <UP, LOOPBACK, RUNNING, MULTICAST> . . .

I redid all of the different configuration changes (including the default) and I still have the same issue.
Logged

tom

  • JPPF Master
  • ***
  • Posts: 35
Re: JPPF 5.1.2 awaitConnectionPools
« Reply #4 on: June 15, 2016, 07:29:00 PM »

So I decided to work with a much easier snippet of code than the chunk of my program. From a different question I had asked (which is solved) you gave me the unit test as follows:

Code: [Select]
import org.jppf.client.*;
import org.jppf.utils.*;

public class TestPools {
  public static void main(final String[] args) {
    int numConnections = 50;
    JPPFConfiguration.getProperties()
      .setString("jppf.drivers", "driver1")
      .setString("driver1.jppf.server.host", "localhost") // set the proper hostname or IP
      .setInt("driver1.jppf.server.port", 11111)
      .setInt("driver1.jppf.pool.size", numConnections)
      .setBoolean("jppf.discovery.enabled", false);

    try (JPPFClient client = new JPPFClient()) {
      JPPFConnectionPool pool = client.awaitActiveConnectionPool();
      pool.awaitActiveConnections(Operator.AT_LEAST, numConnections);
      System.out.println("Got all " + numConnections + " connections");
    } catch(Exception e) {
      e.printStackTrace();
    }
  }
}

[where the solution to have it work when jppf.discovery.enabled = true is to put the code pool.setSize(numConnections) prior to the awaitActiveConnections].

This test works on both the Windows and the Linux OS as is.
If I comment out the "JPPFConfiguration.getPro....;" lines and instead set those values in the jppf.properties file it works fine on the Windows OS but it hangs on the linux side. It is like the properties file is not being loaded for the client on the linux OS.
Note, I assume the awaitConnectionsPools and the awaitActiveConnections routines share the same underlying code.
Logged

lolo

  • Administrator
  • JPPF Council Member
  • *****
  • Posts: 2256
    • JPPF Web site
Re: JPPF 5.1.2 awaitConnectionPools
« Reply #5 on: June 15, 2016, 10:05:01 PM »

Hello,

Quote
It is like the properties file is not being loaded for the client on the linux OS.

Yes, I suspect this is exactly what is happening. Can you check that the script you use to launch your application, or the run configuration in your IDE, has the system property -Djppf.config=path/to/jppf.properties and that it points to the right file? The path may point to a location on the file system or in the classpath, and JPPF will look them up in that order. For the config file lookup details, please take a look at the related documentation.

Quote
I assume the awaitConnectionsPools and the awaitActiveConnections routines share the same underlying code.

They use a common API for waiting on a timed conidtion, namely the methods in the ConcurrentUtils class.

Sincerely,
-Laurent
« Last Edit: June 15, 2016, 10:15:28 PM by lolo »
Logged
Pages: [1]   Go Up
 
JPPF Powered by SMF 2.0 RC5 | SMF © 2006–2011, Simple Machines LLC Get JPPF at SourceForge.net. Fast, secure and Free Open Source software downloads