-
Notifications
You must be signed in to change notification settings - Fork 922
slice bounds out of range error on rows.Next() with go 1.5 #387
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
Comments
Can you by any chance get a tcpdump of the unencrypted traffic between the server and the client when this happens? I've heard of a similar report (though on 1.4.2), but it's practically impossible to analyze these without having more information or a reproducible test case. |
I'll get a tcpdump later today when I get a chance. Just found that when the program crashes because of the pq error, there are two cases. One is the above. The other is: pq: unexpected Parse response 'D' It's consistently reproducible: click the page first it loads correctly, click again 90% chance it fails. |
From the tcpdump, I found that when it succeeds the last packet has "cksum 0xfe28 (correct...)"; but when it fails the last packet has "cksum 0xfe28 (incorrect". So looks like that sometimes the last packet was missing. |
That shouldn't cause this, unless sometimes a malformed packet slips through with a valid checksum. |
Can you extract the relevant code into a test case which reproduces the problem? |
Created a github repository (https://github.com/linuxerwang/pq-issues-387) to hold the program and SQL script. The program is highly reduced from my original code, but sufficient to reveal the problem. The same program runs under go 1.4 without problem but consistently causes crash under go 1.5. I suspect it's related to PostgreSQL's array type. Let me know what else I can help. |
I see two goroutines using one |
Is it not allowed? It worked without any issue under go 1.4. |
You are probably right. I found this old issue: #81 But it's still weird that the same program works fine under go 1.4 but not 1.5. Also, it works fine under go 1.5 if I am not using postgresql array type. |
In go 1.4 were you running w/ GOMAXPROCS > 1? |
Ah, thanks, hochhaus! With GOMAXPROCS > 1 it also fails under go 1.4. |
It might've not failed under 1.4, but it was never allowed. |
I got this stack trace with go 1.5:
panic: runtime error: slice bounds out of range [recovered]
panic: runtime error: slice bounds out of range
goroutine 75 [running]:
github.com/lib/pq.(_conn).errRecover(0x10ece000, 0x10e8de28)
/home/developer/go/src/github.com/lib/pq/error.go:482 +0x15c
github.com/lib/pq.(_rows).Next(0x10deb2c0, 0x10d991a0, 0xc, 0xc, 0x0, 0x0)
/home/developer/go/src/github.com/lib/pq/conn.go:1385 +0x6e0
database/sql.(*Rows).Next(0x10ede420, 0xe)
/usr/share/go-golang/src/database/sql/sql.go:1639 +0x134
The weird thing is that this error is not always raised. It happens randomly.
The text was updated successfully, but these errors were encountered: