manticoresoftware / manticoresoftware/go-sdk

goroutine error on query

Open
#11 12 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug waiting for OP
Dominant language
Go
Stars
58
Forks
9
PR merge metrics
No merged PRs in 30d

Description

Hi,

Hope you are all well !

I cannot insert this query, and I have an error

`````bash
REPLACE into limostar (
id,remote_id,avatar,owner,name,fullname,description,homepage,url,language,watchers,stars,forks,size,pushed,created,starred,service_id,license
) VALUES ('96285','22486533','https://avatars2.githubusercontent.com/u/2347603?v=4','00-Evan','shattered-pixel-dungeon','00-Evan/shattered-pixel-dungeon','Traditional roguelike game with pixel-art graphics and simple interface','unkown','https://github.com/00-Evan/shattered-pixel-dungeon.git','Java','623','623','279','29628','2020-01-13 02:41:56 0100 CET','2014-07-31 23:56:31 0200 CEST','2020-02-18 11:32:08 0100 CET','github','unkown')
"\x02"
manticore.apibuf{}
"\x00"
panic: runtime error: slice bounds out of range [2:0]

goroutine 1 [running]:
github.com/x0rzkov/go-sdk/manticore.(*apibuf).getLsbWord(0xc000733440, 0x10002)
/Users/x0rzkov/go/pkg/mod/github.com/x0rzkov/go-sdk@v0.0.0-20190514070640-c6a45389b87d/manticore/sphinxql.go:330 0x1af
github.com/x0rzkov/go-sdk/manticore.(*Sqlresult).parseOK(0xc0007334d8, 0xc000733440)
/Users/x0rzkov/go/pkg/mod/github.com/x0rzkov/go-sdk@v0.0.0-20190514070640-c6a45389b87d/manticore/sphinxql.go:270 0x84
github.com/x0rzkov/go-sdk/manticore.(*Sqlresult).parseChain(0xc0007334d8, 0xc008777e40, 0x18)
/Users/x0rzkov/go/pkg/mod/github.com/x0rzkov/go-sdk@v0.0.0-20190514070640-c6a45389b87d/manticore/sphinxql.go:58 0x200
github.com/x0rzkov/go-sdk/manticore.parseSphinxqlAnswer.func1(0xc008777e40, 0xc008770100, 0xc005fb5b88)
/Users/x0rzkov/go/pkg/mod/github.com/x0rzkov/go-sdk@v0.0.0-20190514070640-c6a45389b87d/manticore/sphinxql.go:22 0x8c
github.com/x0rzkov/go-sdk/manticore.(*Client).netQuery(0xc000280880, 0x8, 0xc008777e20, 0x4feb030, 0x4f30860, 0xc0004781c0, 0x1, 0x1)
/Users/x0rzkov/go/pkg/mod/github.com/x0rzkov/go-sdk@v0.0.0-20190514070640-c6a45389b87d/manticore/client.go:225 0x1ca
github.com/x0rzkov/go-sdk/manticore.(*Client).Sphinxql(0xc000280880, 0xc005fb4f00, 0x26e, 0x1, 0x13, 0xc005fb4f00, 0x26e, 0x0)
/Users/x0rzkov/go/pkg/mod/github.com/x0rzkov/go-sdk@v0.0.0-20190514070640-c6a45389b87d/manticore/manticore.go:398 0x70
github.com/lucmski/limo/cmd.sphinxStars(0x5150500, 0xc0000ac000, 0xc0003ccb40, 0x1, 0x1)
/Users/x0rzkov/go/src/github.com/lucmski/limo/cmd/sphinxql.go:161 0xb1a
github.com/lucmski/limo/cmd.glob..func14(0x5a1b760, 0xc0003ccb40, 0x1, 0x1)
/Users/x0rzkov/go/src/github.com/lucmski/limo/cmd/sphinxql.go:48 0xca
github.com/spf13/cobra.(*Command).execute(0x5a1b760, 0xc0003ccaf0, 0x1, 0x1, 0x5a1b760, 0xc0003ccaf0)
/Users/x0rzkov/go/pkg/mod/github.com/spf13/cobra@v0.0.6-0.20190805155617-b80588d523ec/command.go:833 0x2aa
github.com/spf13/cobra.(*Command).ExecuteC(0x5a1afe0, 0x403d4ba, 0x599d8a0, 0xc000000180)
/Users/x0rzkov/go/pkg/mod/github.com/spf13/cobra@v0.0.6-0.20190805155617-b80588d523ec/command.go:917 0x2fb
github.com/spf13/cobra.(*Command).Execute(...)
/Users/x0rzkov/go/pkg/mod/github.com/spf13/cobra@v0.0.6-0.20190805155617-b80588d523ec/command.go:867
github.com/lucmski/limo/cmd.Execute()
/Users/x0rzkov/go/src/github.com/lucmski/limo/cmd/root.go:52 0x31
main.main()
/Users/x0rzkov/go/src/github.com/lucmski/limo/main.go:8 0x20
`````
Manticore Config
`````
#!/bin/sh
ip=`hostname -i`
cat << EOF
index limostar {
type = rt
rt_mem_limit = 1024M
path = /var/lib/manticore/data/limostar

rt_attr_bigint = remote_id
rt_field = avatar
rt_attr_string = owner
rt_attr_string = name
rt_attr_string = url
rt_attr_string = language
rt_attr_bigint = watchers
rt_attr_bigint = stars
rt_attr_bigint = forks
rt_attr_bigint = size
rt_attr_string = license
rt_attr_timestamp = pushed
rt_attr_timestamp = created
rt_attr_timestamp = starred
rt_attr_string = service_id
rt_attr_multi = tags
rt_attr_multi = topics
rt_field = fullname
rt_field = description
rt_field = service_id
rt_field = homepage
rt_field = url
# stored_fields = fullname,description,service_id
min_infix_len = 2
}

indexer
{
mem_limit = 64M
}

index limotopic {
type = rt
rt_mem_limit = 1024M

path = /var/lib/manticore/data/limotopic
rt_attr_bigint = remote_id
rt_attr_string = service_id
rt_attr_string = url
rt_attr_string = tag
rt_field = url
rt_field = tag
rt_field = service_id
# stored_fields = tag,url,service_id
min_infix_len = 2
}

index limo
{
type = distributed
local = limostar
local = limotopic
}

index pq {
type = percolate
path = /var/lib/manticore/data/pq
min_infix_len = 4
}

searchd {
listen = 9306:mysql41
listen = /var/run/mysqld/mysqld.sock:mysql41
listen = $ip:9312
listen = 9308:http

# more info about replication you can find at
# https://docs.manticoresearch.com/latest/html/replication.html
listen = $ip:9315-9325:replication
log = /var/log/manticore/searchd.log

# you can also send query_log to /dev/stdout to be shown in docker logs
query_log = /var/log/manticore/query.log
read_timeout = 15
max_children = 30
pid_file = /var/run/manticore/searchd.pid
seamless_rotate = 1
preopen_indexes = 1
unlink_old = 1
# workers = thread_pool

max_matches = 2000
workers = threads
subtree_docs_cache = 8M
subtree_hits_cache = 16M

binlog_path = /var/lib/manticore/data
max_packet_size = 128M
mysql_version_string = 5.5.21
data_dir = /var/lib/manticore/replication
}
EOF
`````

Any reason why ?

Cheers,
X.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the shown REPLACE query against the supplied Manticore configuration, then inspect manticore/sphinxql.go at parseOK and getLsbWord, followed by cmd/sphinxql.go at sphinxStars. Trace the response that causes the slice-bounds panic and add a focused regression test if the repository provides a test location. Done means the query no longer panics and its response is handled correctly.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
api, backend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.