Hi all, I may have found a possible memory leak in stunnel (version 4.15) when used with pthreads. What I am seeing is the memory usage going up when connections open and never going down, no matter if all the connections close. It is really easy to reproduce it: I have started two stunnel instances communicating with each other, the first one acting as a server (config file stunnel.1) and executing cat, the second one acting as a client (config file stunnel.2) and opening port 5556. Then I execute the script I have attached that simply opens 500 connections using netcat to port 5556. If you cat /proc/<stunnel pid>/status you can see that the memory usage is about 300MB. The problem is that even after all the connections are closed the memory usage stays (more or less) the same. I tried to find the bug myself using valgrind, but I couldn't get far, it seems that valgrind gets confused by openssl so doesn't print very useful informations. I really appreciate any help you can give me; just tell me if you need any other info. Best Regards,
Stefano Stabellini
#!/bin/bash i=1 while test $i -lt 520 do cat script | nc 127.0.0.1 5556 &>/dev/null & echo $i i=$(( $i + 1 )) done
foreground = yes
[test] accept = 5555 cert = /etc/ssl/certs/stunnel.pem exec = cat
foreground = yes
[test] accept = 5556 cert = /etc/ssl/certs/stunnel.pem client = yes connect = 5555