Issue: Migrator freezes
Author: JornPet
State: closed
Created: 2015-11-26 10:43:26

I'm trying to migrate a database using the peewee migrator. I added a column to a table the migrator worked and updated the table. No problem.
I then tried to remove the column again, but in the process it totally froze. I let it run for about 10 minutes, but nothing happened. So I quit it, and dropped and created the database again. After that I tried the upgrade again with the exact same code I used before, but unfortunately it now also freezes.  When i quit the process i get this stack trace:

```
Traceback (most recent call last):
  File "./migrate_db.py", line 145, in <module>
    migrateDatabase()
  File "./migrate_db.py", line 116, in migrateDatabase
    migrations[i]['up']()
  File "./migrate_db.py", line 81, in from9To10
    migrate(migrator.add_column('ticket', 'ticket_code_doc_id', Ticket.ticket_code_doc_id))
  File "/usr/local/lib/python2.7/dist-packages/playhouse/migrate.py", line 579, in migrate
    operation.run()
  File "/usr/local/lib/python2.7/dist-packages/playhouse/migrate.py", line 144, in run
    getattr(self.migrator, self.method)(*self.args, **kwargs))
  File "/usr/local/lib/python2.7/dist-packages/playhouse/migrate.py", line 138, in _handle_result
    self._handle_result(item)
  File "/usr/local/lib/python2.7/dist-packages/playhouse/migrate.py", line 135, in _handle_result
    result.run()
  File "/usr/local/lib/python2.7/dist-packages/playhouse/migrate.py", line 144, in run
    getattr(self.migrator, self.method)(*self.args, **kwargs))
  File "/usr/local/lib/python2.7/dist-packages/playhouse/migrate.py", line 133, in _handle_result
    self.execute(result)
  File "/usr/local/lib/python2.7/dist-packages/playhouse/migrate.py", line 129, in execute
    self.migrator.database.execute_sql(sql, params)
  File "/usr/local/lib/python2.7/dist-packages/peewee.py", line 3331, in execute_sql
    cursor.execute(sql, params or ())
  File "/usr/local/lib/python2.7/dist-packages/pymysql/cursors.py", line 146, in execute
    result = self._query(query)
  File "/usr/local/lib/python2.7/dist-packages/pymysql/cursors.py", line 296, in _query
    conn.query(q)
  File "/usr/local/lib/python2.7/dist-packages/pymysql/connections.py", line 781, in query
    self._affected_rows = self._read_query_result(unbuffered=unbuffered)
  File "/usr/local/lib/python2.7/dist-packages/pymysql/connections.py", line 942, in _read_query_result
    result.read()
  File "/usr/local/lib/python2.7/dist-packages/pymysql/connections.py", line 1138, in read
    first_packet = self.connection._read_packet()
  File "/usr/local/lib/python2.7/dist-packages/pymysql/connections.py", line 895, in _read_packet
    packet_header = self._read_bytes(4)
  File "/usr/local/lib/python2.7/dist-packages/pymysql/connections.py", line 912, in _read_bytes
    data = self._rfile.read(num_bytes)
  File "/usr/local/lib/python2.7/dist-packages/pymysql/_socketio.py", line 59, in readinto
    return self._sock.recv_into(b)
KeyboardInterrupt 
```

Does anybody know what's going on here? All tips are welcome!


I'm not sure, maybe something holding a lock on the table? Are any other processes connected to the db?


Closing due to lack of feedback.