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

Problem with postgresql custom json datatype #6

Closed
dspiteself opened this issue Apr 3, 2012 · 4 comments
Closed

Problem with postgresql custom json datatype #6

dspiteself opened this issue Apr 3, 2012 · 4 comments

Comments

@dspiteself
Copy link

in conn.go:220

which makes
make([]byte,-4)
The problem appears intermittent


panic: runtime error: makeslice: len out of range [recovered]
    panic: runtime error: makeslice: len out of range [recovered]
    panic: runtime error: makeslice: len out of range

goroutine 4 [running]:
testing._func_003(0x7fd7439b6fa8, 0x7fd7439b6100, 0x7fd7439b6650, 0x7fd7439b6570)
    /usr/lib/go/src/pkg/testing/testing.go:268 +0xf3
----- stack segment boundary -----
github.com/bmizerany/pq.errRecover(0x7fd7439b68c0, 0x7fd7439b6100)
    /home/ttallman/workspace/newRuleEngine/src/github.com/bmizerany/pq/error.go:61 +0xec
----- stack segment boundary -----
github.com/bmizerany/pq.(_conn).recv1(0xf840056980, 0xf840055a44, 0xf840058b40, 0x481e71)
    /home/ttallman/workspace/newRuleEngine/src/github.com/bmizerany/pq/conn.go:221 +0x247
github.com/bmizerany/pq.(_conn).recv(0xf840056980, 0x0, 0x0, 0x8, 0x7fd7439b6910, ...)
    /home/ttallman/workspace/newRuleEngine/src/github.com/bmizerany/pq/conn.go:198 +0x2a
github.com/bmizerany/pq.(_rows).Next(0xf840059930, 0xf8400961e0, 0x500000005, 0x0, 0x0, ...)
    /home/ttallman/workspace/newRuleEngine/src/github.com/bmizerany/pq/conn.go:459 +0x8a
database/sql.(_Rows).Next(0xf8400763c0, 0x7fd7439b6c10, 0x500000005, 0x0)
    /usr/lib/go/src/pkg/database/sql/sql.go:912 +0x100
rules.TestDb(0xf840000230, 0x2359ce0)
    /home/ttallman/workspace/newRuleEngine/src/rules/temp_test.go:91 +0x2fd
testing.tRunner(0xf840000230, 0x6c9af0, 0x0, 0x0)
    /usr/lib/go/src/pkg/testing/testing.go:273 +0x6f
created by testing.RunTests
    /usr/lib/go/src/pkg/testing/testing.go:349 +0x77c

goroutine 1 [chan receive]:
testing.RunTests(0x400c00, 0x6c9af0, 0x100000001, 0x1, 0x6ba838, ...)
    /usr/lib/go/src/pkg/testing/testing.go:350 +0x79f
testing.Main(0x400c00, 0x6c9af0, 0x100000001, 0x6cf100, 0x0, ...)
    /usr/lib/go/src/pkg/testing/testing.go:285 +0x7a
main.main()
    /tmp/go-build872041093/rules/_test/_testmain.go:43 +0x91

goroutine 2 [syscall]:
created by runtime.main
    /build/buildd/golang-weekly-2012-03-27/src/pkg/runtime/proc.c:221

goroutine 3 [select]:
code.google.com/p/tcgl/monitoring.backend()
    /usr/lib/go/src/pkg/code.google.com/p/tcgl/monitoring/monitoring.go:297 +0x2bd
created by code.google.com/p/tcgl/monitoring.init·1
    /usr/lib/go/src/pkg/code.google.com/p/tcgl/monitoring/monitoring.go:97 +0x144

goroutine 5 [syscall]:
syscall.Syscall6()
    /build/buildd/golang-weekly-2012-03-27/src/pkg/syscall/asm_linux_amd64.s:40 +0x5
syscall.EpollWait(0xf800000008, 0xf840077170, 0xa0000000a, 0xffffffff, 0xc, ...)
    /usr/lib/go/src/pkg/syscall/zerrors_linux_amd64.go:1781 +0xa1
net.(_pollster).WaitFD(0xf840077160, 0xf840055b40, 0x0, 0x0, 0x0, ...)
    /usr/lib/go/src/pkg/net/fd_linux.go:146 +0x110
net.(_pollServer).Run(0xf840055b40, 0x0)
    /usr/lib/go/src/pkg/net/fd.go:236 +0xe4
created by net.newPollServer
    /usr/lib/go/src/pkg/net/newpollserver.go:35 +0x382
exit status 2

```
```
@bmizerany
Copy link
Contributor

Will you please elaborate more on what you're trying to do, and with what code?

@dspiteself
Copy link
Author

It seems all i have been doing is routine. Your driver has been
working like a charm. I will paste below the code that causes the
issue. My thought is that the issue could stem from data being a
custom type. it works fine if i remove data from the query and the
scan.

rows, err := db.Query("SELECT id, widget,(select coalesce(array_agg(subscription_id),'{}'::bigint[]) from rule_subscriptions where rule_id = rule_condition.id),'{}'::bigint[] ,data::text from rule_condition limit 1000") if err != nil { t.Error(err) } var id uint64 var rulearr string var subjectarr string var widget string var data string for rows.Next() { err := rows.Scan(&id, &widget, &rulearr, &subjectarr, &data) if err != nil { t.Error(err) } }

@bmizerany
Copy link
Contributor

Can you give me a simple reproducible gist (gist.github.com) I can
clone? Or maybe add a test to conn_test.go in the repo? It's ok if it
fails; I just need it to build to better help you. You're example
below doesn't run through gofmt and is hard to get context.

On Mon, Apr 2, 2012 at 6:18 PM, dspiteself
reply@reply.github.com
wrote:

It seems all i have been doing is routine. Your driver has been
working like a charm. I will paste below the code that causes the
issue. My thought is that the issue could stem from data being a
custom type. it works fine if i remove data from the query and the
scan.

       rows, err := db.Query("SELECT id, widget,(select
coalesce(array_agg(subscription_id),'{}'::bigint[]) from
rule_subscriptions where rule_id = rule_condition.id),'{}'::bigint[]
,data::text from rule_condition limit 1000")
       if err != nil {
               t.Error(err)
       }
       var id uint64
       var rulearr string
       var subjectarr string
       var widget string
       var data string
       for rows.Next() {
               err := rows.Scan(&id, &widget, &rulearr, &subjectarr, &data)
               if err != nil {
                       t.Error(err)
}
}

On Mon, Apr 2, 2012 at 8:12 PM, Blake Mizerany
reply@reply.github.com
wrote:

Will you please elaborate more on what you're trying to do, and with what code?


Reply to this email directly or view it on GitHub:
bmizerany/pq#6 (comment)

Tyler Tallman
Project Manager
Breeze EMR
(m) (337) 205-2142


Reply to this email directly or view it on GitHub:
bmizerany/pq#6 (comment)

@dspiteself
Copy link
Author

solved by bmizerany/pq@3cb21db

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

2 participants