mirror of
https://github.com/healthchecks/healthchecks.git
synced 2026-04-25 23:15:49 +03:00
[GH-ISSUE #213] smtpd gives up after a couple of emails #156
Labels
No labels
bug
bug
bug
feature
good-first-issue
new integration
pull-request
question
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/healthchecks#156
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @danielfaulknor on GitHub (Jan 22, 2019).
Original GitHub issue: https://github.com/healthchecks/healthchecks/issues/213
I'm running smtpd in a docker container:
It connects up fine, and takes a few email pings, then these start hitting the logs. My
CONN_MAX_AGEis 0.error: uncaptured python exception, closing channel <smtpd.SMTPChannel connected 50.31.156.116:35051 at 0x7feda0e9f4e0> (<class 'django.db.utils.OperationalError'>:(2006, 'MySQL server has gone away') [/usr/lib/python3.6/asyncore.py|read|83] [/usr/lib/python3.6/asyncore.py|handle_read_event|423] [/usr/lib/python3.6/asynchat.py|handle_read|171] [/usr/lib/python3.6/smtpd.py|found_terminator|386] [/src/hc/api/management/commands/smtpd.py|process_message|25] [/usr/local/lib/python3.6/dist-packages/django/db/models/manager.py|manager_method|82] [/usr/local/lib/python3.6/dist-packages/django/db/models/query.py|get|393] [/usr/local/lib/python3.6/dist-packages/django/db/models/query.py|__len__|250] [/usr/local/lib/python3.6/dist-packages/django/db/models/query.py|_fetch_all|1183] [/usr/local/lib/python3.6/dist-packages/django/db/models/query.py|__iter__|54] [/usr/local/lib/python3.6/dist-packages/django/db/models/sql/compiler.py|execute_sql|1061] [/usr/local/lib/python3.6/dist-packages/django/db/backends/utils.py|execute|68] [/usr/local/lib/python3.6/dist-packages/django/db/backends/utils.py|_execute_with_wrappers|77] [/usr/local/lib/python3.6/dist-packages/django/db/backends/utils.py|_execute|85] [/usr/local/lib/python3.6/dist-packages/django/db/utils.py|__exit__|89] [/usr/local/lib/python3.6/dist-packages/django/db/backends/utils.py|_execute|85] [/usr/local/lib/python3.6/dist-packages/django/db/backends/mysql/base.py|execute|71] [/usr/lib/python3/dist-packages/MySQLdb/cursors.py|execute|250] [/usr/lib/python3/dist-packages/MySQLdb/connections.py|defaulterrorhandler|50] [/usr/lib/python3/dist-packages/MySQLdb/cursors.py|execute|247] [/usr/lib/python3/dist-packages/MySQLdb/cursors.py|_query|411] [/usr/lib/python3/dist-packages/MySQLdb/cursors.py|_do_query|374] [/usr/lib/python3/dist-packages/MySQLdb/connections.py|query|292])I guess it's holding the connection open, and mysqld goes away. This results in emails being rejected.
@danielfaulknor commented on GitHub (Jan 23, 2019):
If anyone finds this... There's a Lambda function in https://github.com/healthchecks/healthchecks/issues/139
I've switched to using that.
@cuu508 commented on GitHub (Feb 21, 2019):
I'm wondering if "MySQL server has gone away" happens because of a connection being idle for too long.
Did you also see similar errors when running
manage.py sendalerts? sendalerts is similar in that it is also a management command and it also doesn't do anything special with connection handling. (but, it runs queries every few seconds)@danielfaulknor commented on GitHub (Feb 26, 2019):
sendalerts is fine yeah
@cuu508 commented on GitHub (Feb 27, 2019):
So my theory is that the
manage.py smtpdis opening a single database connection and expecting to use it indefinitely. If the emails are infrequent then the connection is idle for long periods and gets closed – either by kernel or by mysql, not sure.I added a workaround to get a new db connection on every email. I'm closing this issue for now, and we'll see if the problem resurfaces.