Craig Craig - 2 months ago 16
Python Question

How can I debug a connection issue within VOLTTRON?

I am connecting to an external VOLTTRON instance. I am not getting a response from the connection. What's the issue?

I am writing a simple python script to connect to an external platform and retrieve the peers. If I get the serverkey, clientkey, and/or publickey incorrect I don't know how to determine which is the culprit, from the client side. I just get a gevent timeout. Is there a way to know?

import os

import gevent
from import Agent

secret = "secret"
public = "public"
serverkey = "server"
tcp_address = "tcp://external:22916"

agent = Agent(address=tcp_address, serverkey=serverkey, secretkey=secret,
event = gevent.event.Event()
greenlet = gevent.spawn(, event)
print("My id: {}".format(agent.core.identity))
peers =
for p in peers:


The short answer: no, the client cannot determine why its connection to the server failed. The client will attempt to connect until it times out.

Logs and debug messages on the server side can help troubleshoot a connection problem. There are three distinct messages related to key errors:

  1. CURVE I: cannot open client HELLO -- wrong server key?
    Either the client omit the server key, the client used the wrong server key, or the server omit the secret key.

  2. CURVE I: cannot open client INITIATE vouch
    Either the client omit the public or secret key, or its public and secret keys don't correspond to each other.

  3. authentication failure
    The server key was correct and the secret and public keys are valid, but the server rejected the connection because the client was not authorized to connect (based on the client's public key).

The first two messages are printed by libzmq. To see the third message volttron must be started with increased verboseness (at least -v).

Here is a simple ZMQ server-client example you can use to test some of these scenarios:


import zmq 

context = zmq.Context()
socket = context.socket(zmq.REP)
socket.curve_server = 1 
socket.curve_secretkey = "mW4i2O{kmcOXs9q>UP0(no4-Sp1r(p>vK?*NFwV$"
# The corresponding public key is "krEC0>hsx+o4Jxg2yvitCOVwr2GF85akNIsUdiH5"

while True:
    msg = socket.recv()
    new_msg = "I got the message: {}".format(msg)


import zmq 

pub, sec = zmq.curve_keypair()
context = zmq.Context()
socket = context.socket(zmq.REQ)
socket.curve_secretkey = sec 
socket.curve_publickey = pub 
socket.curve_serverkey = "krEC0>hsx+o4Jxg2yvitCOVwr2GF85akNIsUdiH5"

msg = socket.recv()
print("From the server: {}".format(msg))