Skip to content
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

Sporadic invalid connection error in a web server #1166

Closed
MaticVerbic opened this issue Nov 16, 2020 · 5 comments
Closed

Sporadic invalid connection error in a web server #1166

MaticVerbic opened this issue Nov 16, 2020 · 5 comments

Comments

@MaticVerbic
Copy link

Issue description

Exec() and Query() methods (seemingly) randomly return ErrInvalidConnection with no explanation. I have been unsuccessful in trying to replicate this issue locally.

I've gone through #654 and #836: but I don't seem to find a way to work around this from the user side.

Example code

//Execute - execute type query
func (h *Handler) Execute(query string, args []interface{}) (IDBResult, error) {
	var rsp sql.Result
	var err error

	rsp, err = h.conn.Exec(query, args...)
	if err != nil {
		return nil, err
	}

	return rsp, err
}

Error log

No error log since the only error that's returned is invalid connection.

Configuration

Driver version (or git SHA): 1.4.1

Go version: 1.14

@shogo82148
Copy link
Contributor

Please read https://github.com/go-sql-driver/mysql/wiki/Support at first.
You should ask such questions in Gopher Slack, Stack Overflow, or somewhere else.

@MaticVerbic
Copy link
Author

@shogo82148 I have done as you have suggested and opened a question on StackOverflow.

Admittedly I chose to skip that step before since we believe that this issue is caused by this driver (v1.4.1 and v1.5.0) and thus opened this issue.

No matter in which way I tried to produce this error, I could not, thus leading me to believe this is happening due to some internal driver implementation.

The other point that lead me to that belief is that this specific error is only thrown if some unexported flags within the driver itself are set, specifically mysqlConn.closed.

@methane
Copy link
Member

methane commented Nov 24, 2020

@methane methane closed this as completed Nov 24, 2020
@himanshupandey-cpi
Copy link

@methane the stackoverflow link provided is dead. I am also facing this problem, is there a fix for it already in new driver versions. I am using 1.4.0

@MaticVerbic
Copy link
Author

@methane the stackoverflow link provided is dead. I am also facing this problem, is there a fix for it already in new driver versions. I am using 1.4.0

We found out the error was actually on the system side with the MySQL database itsellf. I can't provide further help though, besides the fact that updating it helped.

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

4 participants