I use my personal website to host several images galleries, and for several months now, I've noticed that a lot of the thumbnail images appear broken and aren't loaded by the browser. This seems to be random: sometimes one page will load perfectly fine, other times the same page will appear completely broken.
Obviously this is quite a catastrophic result for an image gallery...
This is not a problem with the images themselves: they've already been generated and are present on the server. In Firefox you can right-click the broken image and choose "reload image", and the image will appear immediately.
This is not a problem with the browser, OS or machine either: I tested it on various machines and with numerous browsers.
Upon inspection, the broken images correspond to 503 errors sent by the server (Service unavailable).
I checked the server logs for more details and found this kind of error for each "broken" image:
Rejected, too many connections from this host. (vhost:example.com:/sites/default/files/styles/[etc]) current: 27 limit: 20, referer: https://example.com/galeries
I contacted my hosting provider and their response was that "your site incorrectly handles PHP sessions. The connection is not closed between pages, and when this limit is reached, the site doesn't load any more."
I'm not sure where I can go from here...
Is this a know issue with Drupal 7? How can I fix it?