![]() See the Error Handling section for more information. All of these events are considered fatal errors, and will have the err.code 'PROTOCOLCONNECTIONLOST'. In pseudocode, this is what I did var lineCounter = 0 Īgain, different situation might require different way to find the last time the connection.query() will be called. You may lose the connection to a MySQL server due to network problems, the server timing you out, or the server crashing. When you see this error, try to look for anything that tries to send a header after some of the body has already been written. 1213 Closed anonprophet opened this issue on 7 comments anonprophet commented on added the label Sign up for free to join this conversation on GitHub. Note: If you’re serving web requests, then you shouldn’t be ending connections on every request. If original process has made the last call, then call connection.end() in the last callback of the last asynchronous chained function.įor the program I was working on, I counted the lines that was read from the file and I matched the count to another counter counting how many records I have inserted. Error: Cannot enqueue Handshake after already enqueuing a Handshake. Fixing Node Mysql Error: Cannot enqueue Handshake after invoking quit.: TL DR You need to establish a new connection by calling the createConnection method after every disconnection. By default it will also only allow anonymous connections (without username/password) from localhost, to allow anonymous from remote add: allowanonymous true More details can be found in the 2. However, the general idea is to keep track of the original process (in this case reading my file) and check against the last process (in this case my sql insert). If you using the node-mysql module, just remove the. ![]() Apparently they pushed in unnecessary code in their last iteration that is also bugged. With multiple chained asynchronous callbacks, how could I know when will that last connection.query() be called?ĭifferent problems may require different exact implementation. The error you provided is because you are chronologically calling connection.query () after you called connection.end (). The Solution to Cannot enqueue Handshake after invoking quit is. The Solution to Cannot enqueue Handshake after invoking quit is If you using the node-mysql module, just remove the. Eureka! I need to call it after the last connection.query() ran.
0 Comments
Leave a Reply. |