tomchan
Member
OP
- Joined:
- Jul 2024
- Posts:
- 202
- From:
- Bristol, UK
Fun little project gone weird here
Got a Hetzner VPS running mariadb + a little python scraper. Works fine manually. Cron throws this every exactly 00 and 30 past the hour:
pymysql.err.OperationalError: (2003, "Can't connect to MySQL server on 'localhost' ((1040, 'Too many connections'))")
Connection pool set to 10. Max_connections = 151. Only one cron job. It actually works when I run it by hand. Timing feels too regular to be random load.
Anyone seen this pattern?
works on my bench ¯\_(ツ)_/¯
Doug
Member
New Jersey
- Joined:
- Jul 2024
- Posts:
- 271
- From:
- New Jersey, US
"exactly 00 and 30 past the hour" My dude that's not hourly
grabs popcorn, checks /r/drama
tomchan
Member
OP
- Joined:
- Jul 2024
- Posts:
- 202
- From:
- Bristol, UK
Your */30 is probably wrong
It's */30 * * * * which crontab.guru confirms is every 30 minutes. Single job. I checked before posting.
Check during the 00/30 window.
Did this. 8 Sleep connections from my scraper, all from the same run. They hang for 300 seconds then die. But the job finishes in like 90 seconds? Pool should release them.
Something in my python isn't closing properly. But why only under cron?
works on my bench ¯\_(ツ)_/¯