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

applicationlogs get lost on shutdown #786

Closed
ixje opened this issue Jan 10, 2023 · 1 comment · Fixed by neo-project/neo#2842
Closed

applicationlogs get lost on shutdown #786

ixje opened this issue Jan 10, 2023 · 1 comment · Fixed by neo-project/neo#2842

Comments

@ixje
Copy link
Contributor

ixje commented Jan 10, 2023

Describe the bug
Shutting down a node causes application logs to get lost.

To Reproduce

  1. install neo-cli and ApplicationLogs plugin
  2. run the node and let it sync a few blocks
  3. shutdown by typing exit or ctrl+c
  4. edit config.json and comment out the nodes and put some bogus IP in there to stop it from syncing any further (hi Remove unnecessary default seedlist neo#2773)
  5. request the block applicationlog (not TX) of the last height (see show state) using the getapplicationlog RPC call
  6. Observe that it cannot be found while the block itself found. The same holds for a couple of blocks near the end (height-n)

for example using the snippet below on my local node I get

Testing http://127.0.0.1:20332
Validating applogs for block 0 to 2340
2336 - Unknown transaction/blockhash (-100) -    at Neo.Plugins.LogReader.GetApplicationLog(JArray _params)
   at Neo.Plugins.RpcServer.ProcessRequestAsync(HttpContext context, JObject request)
2337 - Unknown transaction/blockhash (-100) -    at Neo.Plugins.LogReader.GetApplicationLog(JArray _params)
   at Neo.Plugins.RpcServer.ProcessRequestAsync(HttpContext context, JObject request)
2338 - Unknown transaction/blockhash (-100) -    at Neo.Plugins.LogReader.GetApplicationLog(JArray _params)
   at Neo.Plugins.RpcServer.ProcessRequestAsync(HttpContext context, JObject request)
2339 - Unknown transaction/blockhash (-100) -    at Neo.Plugins.LogReader.GetApplicationLog(JArray _params)
   at Neo.Plugins.RpcServer.ProcessRequestAsync(HttpContext context, JObject request)
2340 - Unknown transaction/blockhash (-100) -    at Neo.Plugins.LogReader.GetApplicationLog(JArray _params)
   at Neo.Plugins.RpcServer.ProcessRequestAsync(HttpContext context, JObject request)

Expected behavior
I expect for each block that is persisted that the application log is also persisted when shut down.

Platform:

  • OS: ubuntu 22.04
  • Version: neo-cli 3.5.0

(Optional) Additional context

here's a small go snippet you can use to test

package main

import (
	"context"
	"fmt"
	"github.com/nspcc-dev/neo-go/pkg/rpcclient"
	"os"
)

func main() {
	source := os.Args[1]
	fmt.Println("Testing", source)
	client, err := rpcclient.New(context.TODO(), source, rpcclient.Options{})
	if err != nil {
		panic(err)
	}
	err = client.Init()
	if err != nil {
		panic(err)
	}

	count, err := client.GetBlockCount()
	if err != nil {
		panic(err)
	}

	fmt.Printf("Validating applogs for block 0 to %d\n", count-1)
	for i := uint32(0); i < count; i++ {
		h, err := client.GetBlockHash(i)
		if err != nil {
			panic(err)
		}
		_, err = client.GetApplicationLog(h, nil)
		if err != nil {
			fmt.Println(fmt.Errorf("%d - %s", i, err.Error()))
		}
	}
}
@ixje ixje changed the title block applicationlogs get lost on shutdown applicationlogs get lost on shutdown Jan 11, 2023
@ixje
Copy link
Contributor Author

ixje commented Jan 11, 2023

Note I updated the title to reflect that fact that also transaction applogs get lost. At the time of writing the issue description I didn't confirm that, but now that I understand the root cause I know TX logs also will get lost

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

Successfully merging a pull request may close this issue.

1 participant