Skip to content
This repository was archived by the owner on May 14, 2024. It is now read-only.

If mysql begin a transaction and lost connection, reconnect #298

Merged

Conversation

zhanghaofei
Copy link
Contributor

Fix the following problems:

Traceback (most recent call last):
  File "orator_db.py", line 97, in <module>
    with db.connection('yh_edu').transaction():
  File "/usr/lib/python3.6/contextlib.py", line 81, in __enter__
    return next(self.gen)
  File "/usr/lib/python3.6/site-packages/orator/connections/connection.py", line 288, in transaction
    self.begin_transaction()
  File "/usr/lib/python3.6/site-packages/orator/connections/mysql_connection.py", line 42, in begin_transaction
    self._connection.autocommit(False)
  File "/usr/lib/python3.6/site-packages/pymysql/connections.py", line 753, in autocommit
    self._send_autocommit_mode()
  File "/usr/lib/python3.6/site-packages/pymysql/connections.py", line 771, in _send_autocommit_mode
    self._read_ok_packet()
  File "/usr/lib/python3.6/site-packages/pymysql/connections.py", line 760, in _read_ok_packet
    pkt = self._read_packet()
  File "/usr/lib/python3.6/site-packages/pymysql/connections.py", line 991, in _read_packet
    packet_header = self._read_bytes(4)
  File "/usr/lib/python3.6/site-packages/pymysql/connections.py", line 1037, in _read_bytes
    CR.CR_SERVER_LOST, "Lost connection to MySQL server during query")
pymysql.err.OperationalError: (2013, 'Lost connection to MySQL server during query')
```

@zardilior
Copy link

Please check it, its a fix to Nonetype object has no attribute autocommit when connection becomes null
@sdispater. A constant problem in production

@zardilior
Copy link

@sdispater there is a pr with a fix for mysql. Should be accepted or at least checked Thanks

@xargsgrep
Copy link

xargsgrep commented Jul 19, 2019

@sdispater any updates on this? we would like to see this fix in the next release also.

@zardilior
Copy link

@sdispater don't wait for the release this is necesary

@zhanghaofei
Copy link
Contributor Author

@sdispater @josephmancuso Urgent need to update,Thanks.
The authors no longer maintain this project?

@zardilior
Copy link

@sdispater doesn't

@josephmancuso
Copy link
Collaborator

Does this fix the issue everyone is having sufficiently?

@zardilior
Copy link

I patched a local version of orator and it totally did @josephmancuso

@josephmancuso josephmancuso merged commit e5d48d6 into sdispater:0.9 Jul 26, 2019
@josephmancuso
Copy link
Collaborator

merged

@zehauser
Copy link
Contributor

zehauser commented Aug 2, 2019

@josephmancuso thank you very much for merging this fix. Could you please cut and publish a new release when you have time?

This patch is what will allow my company to move off our internal fork (😬) and back to a mainline Orator release.

@josephmancuso
Copy link
Collaborator

@zehauser I do not have permissions to release and it work with the CI tool @sdispater has setup.

@zehauser
Copy link
Contributor

zehauser commented Aug 7, 2019

@josephmancuso Can we plead to @sdispater to cut a release when he has time? 🙂

@josephmancuso
Copy link
Collaborator

@zehauser I reached out directly to him. Waiting for a reply

@zardilior
Copy link

@josephmancuso how long since he last answered you? Seems he is really absent

@josephmancuso
Copy link
Collaborator

Screen Shot 2019-08-20 at 1 18 57 PM

@zardilior
Copy link

Thanks a lot joseph

@zehauser
Copy link
Contributor

😢

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

Successfully merging this pull request may close these issues.

5 participants