I have a Java application running in WSL2
I also have an ssh connection (in Windows) to a app server, and tunnel ports from the app server for a web server hosted on a second app server back to my application.
The application makes many connections to the web server as it loads pages. I am pretty confident it closes the connections correctly.
And yet, after a while, I get many "too many open files" errors printed on the terminal of the ssh session.
I've increased the open files ulimit from 1024 to 524288 (and confirmed this with /proc//limits). I am confident the application does not open that many connections!
It looks to me like sshd is not closing the connections. If I run the application, and then re-run it, I get "too many open files" more quickly which suggests the ones from the previous execution are still open in sshd.
Is my diagnosis correct? Is there anything I can do about it? I can't see anything in sshd cofiguration files etc that would impact this.
(Windows 10/WSL2 on the client side, Ubuntu 22.04 on the app server side)
EDIT: I ran the application on the server I was ssh'ing to. It worked, without running out of open files. So the application use of connections is probably not the issue. I suspect for some reason the sshd process that's opening the tunneled connections has some lower limit on open files still