Deepstream test4 and AMQP nvmsg-broker error

Hi,

I’ve been trying to run the “deepstream test4” example with AMQP for some time, both in C ++ and in Python I get the same error. I am using Pika to create the “Consumer” service.
I have already seen other queries in this forum with a similar error, but the solution is not clear for me, I have the feeling that it may be in my pika server file, but when I run the Pika base example, sending and receiving works perfectly.

(All the above deepstream examples (1,2,3) work perfectly for me)


$ sudo service rabbitmq-server status


rabbitmq-server.service - RabbitMQ Messaging Server
Loaded: loaded (/lib/systemd/system/rabbitmq-server.service; enabled; vendor
Active: active (running)


cfg_amqp.txt

[message-broker]
password = guest
#optional
hostname = localhost
username = guest
port = 5672
exchange = amq.topic
topic = topicname

receive.py

#!/usr/bin/env python
import pika

credentials = pika.PlainCredentials('guest', 'guest')
connection = pika.BlockingConnection( pika.ConnectionParameters('localhost', 5672, '/', credentials) )

channel = connection.channel()
channel.queue_declare(queue='hello')
channel.exchange_declare(exchange='topic_logs', exchange_type='topic')

def callback(ch, method, properties, body):
    print(" [x] Received %r" % body)

channel.basic_consume(queue='hello', on_message_callback=callback, auto_ack=True)

print(' [*] Waiting for messages. To exit press CTRL+C')
channel.start_consuming()

run command

python3 deepstream_test_4.py -i /opt/nvidia/deepstream/deepstream-4.0/samples/streams/sample_720p.h264 -p /opt/nvidia/deepstream/deepstream-4.0/lib/libnvds_amqp_proto.so --cfg-file cfg_amqp.txt -s 1

./deepstream-test4-app -i /opt/nvidia/deepstream/deepstream-4.0/samples/streams/sample_720p.h264 -p /opt/nvidia/deepstream/deepstream-4.0/lib/libnvds_amqp_proto.so --conn-str="localhost;5672;guest" --cfg-file cfg_amqp.txt -s 0

I already checked that the file “/opt/nvidia/deepstream/deepstream-4.0/lib/libnvds_amqp_proto.so” exists
And I already tried changing the log level but I don’t have any other useful information.
$ export GST_DEBUG=4


Error (Py): deepstream_test_4.py

Creating Pipeline 
Creating Source 
Creating H264Parser 
Creating Decoder 
Creating EGLSink 
Playing file /opt/nvidia/deepstream/deepstream-4.0/samples/streams/sample_720p.h264 
Adding elements to Pipeline 
Linking elements in the Pipeline 
Starting pipeline 
deepstream_test_4.py:484: Warning: g_strrstr: assertion 'haystack != NULL' failed
  pipeline.set_state(Gst.State.PLAYING)
Error: gst-library-error-quark: Could not initialize supporting library. (3): gstnvmsgbroker.c(303): gst_nvmsgbroker_start (): /GstPipeline:pipeline0/GstNvMsgBroker:nvmsg-broker:

Error (C++): deepstream-test4-app

(deepstream-test4-app:10943): GLib-CRITICAL **: 16:41:24.017: g_strchug: assertion 'string != NULL' failed

(deepstream-test4-app:10943): GLib-CRITICAL **: 16:41:24.017: g_strchomp: assertion 'string != NULL' failed
Now playing: /opt/nvidia/deepstream/deepstream-4.0/samples/streams/sample_720p.h264
Running...
ERROR from element nvmsg-broker: Could not initialize supporting library.
Error details: gstnvmsgbroker.c(303): gst_nvmsgbroker_start (): /GstPipeline:dstest4-pipeline/GstNvMsgBroker:nvmsg-broker:
unable to open shared library
Returned, stopping playback
Deleting pipeline

Versions:

deepstream-app version 4.0.2
DeepStreamSDK 4.0.2
TensorRT 6.0.1-1+cuda10.2
Nvidia GTX 1070 (laptop)
CPU i7-7820HK @ 2.90GHz × 8
Ubuntu 18.04


Could someone help me please?

1 Like

ERROR from element nvmsg-broker: Could not initialize supporting library.
Error details: gstnvmsgbroker.c(303): gst_nvmsgbroker_start (): /GstPipeline:dstest4-pipeline/GstNvMsgBroker:nvmsg-broker:
unable to open shared library

–> Please run the command from test4 sample directory to give a try.

Sorry for the delay in my reply.
I’m running the command from the example root folder in both python and c ++, but it still doesn’t work. Could you please share an example with a server that receives the metadata?

Today I found my mistake. I post it in case it helps someone else.

I was missing dependencies, I skipped an important step when I compiled rabbitmq-c, to copy the built librabbitmq.so library to its final location

sudo cp librabbitmq/librabbitmq.so.4 /opt/nvidia/deepstream/deepstream-<version>/lib/


If someone wants to use rabbitmq with python (via pika), I share an receiver example that works

receive.py

#!/usr/bin/env python
import pika

credentials = pika.PlainCredentials('guest', 'guest')
connect_param = pika.ConnectionParameters(
	host='localhost',
	credentials=credentials
)
connection = pika.BlockingConnection(connect_param)

channel = connection.channel()
channel.exchange_declare(exchange='ds_exchange', exchange_type='topic', durable=False, auto_delete=True)
result = channel.queue_declare(queue='', exclusive=True)
queue_name = result.method.queue
print('qname: ', queue_name)

channel.queue_bind(exchange='ds_exchange', queue=queue_name, routing_key='ds_topic')

def callback(ch, method, properties, body):
	print(" [x] Received %r" % body)


channel.basic_consume(queue=queue_name, on_message_callback=callback, auto_ack=True)

print(' [*] Waiting for messages. To exit press CTRL+C')
channel.start_consuming()

cfg_amqp.txt

[message-broker]
password = guest
#optional
hostname = localhost
username = guest
port = 5672
exchange = ds_exchange
topic = ds_topic

Run command

python3 deepstream_test_4.py -i /opt/nvidia/deepstream/deepstream-4.0/samples/streams/sample_720p.h264 -p /opt/nvidia/deepstream/deepstream-4.0/lib/libnvds_amqp_proto.so --cfg-file cfg_amqp.txt
or (c++)
./deepstream-test4-app -i /opt/nvidia/deepstream/deepstream-4.0/samples/streams/sample_720p.h264 -p /opt/nvidia/deepstream/deepstream-4.0/lib/libnvds_amqp_proto.so --cfg-file cfg_amqp.txt -s 0

The README file located at /opt/nvidia/deepstream/deepstream-4.0/sources/libs/amqp_protocol_adaptor was really useful for test.


To test receive.py

send.py

#!/usr/bin/env python
import pika

connection = pika.BlockingConnection( pika.ConnectionParameters(host='localhost', port=5672))

channel = connection.channel()

message = "Hello World!"
channel.basic_publish(exchange='ds_exchange', routing_key='ds_topic', body=message)

print(" [x] Sent %r" % message)
connection.close()

Thanks for sharing.

Is this, rabbit-mq receiver / pika is running on the same jetson device or any other system on the same network ?

You can do both (I tried it successfully), even on another network with a DNS or a Public IP, but, there is an important point to keep in mind.
Be aware that the “guest” account can only connect via localhost
(https://www.rabbitmq.com/access-control.html#loopback-users)

If you created a user through the command line (let’s say: sudo rabbitmqctl add_user admin admin) make sure your user has access to virtual host “/”.

Follow this steps to check this (or create another).

  1. sudo rabbitmq-plugins enable rabbitmq_management
  2. Open a browser window and enter http://localhost:15672/#/users
  3. User: “guest”, Pass: “guest” (then click “Login” button)
  4. In the table check column “Can access virtual hosts”, it must have a “/” for your user
  5. If you don’t have it, give that user permission to virtual host “/”. Click user’s name then click “set permission”
  6. (If you want to create a new user from RabbitMQ Management. In step 3 click the button “Add user”, fill in the form with the new user and password, and continue with step 5)

if you do this, you can use an IP or DNS instead of localhost, and transfer the metadata to different machines on the same or different networks.

(Remember to change the credentials in the file receive.py and cfg_amqp.txt )

I hope it helps you

camilosilva91
Many many thanks for putting it all together.

1 Like