Hey there.
SonarQube 10.4.0 had some issues with holding database connections and not letting them go. I’m not sure this is related to the specific issue you’re fixing, but I definitely recommend not using 10.4 for this reason alone.
The latest version of Developer Edition and above is 10.8, and of Community Build is 24.12.
I suggest you upgrade and see if the issue persists. All other versions are no longer maintained.