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

index out of range error #891

Closed
nuliknol opened this issue Jul 30, 2020 · 2 comments
Closed

index out of range error #891

nuliknol opened this issue Jul 30, 2020 · 2 comments

Comments

@nuliknol
Copy link

Using the version 9.4.1 you uploaded 2 days ago I am getting index out of range error when fetching all the orders via webservice using batches of 256 orders per page:


{"err_string":"websocket: close 1006 (abnormal closure): unexpected EOF","level":"error","msg":"rpcSub returned an error","myPeerID":"16Uiu2HAmQZYxQiQTAcEmmKCx6idBDAYzWaAocinoKGzxBrrxqknP","time":"2020-07-30T01:33:18Z"}
{"err_string":"websocket: close 1006 (abnormal closure): unexpected EOF","level":"error","msg":"rpcSub returned an error","myPeerID":"16Uiu2HAmQZYxQiQTAcEmmKCx6idBDAYzWaAocinoKGzxBrrxqknP","time":"2020-07-30T19:40:27Z"}
{"err_string":"websocket: close 1006 (abnormal closure): unexpected EOF","level":"error","msg":"rpcSub returned an error","myPeerID":"16Uiu2HAmQZYxQiQTAcEmmKCx6idBDAYzWaAocinoKGzxBrrxqknP","time":"2020-07-30T20:31:41Z"}
panic: runtime error: index out of range [1] with length 0

goroutine 2439680 [running]:
github.com/0xProject/0x-mesh/core/ordersync.(*Service).HandleStream(0xc001514d20, 0x126d780, 0xc001cf1d00)
	/home/explorer/0x-mesh/core/ordersync/ordersync.go:241 +0x14fa
github.com/libp2p/go-libp2p/p2p/host/basic.(*BasicHost).SetStreamHandler.func1(0xc0004bf8c0, 0x1d, 0x7f13a1bade20, 0xc001cf1d00, 0x1d, 0xc00042a020)
	/home/explorer/go/pkg/mod/github.com/libp2p/go-libp2p@v0.5.1/p2p/host/basic/basic_host.go:397 +0x9d
created by github.com/libp2p/go-libp2p/p2p/host/basic.(*BasicHost).newStreamHandler
	/home/explorer/go/pkg/mod/github.com/libp2p/go-libp2p@v0.5.1/p2p/host/basic/basic_host.go:295 +0x6a2

Client code looks like this:

  var done bool = false
   for !done {
       orders2sync,err := rpcclient.GetOrders(page_num,page_size,"")
       if err == nil {
           sync_orders(orders2sync,&ohash_map)
           if len(orders2sync.OrdersInfos) == 0 { 
               done = true
           }
       } else {
           done = true
       }
       Info.Printf("Order sync: page %v processed\n",page_num)
       page_num++
       orders_total = orders_total + len(orders2sync.OrdersInfos)
   }   

Not sure but maybe overflow in page_num in client's code is what causing crash on server side.

@jalextowle
Copy link
Contributor

We aware about this issue in release 9.4.1. We are currently working on better testing for the ordersync service, and we will release version 9.4.2 to address this regression soon!

@albrow
Copy link
Contributor

albrow commented Aug 11, 2020

This was fixed in version 9.4.2.

@albrow albrow closed this as completed Aug 11, 2020
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

3 participants