Skip to content

Connection may be stalled when LOAD DATA LOCAL INFILE #696

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

Closed
ayanamist opened this issue Jan 3, 2014 · 6 comments
Closed

Connection may be stalled when LOAD DATA LOCAL INFILE #696

ayanamist opened this issue Jan 3, 2014 · 6 comments

Comments

@ayanamist
Copy link
Contributor

Since local file is reading from a stream and may got large block, it may make the connection stalled according to this node.js issue nodejs/node-v0.x-archive#6506 .

@ayanamist
Copy link
Contributor Author

My solution is hooking the write method of the socket.

var _write = conn._socket.write;
if (!_write.__hooked) {
  conn._socket.write = function () {
    var ret = _write.apply(conn._socket, arguments);
    if (!ret && !conn._socket.bufferSize) {
      ret = true;
    }
    return ret;
  };
  conn._socket.write.__hooked = true;
}

May be ugly, but it temporarily solves my problem.

@dougwilson
Copy link
Member

I see this has been fixed in node.js 0.10.25. If you want me to patch this module somehow to not do it in older versions, give me a patch that is more specific than just monkey patching the write method on the entire connection socket.

@ayanamist
Copy link
Contributor Author

@dougwilson Since this bug does not only affects node-mysql but all socket operations, there is no such more specific patch.

@dougwilson
Copy link
Member

What I mean is, I can simply use require('readable-stream').Writable streams in place where I need to (since they have the fix and work in all the affected node versions), but without you telling me what streams to replace with that or some test I can plop into the tests/ directory so I can reproduce the issue you are describing, I won't be able to do anything.

@ayanamist
Copy link
Contributor Author

@dougwilson I opened this issue just for informing new arrivals about this bug. I myself does not need to write ugly Node.js codes any more.

@dougwilson
Copy link
Member

No problem. I think we can assume people will just use the most recent version of node.js 0.10 these days, which is what the core team recommends anyhow.

ugly Node.js codes any more.

:D

dveeden pushed a commit to dveeden/mysql that referenced this issue Jan 31, 2023
* Drop support for Go 1.6 and lower

* Remove cloneTLSConfig for legacy Go versions
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants