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

Invalid memory address or nil pointer dereference on M1 #15

Closed
MilanVives opened this issue Feb 8, 2022 · 3 comments
Closed

Invalid memory address or nil pointer dereference on M1 #15

MilanVives opened this issue Feb 8, 2022 · 3 comments

Comments

@MilanVives
Copy link
Contributor

~ ➤ docker run -d --name redis redis
ae44475c8835158e4c1d36406de38048b3b797e49f5f86a80e23f3e330b89c9f
~ ➤ apf redis

*  ==> : Forwarding local listening ports to (==>) remote ports
*  <== : Forwarding to local ports from (<==) remote listening ports (use -r option)

Forwarding: []panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x2 addr=0x18 pc=0x102cdff34]

goroutine 8 [running]:
io.ReadAtLeast({0x0, 0x0}, {0x140000ae00a, 0x3, 0x3}, 0x3)
	/opt/hostedtoolcache/go/1.17.5/x64/src/io/io.go:328 +0x74
io.ReadFull(...)
	/opt/hostedtoolcache/go/1.17.5/x64/src/io/io.go:347
github.com/ruoshan/autoportforward/manager.(*Manager).receivingLoop(0x14000066000)
	/home/runner/work/autoportforward/autoportforward/manager/manager.go:86 +0xb8
created by github.com/ruoshan/autoportforward/manager.(*Manager).Run
	/home/runner/work/autoportforward/autoportforward/manager/manager.go:74 +0x54
~ ➤
@ruoshan
Copy link
Owner

ruoshan commented Feb 9, 2022

Hey @MilanVives , thank you for reporting this issue. I just add some debug lines in the latest main branch to debug this issue. Can you help me build a new binary and see what it prints?

To build this app, you need to:

  • clone this repo
  • and run ./build.sh
  • the new binary will be placed in the top directory of the repo.

Also, you can enable the logging by using ./apf -d. the log files are located at /tmp/autoportforward.log both on the host and in the container. Appreciate it if you can post them back here.

@MilanVives
Copy link
Contributor Author

Hi @ruoshan, thank you for the great work and also of taking the time to follow up with the issues.
Problem seems solved in the latest build.

autoportforward ➤ docker ps                                                                           git:main
CONTAINER ID   IMAGE     COMMAND                  CREATED        STATUS        PORTS      NAMES
ae44475c8835   redis     "docker-entrypoint.s…"   17 hours ago   Up 17 hours   6379/tcp   redis
autoportforward ➤ ./apf redis                                                                         git:main

*  ==> : Forwarding local listening ports to (==>) remote ports
*  <== : Forwarding to local ports from (<==) remote listening ports (use -r option)

Forwarding: [6379 ==> 6379]
autoportforward ➤ sudo netstat -ta | grep 6379                                                        git:main
tcp4       0      0  *.6379                 *.*                    LISTEN
autoportforward ➤

I will runs some further tests just to be sure but looks very promising. Great work!

@ruoshan
Copy link
Owner

ruoshan commented Feb 9, 2022

I might find the root cause here, it's the docker on m1 machine is using ARM64 images. and the binary I build using gh action is for AMD64 arch.

when you are building natively, it will work. however, when cross-compile, it needs some fixes.

I don't have a m1 machine, never get a chance to test it. will release a fix soon.

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

2 participants