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

wsasend: An existing connection was forcibly closed by the remote host. #364

Closed
dpajkovic opened this issue Apr 1, 2022 · 3 comments
Closed

Comments

@dpajkovic
Copy link

Hello,

Running LDAP as a long-running service, after some time I get my error logs filled with the following errors:

tls: failed to send closeNotify alert (but connection was closed anyway): write tcp <local IP address>:63427-><ip address of ldap server>:3269: wsasend: An existing connection was forcibly closed by the remote host.

The LDAP functions keep working without any issue, it's just a matter of logs filling up.

If it's an important piece of information, the LDAP server address is a network load balanced address, and there are also firewalls (that of course let the LDAP connections through but might be picky when it comes to connection kept alive for long time).

@cpuschma
Copy link
Member

I don't think this is a library specific problem. I've been running a LDAP proxy using this lib which keeps a pool of open connections for as long as possible open for faster queries. I only got connection error messages when the directory server closed it on their end or if I lost my internet connection.

@dpajkovic
Copy link
Author

dpajkovic commented Apr 13, 2022

Is there at least a way to stop this from filling up error logs? It is not going through the logging I have set up, and the error is not getting reported up the stack to any error I check for. I don't mind error itself, the application keeps on chugging, it's just the logs that bother me.

@cpuschma
Copy link
Member

cpuschma commented Apr 13, 2022

This depends on how you implemented error logging. The simpliest version would be to check the error message:

import (
	"fmt"
	"strings"
)

func main() {
	err := fmt.Errorf("tls: failed to send closeNotify alert (but connection was closed anyway): write tcp <local IP address>:63427-><ip address of ldap server>:3269: wsasend: An existing connection was forcibly closed by the remote host.")
	fmt.Println(strings.HasSuffix(err.Error(), "An existing connection was forcibly closed by the remote host."))
}

+ In the latest PR (which isn't in a release yet) you can configure a logger: #366

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