Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Why it not work in 2 machines? #258

Closed
MizukiSonoko opened this issue Jul 12, 2016 · 12 comments
Closed

Why it not work in 2 machines? #258

MizukiSonoko opened this issue Jul 12, 2016 · 12 comments

Comments

@MizukiSonoko
Copy link

Hello, I developing application using Aeron.
I have question.
I have 2 machines and want to communicate using aeron.
First machine:
running media driver, and

Aeron.addSubscription(aeron:udp?endpoint="second machine IP":40123, streamId);

Second machine:
running media driver, and

Aeron.addPublication(aeron:udp?endpoint="first machine IP:40123", streamId);

Why it not work?

@mjpt777
Copy link
Contributor

mjpt777 commented Jul 12, 2016

Sorry but there is not sufficient information here to diagnose the issue. What errors are you seeing? Can you make a UDP connection without using Aeron? Are you sure you have the IP addresses correct? Do you have firewalls in the way?

@MizukiSonoko
Copy link
Author

Thanks.

Can you make a UDP connection without using Aeron? Are you sure you have the IP addresses correct? Do you have firewalls in the way?

no problem
This script ran correctly.

user@second-machine$ echo "This is a test" | nc -u first-machine 40123

and

user@first-machine$ nc -u -l 40123

Detail of status is

  • environments
    OS: Ubuntu 16.04 LTS
  • 1 Running media driver in first and second machines.
user@first-machine$  java -cp aeron-samples/build/libs/samples.jar io.aeron.driver.MediaDriver
user@second-machine$  java -cp aeron-samples/build/libs/samples.jar io.aeron.driver.MediaDriver
  • 2 Write my code is like Basic{Subscriber|Publication}.
    ...
Aeron.addSubscription(aeron:udp?endpoint="second machine IP":40123, streamId);

...

Aeron.addPublication(aeron:udp?endpoint="first machine IP:40123", streamId);

...

  • 3 make, run, and result
user@first-machine$ ./peer
Subscribe mode

user@second-machine$ ./peer
Publish mode

Neither of these, no error, no stdout.

Thanks

@mjpt777
Copy link
Contributor

mjpt777 commented Jul 12, 2016

Thanks. If you run AeronStat on each machine you will see the connections appear, or not, in the position counters.

To debug try the tools on the page below:

https://github.com/real-logic/Aeron/wiki/Monitoring-and-Debugging

@MizukiSonoko
Copy link
Author

Thanks

I ran

user@first-machine$ java -cp aeron-samples/build/libs/samples.jar   -javaagent:aeron-agent/build/libs/aeron-agent-0.9.10-SNAPSHOT-all.jar   -Daeron.event.log=admin,FRAME_IN   io.aeron.driver.MediaDriver

result

WARNING: /dev/shm/aeron-ubuntu already exists.
INFO: Aeron directory /dev/shm/aeron-ubuntu exists
INFO: Aeron CnC file /dev/shm/aeron-ubuntu/cnc.dat exists
INFO: Aeron toDriver consumer heartbeat is 15985 ms old
TRANSFORM io.aeron.driver.media.ReceiveChannelEndpoint
TRANSFORM io.aeron.driver.media.SendChannelEndpoint
TRANSFORM io.aeron.driver.ClientProxy
TRANSFORM io.aeron.driver.ReceiverProxy
TRANSFORM io.aeron.driver.SenderProxy
TRANSFORM io.aeron.driver.DriverConductor
[109202.266126] CMD_IN_ADD_SUBSCRIPTION [71/71]: aeron:udp?endpoint=second-machine:40123 12 [-1][0:1]
[109202.340813] RECEIVE_CHANNEL_CREATION [104/104]: UdpChannel - localData: 0.0.0.0/0.0.0.0:0, remoteData: /second-machine:40123, ttl: 0
[109202.359479] CMD_OUT_ON_OPERATION_SUCCESS [16/16]: [0:1]
[109202.763660] CMD_IN_KEEPALIVE_CLIENT [16/16]: [0:0]
[109203.263965] CMD_IN_KEEPALIVE_CLIENT [16/16]: [0:0]
[109203.768674] CMD_IN_KEEPALIVE_CLIENT [16/16]: [0:0]
[109204.269099] CMD_IN_KEEPALIVE_CLIENT [16/16]: [0:0]
[109204.770394] CMD_IN_KEEPALIVE_CLIENT [16/16]: [0:0]
[109205.274429] CMD_IN_KEEPALIVE_CLIENT [16/16]: [0:0]
[109205.775214] CMD_IN_KEEPALIVE_CLIENT [16/16]: [0:0]

and

user@second-machine$ java -cp aeron-samples/build/libs/samples.jar   -javaagent:aeron-agent/build/libs/aeron-agent-0.9.10-SNAPSHOT-all.jar   -Daeron.event.log=admin,FRAME_IN   io.aeron.driver.MediaDriver

result

WARNING: /dev/shm/aeron-ubuntu already exists.
INFO: Aeron directory /dev/shm/aeron-ubuntu exists
INFO: Aeron CnC file /dev/shm/aeron-ubuntu/cnc.dat exists
INFO: Aeron toDriver consumer heartbeat is 47562 ms old
TRANSFORM io.aeron.driver.media.ReceiveChannelEndpoint
TRANSFORM io.aeron.driver.media.SendChannelEndpoint
TRANSFORM io.aeron.driver.ClientProxy
TRANSFORM io.aeron.driver.ReceiverProxy
TRANSFORM io.aeron.driver.SenderProxy
TRANSFORM io.aeron.driver.DriverConductor
[90310.889630] CMD_IN_ADD_PUBLICATION [63/63]: aeron:udp?endpoint=first-machine:40123 12 [0:1]
[90310.947686] SEND_CHANNEL_CREATION [104/104]: UdpChannel - localData: 0.0.0.0/0.0.0.0:0, remoteData: /first-machine:40123, ttl: 0
[90311.185585] CMD_OUT_PUBLICATION_READY [111/111]: -791769768:12 23 [1]
    /dev/shm/aeron-ubuntu/publications/UDP-00000000-0-3b6addd3-40123-D0CE8D58-C-1.logbuffer
[90311.389157] CMD_IN_KEEPALIVE_CLIENT [16/16]: [0:0]
[90311.890443] CMD_IN_KEEPALIVE_CLIENT [16/16]: [0:0]
[90312.394918] CMD_IN_KEEPALIVE_CLIENT [16/16]: [0:0]
[90312.897572] CMD_IN_KEEPALIVE_CLIENT [16/16]: [0:0]
...
  • AeronStat
    first-machine
19:04:20 - Aeron Stat
=========================
  0:                    0 - Bytes sent
  1:                    0 - Bytes received
  2:                    0 - Failed offers to ReceiverProxy
  3:                    0 - Failed offers to SenderProxy
  4:                    0 - Failed offers to DriverConductorProxy
  5:                    0 - NAKs sent
  6:                    0 - NAKs received
  7:                    0 - Status Messages sent
  8:                    0 - Status Messages received
  9:                    0 - Heartbeats sent
 10:                    0 - Heartbeats received
 11:                    0 - Retransmits sent
 12:                    0 - Flow control under runs
 13:                    0 - Flow control over runs
 14:                    0 - Invalid packets
 15:                    1 - Errors
 16:                    0 - Short sends
 17:                   83 - Client keep-alives
 18:                    0 - Sender flow control limits applied
 19:                    0 - Unblocked Publications
 20:                    0 - Unblocked Control Commands
 21:                    0 - Possible TTL Asymmetry
 22:                   -1 - recv-channel: aeron:udp?endpoint=second-machine:40123
--

second-machine

19:04:19 - Aeron Stat
=========================
  0:                    0 - Bytes sent
  1:                    0 - Bytes received
  2:                    0 - Failed offers to ReceiverProxy
  3:                    0 - Failed offers to SenderProxy
  4:                    0 - Failed offers to DriverConductorProxy
  5:                    0 - NAKs sent
  6:                    0 - NAKs received
  7:                    0 - Status Messages sent
  8:                    0 - Status Messages received
  9:                    0 - Heartbeats sent
 10:                    0 - Heartbeats received
 11:                    0 - Retransmits sent
 12:                    0 - Flow control under runs
 13:                    0 - Flow control over runs
 14:                    0 - Invalid packets
 15:                    0 - Errors
 16:                    0 - Short sends
 17:                  131 - Client keep-alives
 18:                    1 - Sender flow control limits applied
 19:                    0 - Unblocked Publications
 20:                    0 - Unblocked Control Commands
 21:                    0 - Possible TTL Asymmetry
 22:                    1 - send-channel: aeron:udp?endpoint=first-machine:40123
 23:                    0 - pub-lmt: 1 -630650780 12 aeron:udp?endpoint=first-machine:40123
 24:                    0 - snd-pos: 1 -630650780 12 aeron:udp?endpoint=first-machine:40123
--

Thanks

@mjpt777
Copy link
Contributor

mjpt777 commented Jul 12, 2016

Note the first-machine has an error recorded. Use the ErrorStat program to find out what it is.

@MizukiSonoko
Copy link
Author

Thanks

I get this error when only Subscription. Even if reverse a role, the same state.

***
1 observations from 2016-07-12 19:42:09.640+0900 to 2016-07-12 19:42:09.640+0900 for:
 .lang.RuntimeException: channel "aeron:udp?endpoint=second-machine:40123" : java.net.BindException: Cannot assign requested address
    at io.aeron.driver.media.UdpChannelTransport.openDatagramChannel(UdpChannelTransport.java:127)
    at io.aeron.driver.media.ReceiveChannelEndpoint.openChannel(ReceiveChannelEndpoint.java:127)
    at io.aeron.driver.Receiver.onRegisterReceiveChannelEndpoint(Receiver.java:115)
    at io.aeron.driver.cmd.RegisterReceiveChannelEndpointCmd.execute(RegisterReceiveChannelEndpointCmd.java:32)
    at io.aeron.driver.Receiver.accept(Receiver.java:134)
    at io.aeron.driver.Receiver.accept(Receiver.java:36)
    at org.agrona.concurrent.OneToOneConcurrentArrayQueue.drain(OneToOneConcurrentArrayQueue.java:106)
    at io.aeron.driver.Receiver.doWork(Receiver.java:64)
    at org.agrona.concurrent.AgentRunner.run(AgentRunner.java:106)
    at java.lang.Thread.run(Thread.java:745)
Caused by: java.net.BindException: Cannot assign requested address
    at sun.nio.ch.Net.bind0(Native Method)
    at sun.nio.ch.Net.bind(Net.java:433)
    at sun.nio.ch.DatagramChannelImpl.bind(DatagramChannelImpl.java:691)
    at io.aeron.driver.media.UdpChannelTransport.openDatagramChannel(UdpChannelTransport.java:103)
    ... 9 more


1 distinct errors observed.

thanks

@mjpt777
Copy link
Contributor

mjpt777 commented Jul 12, 2016

The question then is why is a bind failing to that address on your machine?

@MizukiSonoko
Copy link
Author

Thanks

That's correct.
receiveDatagramChannel failed binding to that address when subscriber.

@mjpt777
Copy link
Contributor

mjpt777 commented Jul 12, 2016

So do you know what to do now to close the issue?

@MizukiSonoko
Copy link
Author

MizukiSonoko commented Jul 12, 2016

Sorry I don't know solution.

but, I try to improve it now.

@MizukiSonoko
Copy link
Author

Thanks,

I misunderstood.

In first machine.

Aeron.addPublication(aeron:udp?endpoint="second machine IP":40123, streamId);

and, I must write "endpoint="second machine IP" in second machine.

Aeron.addSubscription(aeron:udp?endpoint="second machine IP":40123, streamId);

Subscriber's endpoint is own IP.

It works correctly.

Thanks!!

@mjpt777
Copy link
Contributor

mjpt777 commented Jul 12, 2016

That's it. :-)

Sorry I did not realise this is what you were doing earlier. Not using actual IP addresses or machine names threw me off.

@mjpt777 mjpt777 closed this as completed Jul 12, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants