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

panic has occurred in the commands handler #7912

Closed
ligi opened this issue Feb 14, 2021 · 6 comments
Closed

panic has occurred in the commands handler #7912

ligi opened this issue Feb 14, 2021 · 6 comments
Assignees
Labels
kind/bug A bug in existing code (including security flaws) need/analysis Needs further analysis before proceeding

Comments

@ligi
Copy link

ligi commented Feb 14, 2021

just got a panic with go-ipfs. Not yet running 0.7 - so feel free to close - but maybe the stacktrace is useful to you - so reporting it here.

Version information:

ipfs version --all
go-ipfs version: 0.6.0
Repo version: 10
System version: amd64/linux
Golang version: go1.14.4

Description:

The node was hanging and not serving http anymore. Needed to kill it with ^C

2021-01-27T03:11:35.515-0600    ERROR   dht     go-libp2p-kad-dht@v0.8.2/dht_net.go:87  ignoring incoming dht message while not in server mode
n2021-02-14T06:04:11.685-0600   ERROR   core/commands   commands/pin.go:132    context canceled
2021-02-14T06:22:40.999-0600    ERROR   cmds/http       http/handler.go:94     a panic has occurred in the commands handler!
2021-02-14T06:22:41.094-0600    ERROR   cmds/http       http/handler.go:95     runtime error: invalid memory address or nil pointer dereference
2021-02-14T06:22:41.137-0600    ERROR   cmds/http       http/handler.go:96     stack trace:
goroutine 1492277027 [running]:
runtime/debug.Stack(0xc00048a180, 0x19eea02, 0x0)
        /usr/local/go/src/runtime/debug/stack.go:24 +0x9d
github.com/ipfs/go-ipfs-cmds/http.(*handler).ServeHTTP.func1()
        pkg/mod/github.com/ipfs/go-ipfs-cmds@v0.2.9/http/handler.go:96 +0x153
panic(0x19eeaa0, 0x2b42db0)
        /usr/local/go/src/runtime/panic.go:975 +0x3e3
github.com/ipfs/go-ipfs/core/commands.pinLsAll(0xc01784cd20, 0x1bd8b30, 0x3, 0x1f6f980, 0xc002682780, 0xc01f197198, 0x0, 0xc00047f180)
        pkg/mod/github.com/ipfs/go-ipfs@v0.6.0/core/commands/pin.go:505 +0x2bd
github.com/ipfs/go-ipfs/core/commands.glob..func118(0xc01784cd20, 0x1f565a0, 0xc01784cd90, 0x1aa51e0, 0xc002e9bf20, 0x0, 0x0)
        pkg/mod/github.com/ipfs/go-ipfs@v0.6.0/core/commands/pin.go:349 +0x389
github.com/ipfs/go-ipfs-cmds.(*Command).call(0x2b5a420, 0xc01784cd20, 0x1f565a0, 0xc01784cd90, 0x1aa51e0, 0xc002e9bf20, 0x1b0acc0, 0x1f565a0)
        pkg/mod/github.com/ipfs/go-ipfs-cmds@v0.2.9/command.go:140 +0x21f
github.com/ipfs/go-ipfs-cmds.(*Command).Call(0x2b5a420, 0xc01784cd20, 0x1f565a0, 0xc01784cd90, 0x1aa51e0, 0xc002e9bf20)
        pkg/mod/github.com/ipfs/go-ipfs-cmds@v0.2.9/command.go:110 +0x81
github.com/ipfs/go-ipfs-cmds/http.(*handler).ServeHTTP(0xc002168360, 0x7ff4c04c1608, 0xc01e81f950, 0xc02f81d300)
        pkg/mod/github.com/ipfs/go-ipfs-cmds@v0.2.9/http/handler.go:192 +0x82c
github.com/ipfs/go-ipfs-cmds/http.prefixHandler.ServeHTTP(0x1bdcf42, 0x7, 0x1f22ba0, 0xc002168360, 0x7ff4c04c1608, 0xc01e81f950, 0xc02f81d300)
        pkg/mod/github.com/ipfs/go-ipfs-cmds@v0.2.9/http/apiprefix.go:24 +0xc2
github.com/rs/cors.(*Cors).Handler.func1(0x7ff4c04c1608, 0xc01e81f950, 0xc02f81d300)
        pkg/mod/github.com/rs/cors@v1.7.0/cors.go:219 +0x1b8
net/http.HandlerFunc.ServeHTTP(0xc0021683a0, 0x7ff4c04c1608, 0xc01e81f950, 0xc02f81d300)
        /usr/local/go/src/net/http/server.go:2012 +0x44
net/http.(*ServeMux).ServeHTTP(0xc002158740, 0x7ff4c04c1608, 0xc01e81f950, 0xc02f81d300)
        /usr/local/go/src/net/http/server.go:2387 +0x1a5
github.com/ipfs/go-ipfs/core/corehttp.CheckVersionOption.func1.1(0x7ff4c04c1608, 0xc01e81f950, 0xc02f81d300)
        pkg/mod/github.com/ipfs/go-ipfs@v0.6.0/core/corehttp/commands.go:182 +0x2f9
net/http.HandlerFunc.ServeHTTP(0xc002168320, 0x7ff4c04c1608, 0xc01e81f950, 0xc02f81d300)
        /usr/local/go/src/net/http/server.go:2012 +0x44
net/http.(*ServeMux).ServeHTTP(0xc0021586c0, 0x7ff4c04c1608, 0xc01e81f950, 0xc02f81d300)
        /usr/local/go/src/net/http/server.go:2387 +0x1a5
github.com/prometheus/client_golang/prometheus/promhttp.InstrumentHandlerResponseSize.func1(0x7ff4c04c1608, 0xc01e81f900, 0xc02f81d300)
        pkg/mod/github.com/prometheus/client_golang@v1.6.0/prometheus/promhttp/instrument_server.go:196 +0xea
net/http.HandlerFunc.ServeHTTP(0xc000c3ac90, 0x7ff4c04c1608, 0xc01e81f900, 0xc02f81d300)
        /usr/local/go/src/net/http/server.go:2012 +0x44
github.com/prometheus/client_golang/prometheus/promhttp.InstrumentHandlerRequestSize.func2(0x7ff4c04c1608, 0xc01e81f900, 0xc02f81d300)
        pkg/mod/github.com/prometheus/client_golang@v1.6.0/prometheus/promhttp/instrument_server.go:170 +0x74
net/http.HandlerFunc.ServeHTTP(0xc000c3ad50, 0x7ff4c04c1608, 0xc01e81f900, 0xc02f81d300)
        /usr/local/go/src/net/http/server.go:2012 +0x44
github.com/prometheus/client_golang/prometheus/promhttp.InstrumentHandlerDuration.func2(0x7ff4c04c1608, 0xc01e81f900, 0xc02f81d300)
        pkg/mod/github.com/prometheus/client_golang@v1.6.0/prometheus/promhttp/instrument_server.go:76 +0xb2
net/http.HandlerFunc.ServeHTTP(0xc000c3ade0, 0x7ff4c04c1608, 0xc01e81f900, 0xc02f81d300)
        /usr/local/go/src/net/http/server.go:2012 +0x44
github.com/prometheus/client_golang/prometheus/promhttp.InstrumentHandlerCounter.func1(0x1f4f7e0, 0xc00c82a2a0, 0xc02f81d300)
        pkg/mod/github.com/prometheus/client_golang@v1.6.0/prometheus/promhttp/instrument_server.go:100 +0xda
net/http.HandlerFunc.ServeHTTP(0xc000c3af30, 0x1f4f7e0, 0xc00c82a2a0, 0xc02f81d300)
        /usr/local/go/src/net/http/server.go:2012 +0x44
net/http.(*ServeMux).ServeHTTP(0xc002158680, 0x1f4f7e0, 0xc00c82a2a0, 0xc02f81d300)
        /usr/local/go/src/net/http/server.go:2387 +0x1a5
github.com/ipfs/go-ipfs/core/corehttp.makeHandler.func1(0x1f4f7e0, 0xc00c82a2a0, 0xc02f81d300)
        pkg/mod/github.com/ipfs/go-ipfs@v0.6.0/core/corehttp/corehttp.go:54 +0x6c
net/http.HandlerFunc.ServeHTTP(0xc00164f260, 0x1f4f7e0, 0xc00c82a2a0, 0xc02f81d300)
        /usr/local/go/src/net/http/server.go:2012 +0x44
net/http.serverHandler.ServeHTTP(0xc000c76540, 0x1f4f7e0, 0xc00c82a2a0, 0xc02f81d300)
        /usr/local/go/src/net/http/server.go:2807 +0xa3
net/http.(*conn).serve(0xc00ea35720, 0x1f560a0, 0xc03a8dbe80)
        /usr/local/go/src/net/http/server.go:1895 +0x86c
created by net/http.(*Server).Serve
        /usr/local/go/src/net/http/server.go:2933 +0x35c


^C
Received interrupt signal, shutting down...
(Hit ctrl-c again to force-shutdown the daemon.)

@ligi ligi added kind/bug A bug in existing code (including security flaws) need/triage Needs initial labeling and prioritization labels Feb 14, 2021
@hasitpbhatt
Copy link

As per the stack trace, if it's occurring in 0.6.0, it can occur in the latest version as well.
https://github.com/ipfs/go-ipfs/blob/c7d4b8d34c435e75a7f4bceefea4de9c208fcaec/core/commands/pin/pin.go#L509 (latest)
https://github.com/ipfs/go-ipfs/blob/5a19539223fa5b65eb491b5e2180c369e7ed1137/core/commands/pin.go#L505 (v0.6.0)

I'm not sure why p.Path() is returning empty (nil) resolved path though.

@aschmahmann aschmahmann self-assigned this Feb 22, 2021
@aschmahmann aschmahmann added need/analysis Needs further analysis before proceeding and removed need/triage Needs initial labeling and prioritization labels Feb 22, 2021
@aschmahmann
Copy link
Contributor

I think this was fixed by #7612 and is in v0.7.0+, but feel free to reopen if the issue still occurs.

@hasitpbhatt
Copy link

@aschmahmann I'm not sure what that commit does.

if p.Err() != nil {
    return err
}

Here, err is from parent scope and would be nil. So, we are probably returning nil here. Do let me know if that isn't correct. It should have been return p.Err().

@aschmahmann
Copy link
Contributor

yep, looks like it should've been returning p.Err().

@hasitpbhatt
Copy link

Should we reopen this then? Or you can fix it in another PR, I'll leave it up to you. :)

@aschmahmann
Copy link
Contributor

aschmahmann commented Feb 25, 2021

It's a different issue. The only bad thing that happens is that an error is swallowed during what is likely just a user aborting the command early.

I'll just open a PR on it (and post back the PR # here as a reference)

Update: PR opened at #7942

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug A bug in existing code (including security flaws) need/analysis Needs further analysis before proceeding
Projects
None yet
Development

No branches or pull requests

3 participants