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

Report parameters on N1QL errors #3798

Closed
tleyden opened this issue Oct 12, 2018 · 6 comments

Comments

@tleyden
Copy link
Contributor

commented Oct 12, 2018

Originally reported in https://forums.couchbase.com/t/5001-panic-runtime-error-index-out-of-range/18682

This log in particular:

2018-10-09T09:04:30.038+08:00 [WRN] Error when querying index using statement: [SELECT [op.name, LEAST(meta(`kitchen`).xattrs._sync.sequence, op.val.seq),IFMISSING(op.val.
rev,null),IFMISSING(op.val.del,null)][1] AS seq, [op.name, LEAST(meta(`kitchen`).xattrs._sync, op.val.seq),IFMISSING(op.val.rev,null),IFMISSING(op.val.del,null)][2] AS rRev, [op.name, LEAST(meta(`kitchen`).xattrs._sync, op.val.seq),IFMISSING(op.val.rev,null),IFMISSING(op.val.del,null)][3] AS rDel, meta(`kitchen`).xattrs._sync.rev AS rev, meta(`kitchen`).xattrs._sync.flags AS flags, META(`kitchen`).id AS id FROM `kitchen` UNNEST OBJECT_PAIRS(meta(`kitchen`).xattrs._sync.channels) AS op WHERE [op.name, LEAST(meta(`kitchen`).xattrs._sync.sequence, op.val.seq),IFMISSING(op.val.rev,null),IFMISSING(op.val.del,null)]  BETWEEN  [$channelName, $startSeq] AND [$channelName, $endSeq]] -- base.(*CouchbaseBucketGoCB).Query() at bucket_n1ql.go:63
2018-10-09T09:04:30.038+08:00 [INF] Query: N1QL Query("channels") took 1.017947623s
2018-10-09T09:04:30.038+08:00 [WRN] MultiChangesFeed got error reading changes feed "7a40a944": [5001] Panic: runtime error: index out of range -- db.(*Database).SimpleMul
tiChangesFeed.func1() at changes.go:490
2018-10-09T09:04:30.038+08:00 [INF] Changes: MultiChangesFeed done   (to 7a40a944)

indicates that Sync Gateway is calling n1ql with invalid startSeq and endSeq.

There should be a logging setting to log those values, and additional validation to make sure invalid values aren't passed.

@tleyden tleyden changed the title Panic on N1QL query Panic on N1QL query: index out of range Oct 12, 2018

@adamcfraser adamcfraser changed the title Panic on N1QL query: index out of range Report parameters on N1QL errors Oct 15, 2018

@adamcfraser adamcfraser added this to the Iridium milestone Oct 15, 2018

@wilsondy

This comment has been minimized.

Copy link

commented Oct 29, 2018

Having a similar issue with 2.1.1 against 5.5.1. We aren't getting data down on the channel mentioned. Is there a known workaround?

2018-10-29T13:31:34.656Z [WRN] MultiChangesFeed got error reading changes feed "content": [5001] Panic: runtime error: index out of range -- db.(*Database).SimpleMultiChangesFeed.func1() at changes.go:493
2018-10-29T13:31:43.677Z [WRN] Error when querying index using statement: [SELECT [op.name, LEAST(meta(`sync_gateway`).xattrs._sync.sequence, op.val.seq),IFMISSING(op.val.rev,null),IFMISSING(op.val.del,null)][1] AS seq, [op.name, LEAST(meta(`sync_gateway`).xattrs._sync, op.val.seq),IFMISSING(op.val.rev,null),IFMISSING(op.val.del,null)][2] AS rRev, [op.name, LEAST(meta(`sync_gateway`).xattrs._sync, op.val.seq),IFMISSING(op.val.rev,null),IFMISSING(op.val.del,null)][3] AS rDel, meta(`sync_gateway`).xattrs._sync.rev AS rev, meta(`sync_gateway`).xattrs._sync.flags AS flags, META(`sync_gateway`).id AS id FROM `sync_gateway` UNNEST OBJECT_PAIRS(meta(`sync_gateway`).xattrs._sync.channels) AS op WHERE [op.name, LEAST(meta(`sync_gateway`).xattrs._sync.sequence, op.val.seq),IFMISSING(op.val.rev,null),IFMISSING(op.val.del,null)]  BETWEEN  [$channelName, $startSeq] AND [$channelName, $endSeq]] -- base.(*CouchbaseBucketGoCB).Query() at bucket_n1ql.go:63

@JFlath JFlath added the ffc label Oct 29, 2018

@adamcfraser

This comment has been minimized.

Copy link
Contributor

commented Oct 29, 2018

@wilsondy Can you provide any more specifics on the state of the 'content' channel when that query would have been executed, so that we can dig into the underlying root cause?

@adamcfraser adamcfraser self-assigned this Oct 29, 2018

@adamcfraser adamcfraser added ready and removed backlog labels Oct 29, 2018

@JFlath

This comment has been minimized.

Copy link
Collaborator

commented Oct 29, 2018

Hi All,

Quickly stepping in here to try and head off any confusion.

@wilsondy - As we have another channel of communication open, let's use that to follow up in more detail for now.
@adamcfraser - I'll make sure any relevant information gets relayed back to you and your team.

Thanks,

James

@adamcfraser

This comment has been minimized.

Copy link
Contributor

commented Nov 7, 2018

The underlying issue here looks like a potential query service issue (i.e. the 'index out of range' error is actually a go slice error being emitted by the query service). Getting parameters included in error log output is a good idea in any case, though.

@tleyden

This comment has been minimized.

Copy link
Contributor Author

commented Dec 13, 2018

The underlying issue was fixed in https://issues.couchbase.com/browse/MB-32120

@erpankaj22

This comment has been minimized.

Copy link

commented Mar 13, 2019

I am using CBS 6.0 but the issue still persist where I see similar errors on sync gateway. So I have went back to using views.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
5 participants
You can’t perform that action at this time.