Skip to content
This repository was archived by the owner on Nov 10, 2025. It is now read-only.
This repository was archived by the owner on Nov 10, 2025. It is now read-only.

applicationlogs get lost on shutdown #786

@ixje

Description

@ixje

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()))
		}
	}
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions