Download Reference Manual
The Developer's Library for D
About Wiki Forums Source Search Contact

Tango cluster issues!

Moderators: kris

Posted: 04/11/09 13:37:09 Modified: 04/11/09 13:37:29

Can not make any use of the tango.net.cluster facilities!!!

1. First off: The following example (taken from the site) works only if compiled with DMD. If compiled with GDC it fails with Segmentation Fault somewhere at the cluster.join call:

Bulletin.d:

module Bulletin;

private import tango.core.Thread;
private import tango.net.cluster.NetworkAlert;
private import tango.net.cluster.tina.Cluster;
private import tango.util.log.Log;
private import tango.util.log.AppendConsole;

void main() {

    // initialize log
    Log.root.add(new AppendConsole());

    // hook into the cluster
    auto cluster = (new Cluster).join;

    // hook into the Alert layer
    auto alert = new NetworkAlert (cluster, "my.kind.of.alert");

    // declare a listener
    void listen (IEvent event) {
        event.log.info ("Received alert on channel " ~ event.channel.name);
    }

    // listen for the broadcast (on this channel)
    alert.createConsumer (&listen);

    // and send everyone an empty alert (on this channel)
    alert.broadcast;

    // wait for it to arrive ...
    Thread.sleep(1);

}

2. Moreover, if I split the code above into 2 distinct programs (BulletinListener?.d and BulletinBroadcaster?.d) and run them concurrently, the BulletinListener? shows the message:

2506 Error cluster.generic - BulletinConsumer: input buffer is empty

BulletinListener?.d:

module BulletinListener;

private import tango.core.Thread;
private import tango.net.cluster.NetworkAlert;
private import tango.net.cluster.tina.Cluster;
private import tango.util.log.Log;
private import tango.util.log.AppendConsole;

void main() {

    // initialize log
    Log.root.add(new AppendConsole());

    // hook into the cluster
    auto cluster = (new Cluster).join;

    // hook into the Alert layer
    auto alert = new NetworkAlert (cluster, "my.kind.of.alert");

    // declare a listener
    void listen (IEvent event) {
        event.log.info ("Received alert on channel " ~ event.channel.name);
    }

    // listen for the broadcast (on this channel)
    alert.createConsumer (&listen);

    // wait for it to arrive ...
    Thread.sleep(10);
}

BulletinBroadcaster?.d:

module BulletinBroadcaster;

private import tango.core.Thread;
private import tango.net.cluster.NetworkAlert;
private import tango.net.cluster.tina.Cluster;
private import tango.util.log.Log;
private import tango.util.log.AppendConsole;

void main() {

    // initialize log
    Log.root.add(new AppendConsole());

    // hook into the cluster
    auto cluster = (new Cluster).join;

    // hook into the Alert layer
    auto alert = new NetworkAlert (cluster, "my.kind.of.alert");

    // and send everyone an empty alert (on this channel)
    alert.broadcast;

    // wait for it to arrive ...
    Thread.sleep(1);

}

Am I doing something wrong? I was looking forward to use tango clustering and now it seems that it is simply not stable at all.

I would appreciate any help in this matter. Thanks.

Checkout Palos::Code.Blog()

Author Message

Posted: 04/11/09 13:52:53

Can you give more information on the GDC version, and maybe a stack trace for the segfault?

Posted: 04/11/09 18:59:55

I use Ubuntu Intrepid Ibex on a x86_64 machine at the office. The GDC version is the one form the Ubuntu official repository (GDC 4.2). The segfault is produced when I run the program under 64bit. When I run it under 32bit (32bit chroot with same OS and packages) it does not produce the segfault but instead it hangs at the same place - at the (new Cluster).join() call.

Right now I'm at home where I run the same configuration but on 32bit hardware so I can not produce the stack-trace for the segfault until I get to my office after the weekend (I will come back then with the proper information). Right now I can only assume the problem to be something related to waiting for data from a socket somewhere when the program instance is advertising itself in the cluster (just an assumption).

Checkout Palos::Code.Blog()

Posted: 04/11/09 19:38:22

Never mind about a stacktrace, that GDC version is br0ken. Try one you can download from the Tango project.

Posted: 04/14/09 19:21:59

But then remains the second problem, which does not work with DMD either. Can you help me there, please?

Checkout Palos::Code.Blog()

Posted: 04/15/09 05:36:42

it's hard to do that, if you don't tell us what the second problem is :)

Posted: 04/15/09 07:33:58

I think it is the one numbered 2 in the first post.

Posted: 04/15/09 10:32:00

Exactly!

Checkout Palos::Code.Blog()