Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't connect to MySQL server - 10048 Only one usage of each socket address is normally permitted #125

Open
matt-bernhardt opened this issue Feb 11, 2018 · 1 comment
Assignees
Labels

Comments

@matt-bernhardt
Copy link
Owner

This started cropping up after upgrading the desktop I use to run my import pipeline. A sample output is:

Importing lineups from 2017_games_mls.xlsx
Traceback (most recent call last):
  File "C:\Python27\Scripts\trapp-script.py", line 11, in <module>
    load_entry_point('trapp==0.5.0b1', 'console_scripts', 'trapp')()
  File "c:\python27\lib\site-packages\trapp\command_line.py", line 310, in main
    verbImport(args)
  File "c:\python27\lib\site-packages\trapp\command_line.py", line 233, in verbImport
    importLineups(args.infile)
  File "c:\python27\lib\site-packages\trapp\command_line.py", line 164, in importLineups
    importer.doImport()
  File "c:\python27\lib\site-packages\trapp\importer.py", line 85, in doImport
    [self.importRecord(record) for record in self.records]
  File "c:\python27\lib\site-packages\trapp\import_lineup.py", line 112, in importRecord
    self.parseLineup(record['Lineup'], game, record['teamID'], duration)
  File "c:\python27\lib\site-packages\trapp\import_lineup.py", line 141, in parseLineup
    batch = self.parsePlayer(starter, game, teamID, duration)
  File "c:\python27\lib\site-packages\trapp\import_lineup.py", line 190, in parsePlayer
    p.connectDB()
  File "c:\python27\lib\site-packages\trapp\record.py", line 14, in connectDB
    self.db.connect()
  File "c:\python27\lib\site-packages\trapp\database.py", line 21, in connect
    database=conn['dbschema']
  File "c:\python27\lib\site-packages\mysql\connector\__init__.py", line 179, in connect
    return MySQLConnection(*args, **kwargs)
  File "c:\python27\lib\site-packages\mysql\connector\connection.py", line 95, in __init__
    self.connect(**kwargs)
  File "c:\python27\lib\site-packages\mysql\connector\abstracts.py", line 716, in connect
    self._open_connection()
  File "c:\python27\lib\site-packages\mysql\connector\connection.py", line 206, in _open_connection
    self._socket.open_connection()
  File "c:\python27\lib\site-packages\mysql\connector\network.py", line 512, in open_connection
    errno=2003, values=(self.get_address(), _strioerror(err)))
mysql.connector.errors.InterfaceError: 2003: Can't connect to MySQL server on 'localhost:3306' (10048 Only one usage of each socket address (protocol/network address/port) is normally permitted)
@matt-bernhardt matt-bernhardt self-assigned this Feb 11, 2018
@matt-bernhardt
Copy link
Owner Author

From watching netstat during the import-lineups step, it looks like the number of MySQL connections grows significantly during the import process. My best guess at this point is that I'm not cleaning up database connections after myself at some key points of the import process, and as a result the speed of the new desktop is accumulating old connections faster than they're getting cleaned up.

Possible responses include:

  • Implementing connection pooling
  • Cleaning up after myself better
  • Adding a timer or other slowdown process to allow the computer to keep up

Pooling is probably the best option, but regardless I should be doing better about cleaning up after myself. I'm going to try that first.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant