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

Crash by logger #1733

Open
4 of 5 tasks
Autodystopia opened this issue May 1, 2024 · 0 comments
Open
4 of 5 tasks

Crash by logger #1733

Autodystopia opened this issue May 1, 2024 · 0 comments

Comments

@Autodystopia
Copy link

Operating system

Others

System version

NA

Installation type

Original sing-box Command Line

If you are using a graphical client, please provide the version of the client.

No response

Version

v1.8.12 / 1.9.0rc14

Description

If log writes to file and tcp/udp routed to different outbounds, this leads to crash, because logger.Log() called before logger.Start()

Reproduction

config.json

{
	"log": {
		"output": "sing-box.log"
	},
	"inbounds": [
		{
			"tag": "in",
			"type": "socks",
			"listen": "127.0.0.1",
			"listen_port": 2080
		}
	],
	"outbounds": [
		{
			"tag": "out",
			"type": "socks",
			"server": "127.0.0.1",
			"server_port": 2081
			// This guy
			,"network": "tcp"
		}
	]
}

Logs

panic: runtime error: invalid memory address or nil pointer dereference
[signal 0xc0000005 code=0x0 addr=0x18 pc=0xc2657e]

goroutine 1 [running]:
github.com/sagernet/sing-box/log.(*observableLogger).Log(0xc000108000, {0x1a239a0, 0x24d5600}, 0xc5?, {0xc000128000, 0x5, 0x5})
        github.com/sagernet/sing-box/log/observable.go:131 +0x45e
github.com/sagernet/sing-box/log.(*observableLogger).InfoContext(...)
        github.com/sagernet/sing-box/log/observable.go:178
github.com/sagernet/sing-box/log.(*observableLogger).Info(0xc0001e5cc3?, {0xc000128000?, 0x181b42a?, 0x6?})
        github.com/sagernet/sing-box/log/observable.go:150 +0x35
github.com/sagernet/sing-box/route.(*Router).Initialize(0xc00010c008, {0xc00010e030, 0x1, 0x3?}, {0xc00010e040, 0x1, 0x1}, 0xc0000c5760)
        github.com/sagernet/sing-box/route/router.go:401 +0xb38
github.com/sagernet/sing-box.New({{{0xc0001b6400, 0x1b6, 0x200}, {0x0, 0x0}, 0xc0001deff0, 0x0, 0x0, {0xc00009c408, 0x1, ...}, ...}, ...})
        github.com/sagernet/sing-box/box.go:141 +0x1105
main.create()
        github.com/sagernet/sing-box/cmd/sing-box/cmd_run.go:137 +0x198
main.run()
        github.com/sagernet/sing-box/cmd/sing-box/cmd_run.go:174 +0x10c
main.init.func24(0xc000189900?, {0x181a668?, 0x4?, 0x181a66c?})
        github.com/sagernet/sing-box/cmd/sing-box/cmd_run.go:30 +0x17
github.com/spf13/cobra.(*Command).execute(0x2441d60, {0x24d5600, 0x0, 0x0})
        github.com/spf13/cobra@v1.8.0/command.go:987 +0xab1
github.com/spf13/cobra.(*Command).ExecuteC(0x2442040)
        github.com/spf13/cobra@v1.8.0/command.go:1115 +0x3ff
github.com/spf13/cobra.(*Command).Execute(...)
        github.com/spf13/cobra@v1.8.0/command.go:1039
main.main()
        github.com/sagernet/sing-box/cmd/sing-box/main.go:38 +0x1e

Supporter

Integrity requirements

  • I confirm that I have read the documentation, understand the meaning of all the configuration items I wrote, and did not pile up seemingly useful options or default values.
  • I confirm that I have provided the server and client configuration files and process that can be reproduced locally, instead of a complicated client configuration file that has been stripped of sensitive data.
  • I confirm that I have provided the simplest configuration that can be used to reproduce the error I reported, instead of depending on remote servers, TUN, graphical interface clients, or other closed-source software.
  • I confirm that I have provided the complete configuration files and logs, rather than just providing parts I think are useful out of confidence in my own intelligence.
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

1 participant