Skip to content

Unable to make 340 connections  #238

@liquidharmonic

Description

@liquidharmonic

Hi Everyone,

I've been hitting my head against the wall because I can't make more than 340 connections to a local vernemq server and I have no idea why. I created a simple script to to try to make 350 connections but CONNACKs are not received after the first 340 connections are made.
I have not received the connection limit on my local machine because if I run two instance a total of 680 (340 x 2) connections are established.

Is anyone aware of this bizarre limit ?

PS. My goal is to use this client with locustio for load testing.

My setup

  • python 3.6.0
  • maximum number of file descriptors, 65536
  • local vernemq allows anonymous connections
  • vernemq has all other defaults enabled

test_paho.py

import paho.mqtt.client as mqtt
import threading

connect_count = 0
lock = threading.Lock()
def locust_on_connect(client, flags_dict, userdata, rc):
	global lock
	global connect_count
	print(f"client: {client} connected, rc: {rc}")
	lock.acquire()
	connect_count += 1
	print(f"connect_count: {connect_count}")
	lock.release()

def locust_on_subscribe(client, userdata, mid, granted_qos):
	print(f"client: {client} subscribed, mid: {mid}")	

def log(client, userdata, level, buf):
	print(f"[paho-log][client: {client}] {buf}")

for x in range(0, 350):
	client = mqtt.Client(transport="websockets")

	host = localhost #<local server>
	port = 8888 #<websocket port> 

	client.on_connect = locust_on_connect
	client.connect_async(host, port)
	client.loop_start()

	client.subscribe("/topic", 1)


input("type enter to end")

last few lines of output

connect_count: 339
connect_count: 340

Any help is greatly appreicated.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type: EnhancementA new feature for a minor or major release.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions