Giter Club home page Giter Club logo

Comments (7)

iegomez avatar iegomez commented on August 22, 2024

Thanks for reporting this. I'll give it a look and try to fix it as soon as possible.

from mosquitto-go-auth.

iegomez avatar iegomez commented on August 22, 2024

I haven't been able to reproduce this. Are you sure it's the plugin the one not returning the file descriptors and not something else? Are you testing this against an HTTP service in the same machine which could potentially be the culprit?

from mosquitto-go-auth.

wattanakorn495 avatar wattanakorn495 commented on August 22, 2024

@iegomez
sorry for late response

i solved it by moving htpp client and http transport into HTTP struct

type HTTP struct {
	UserUri      string
	SuperuserUri string
	AclUri       string
	Host         string
	Port         string
	WithTLS      bool
	VerifyPeer   bool
	ParamsMode   string
	ResponseMode string

	Client    *h.Client
	Transport *h.Transport
}

and initialize inside NewHTTP

	tr := &h.Transport{ 
		TLSClientConfig: &tls.Config{InsecureSkipVerify: true},
	}
	client := &h.Client{Timeout: 5 * time.Second}
	client.Transport = tr
	//Initialize with defaults
	var http = HTTP{
		WithTLS:      false,
		VerifyPeer:   false,
		ResponseMode: "status",
		ParamsMode:   "json",
		Transport:    tr,
		Client:       client,
	}

from mosquitto-go-auth.

mnezerka avatar mnezerka commented on August 22, 2024

Hi all, I see issue is closed, but no there is no fix in codebase. I see same behavior as @wattanakorn495 - both mosquitto and http service run on same machine in my case (two docker containers). Mosquitto quickly consumes all sockets (~54K) under the small load and is not able to open any HTTP requests towards authentication HTTP service anymore.

What was the reason for closing this issue, please?

from mosquitto-go-auth.

iegomez avatar iegomez commented on August 22, 2024

It was closed by the OP because he found a solution. As I wasn't able to reproduce the problem, I didn't make any changes to the code. I'm opening the issue again in case you can provide any more details on the error.

from mosquitto-go-auth.

mnezerka avatar mnezerka commented on August 22, 2024

I was able to reproduce the problem. My setup is simple - single machine with dockers, where mosquitto + auth plugin is running in one docker container, the auth service, written in go, runs in another container. I'm sure it can be reproduced by anybody who tries it, nothing complex to set up.

I first tried to test my auth service independently from fake client, which generated "mosquitto-auth-like" calls (user, superuser, acl), to be sure the consumption of file descriptors isn't on auth service side. It was ok.

Then I found the issue and tried what @wattanakorn495 posted here. I'm talking about this commit in his/her fork: wattanakorn495/mosquitto-go-auth@4f0b3d2. It contains more touches (super user checking, Dockerfile additions). So I finally created this commit in my fork: mnezerka/mosquitto-go-auth@13f2b40. It seems it helped, my server is running more than two days under load and number of file descriptors is constant.

It is sad that I didn't found any bug in your code, I see your are closing Body correctly and I don't see anything smart on moving Client instance up and reusing it for all http requests. That's probably a reason why people have it in forks instead of coming with PR.

from mosquitto-go-auth.

iegomez avatar iegomez commented on August 22, 2024

Thanks for the detailed description. And I agree, it doesn't make sense that the connections leak, but if it's presenting a real problem to users such as yourself then I'll gladly accept a PR with the mentioned change if you're willing to take the time.

from mosquitto-go-auth.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.