Skip to content
This repository was archived by the owner on Jul 16, 2019. It is now read-only.
This repository was archived by the owner on Jul 16, 2019. It is now read-only.

SQLEngine: Too many connections #17

@nstr10

Description

@nstr10

I've followed the setup instructions in a fresh virtualenv and tried to run main.py
It connects to the Slack API successfully, creates securitybot, loads configuration, and starts the RTM session.
Then it issues a couple hundred warnings "Recovering from lost MySQL connection" and crashes. Here is a truncated traceback:

Traceback (most recent call last):
  File "main.py", line 45, in <module>
    main()
  File "main.py", line 41, in main
    sb = SecurityBot(chat, tasker, duo_builder, REPORTING_CHANNEL, 'config/bot.yaml')
  File "/securitybot/securitybot/bot.py", line 95, in __init__
    self.blacklist = SQLBlacklist()
  File "/securitybot/securitybot/blacklist/sql_blacklist.py", line 17, in __init__
    names = SQLEngine.execute('SELECT * FROM blacklist')
  File "/securitybot/securitybot/sql.py", line 79, in execute
    return SQLEngine.execute(query, params)

Those last two lines repeat a couple hundred times and then

  File "/securitybot/securitybot/sql.py", line 78, in execute
    SQLEngine._db)
  File "/securitybot/securitybot/sql.py", line 51, in _create_engine
    db=db)
  File "/usr/local/lib/python2.7/dist-packages/MySQLdb/__init__.py", line 81, in Connect
    return Connection(*args, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/MySQLdb/connections.py", line 193, in __init__
    super(Connection, self).__init__(*args, **kwargs2)
_mysql_exceptions.OperationalError: (1040, 'Too many connections')

While the user defined on line 93 of sql.py (why is this setting buried?) has full rights to the database, no tables are created.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions