Skip to content

packets.go:88 ... broken pipe #116

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
pengux opened this issue Aug 24, 2013 · 6 comments
Closed

packets.go:88 ... broken pipe #116

pengux opened this issue Aug 24, 2013 · 6 comments

Comments

@pengux
Copy link

pengux commented Aug 24, 2013

I'm selecting a few thousands rows at a time, loop through each row and do a simple UPDATE. Now and then while looping I get:

[MySQL] 2013/08/24 16:23:04 packets.go:88: write tcp 127.0.0.1:3306: broken pipe

It seems like the driver could not complete the UPDATE query while writing the data, but I'm running on localhost so it should not be a network problem. I'm running Mysql 5.5 and the latest go mysql driver.

@arnehormann
Copy link
Member

@pengux please put the code you use up on play.golang.org and post a link to it here (or make it a gist).

@pengux
Copy link
Author

pengux commented Aug 24, 2013

@arnehormann Here is the code http://play.golang.org/p/_LrSVgb5t5, but it is of course not run-able, because you'll need a valid sample database for it

@arnehormann
Copy link
Member

@pengux here's what I think is happening.

In your program, you select from a table and update it before the select is done. Update acquires a lock which interferes with the select still in progress.

I think the MySQL server doesn't like that and either causes a deadlock or quits your queries.
Try the SELECT with a LIMIT, store results into a slice and call UPDATE with the slice contents. Do that in a loop until the SELECT returns no rows.

I'm closing this. If you still have issues, please get back to us.

@pengux
Copy link
Author

pengux commented Aug 25, 2013

@arnehormann OK, do you mean that the driver doesn't copy the results into some kind of resultset? I was under the impression that the SELECT query would have been finished in Mysql before the UPDATE queries are executed? I'll try your suggestions and will report back if the issues are still there.

@arnehormann
Copy link
Member

The driver just returns what arrives on the socket. As I said in issue 108 - there is no use_result and store_result. We only have what is called use_result in PHP. This keeps the driver simple and gives you the best control over speed and allocations.
What is read is whole packets up to the end of the current row. Anything else you'll have to take care of yourself.

@julienschmidt
Copy link
Member

This could be the result of another read / write timeout.

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

No branches or pull requests

3 participants