RSS3-Network / Node

In the vast RSS3 Network, the RSS3 Node delivers Open Information with efficiency, it is a steadfast cruiser in the byte-filled sea.
MIT License
24 stars 3 forks source link

v1.1.1 `./node` Crash at start with nil pointer exception due to an invalid `rsshub` config #617

Open gnufred opened 1 hour ago

gnufred commented 1 hour ago

What is expected?

It is expected that ./node parse the configuration file properly and fails gracefully with a clear error message, if the configuration file is "incorrect".

The issue here is that the configuration is generate by the HelmChart so we cannot control what gets written in the file, and we had to fork the chart and edit the ConfigMap chart to generate a working config file.

But still, what is important here is that the ./node binary parses its configuration file properly and handle error gracefully.

What is actually happening?

We upgraded from 1.0.2 to 1.1.1 and the ./node crash and nil pointer error.

This is the rsshub config generated the by the RSS3 node chart and our configuration.

component:
      rss:
        endpoint: https://rsshub.app/
        network: rss
        parameters:
          authentication:
            access_code: null
            access_key: null
            password: null
            username: null

With this config, 1.0.2 start as expected, but with 1.1.1, it doesn't.

Additional info

The error we get on startup is:

panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x20 pc=0xebb3c5]

goroutine 1 [running]:
github.com/rss3-network/node/config._Setup({0x246c962?, 0x1da87cd?}, {0x2459897?, 0xc00045af00?}, 0xc000102700)
    /root/node/config/config.go:268 +0x685
github.com/rss3-network/node/config.Setup({0x246c962?, 0x0?})
    /root/node/config/config.go:214 +0x105
main.init.func1(0x3b51c60, {0x2464e22?, 0x7?, 0x24598b7?})
    /root/node/cmd/main.go:57 +0xe5
github.com/spf13/cobra.(*Command).execute(0x3b51c60, {0xc00003e050, 0x1, 0x1})
    /go/pkg/mod/github.com/spf13/cobra@v1.8.1/command.go:985 +0xaca
github.com/spf13/cobra.(*Command).ExecuteC(0x3b51c60)
    /go/pkg/mod/github.com/spf13/cobra@v1.8.1/command.go:1117 +0x3ff
github.com/spf13/cobra.(*Command).Execute(...)
    /go/pkg/mod/github.com/spf13/cobra@v1.8.1/command.go:1041
github.com/spf13/cobra.(*Command).ExecuteContext(...)
    /go/pkg/mod/github.com/spf13/cobra@v1.8.1/command.go:1034
main.main()
    /root/node/cmd/main.go:375 +0xcf


### This is not a duplicated issue

- [X] I have searched [existing issues](https://github.com/rss3-network/node/issues) to ensure this bug has not already been reported
pseudoyu commented 1 hour ago

Hi, to resolve this issue, please try updating the RSS configuration in your config file to match the latest changes from our helm-chart repository

component:
      rss:
        endpoint: https://rsshub.app/
        id: rsshub-core
        network: rsshub
        worker: core
        parameters:
          authentication:
            access_code: null
            access_key: null
            password: null
            username: null

These changes should help resolve the problem. Let us know if you need any further assistance.