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

Error when sending a large number of mails #132

Open
adharshgec opened this issue Apr 2, 2020 · 2 comments
Open

Error when sending a large number of mails #132

adharshgec opened this issue Apr 2, 2020 · 2 comments
Labels

Comments

@adharshgec
Copy link

So I'm doing a performance test of an application that sends mails. The application and mailslurper is setup using docker-compose and I'm using the default custom-config.json file. When the number of mails reaches the 13000th mark, mailslurper is throwing this error:

level=error msg="Error adding connection '172.21.0.7:42662' to connection manager" 
error="Connection on '172.21.0.7:42662' already exists" who="SMTP Listener"

The rest of the mails are not being processed.

@hdevalke
Copy link

Same problem here. I suspected the ConnectionManager not cleaning up the ConnectionPool.

Adding an extra log statement confirmed this:

diff --git a/pkg/mailslurper/ConnectionManager.go b/pkg/mailslurper/ConnectionManager.go
index b29066d..39b0bc6 100644
--- a/pkg/mailslurper/ConnectionManager.go
+++ b/pkg/mailslurper/ConnectionManager.go
@@ -117,7 +117,7 @@ use this to track a client connection and its worker
 func (m *ConnectionManager) New(connection net.Conn) error {
 	var err error
 	var worker *SMTPWorker
-
+	m.logger.Infof("Number of connections %d", len(m.connectionPool))
 	if m.connectionExistsInPool(connection) {
 		return ConnectionExists(connection.RemoteAddr().String())
 	}

When i tried to clean it up however, it calls close multiple times, resulting in the following error:

INFO[0003] Closing connection 127.0.0.1:51259            who="Connection Manager"
INFO[0003] in go <- closeChannel Closed                  who="Connection Manager"
INFO[0003] Connection closed                             connection="127.0.0.1:51259" who="Connection Manager"
INFO[0003] in go <- closeChannel Closed                  who="Connection Manager"
ERRO[0003] Error closing connection                      error="Connection '127.0.0.1:51259' is not in the connection manager pool" who="Connection Manager"
INFO[0003] Connection closed                             connection="127.0.0.1:51259" who="Connection Manager"

@stevenmc
Copy link

I can confirm this is still a problem on the latest OSX binary.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants