skycoin / skywire

Skywire Node implementation
73 stars 45 forks source link

running visor panic on package uninstall #1768

Closed 0pcom closed 3 months ago

0pcom commented 3 months ago

I uninstalled skywire while a visor was running in another terminal.

This is not really something that needs to be fixed, but it could be handled more gracefully.

Basically every file which comprises the installation was removed. I don't think the panic happened immediately, only on ctrl+c

We should devise a more graceful shutdown or recovery behavior in this instance.

[2024-03-14T11:43:41.10284639-05:00] WARN [tp:02b5c8]: Failed to record log entry. error="open /opt/skywire/local/transport_logs/2024-03-14.csv: no such file or directory"
[2024-03-14T11:43:44.102405327-05:00] WARN [tp:02b5c8]: Failed to record log entry. error="open /opt/skywire/local/transport_logs/2024-03-14.csv: no such file or directory"
[2024-03-14T11:43:47.102857435-05:00] WARN [tp:02b5c8]: Failed to record log entry. error="open /opt/skywire/local/transport_logs/2024-03-14.csv: no such file or directory"
[2024-03-14T11:43:50.102834657-05:00] WARN [tp:02b5c8]: Failed to record log entry. error="open /opt/skywire/local/transport_logs/2024-03-14.csv: no such file or directory"
[2024-03-14T11:43:53.102957631-05:00] WARN [tp:02b5c8]: Failed to record log entry. error="open /opt/skywire/local/transport_logs/2024-03-14.csv: no such file or directory"
[2024-03-14T11:43:56.102808106-05:00] WARN [tp:02b5c8]: Failed to record log entry. error="open /opt/skywire/local/transport_logs/2024-03-14.csv: no such file or directory"
[2024-03-14T11:43:59.10277847-05:00] WARN [tp:02b5c8]: Failed to record log entry. error="open /opt/skywire/local/transport_logs/2024-03-14.csv: no such file or directory"
[2024-03-14T11:44:02.102595169-05:00] WARN [tp:02b5c8]: Failed to record log entry. error="open /opt/skywire/local/transport_logs/2024-03-14.csv: no such file or directory"
[2024-03-14T11:44:05.102549954-05:00] WARN [tp:02b5c8]: Failed to record log entry. error="open /opt/skywire/local/transport_logs/2024-03-14.csv: no such file or directory"
[2024-03-14T11:44:08.102515221-05:00] WARN [tp:02b5c8]: Failed to record log entry. error="open /opt/skywire/local/transport_logs/2024-03-14.csv: no such file or directory"
[2024-03-14T11:44:11.102067004-05:00] WARN [tp:02b5c8]: Failed to record log entry. error="open /opt/skywire/local/transport_logs/2024-03-14.csv: no such file or directory"
[2024-03-14T11:44:14.102516463-05:00] WARN [tp:02b5c8]: Failed to record log entry. error="open /opt/skywire/local/transport_logs/2024-03-14.csv: no such file or directory"
[2024-03-14T11:44:17.102746663-05:00] WARN [tp:02b5c8]: Failed to record log entry. error="open /opt/skywire/local/transport_logs/2024-03-14.csv: no such file or directory"
[2024-03-14T11:44:20.102680288-05:00] WARN [tp:02b5c8]: Failed to record log entry. error="open /opt/skywire/local/transport_logs/2024-03-14.csv: no such file or directory"
[2024-03-14T11:44:23.102363695-05:00] WARN [tp:02b5c8]: Failed to record log entry. error="open /opt/skywire/local/transport_logs/2024-03-14.csv: no such file or directory"
^C[2024-03-14T11:44:25.490113063-05:00] INFO []: Closing with received signal. signal=interrupt
[2024-03-14T11:44:25.49024549-05:00] DEBUG [transport_setup]: Dmsg client stopped serving. error="dmsg error 200 - local entity closed"
[2024-03-14T11:44:25.490287524-05:00] INFO [visor:shutdown]: Begin shutdown.
[2024-03-14T11:44:25.490368083-05:00] DEBUG [16/16] [visor:shutdown:skywire_ping]: Shutting down module...
[2024-03-14T11:44:25.490434408-05:00] DEBUG [16/16] [visor:shutdown:skywire_ping]: Module stopped cleanly. elapsed=78.413µs
[2024-03-14T11:44:25.490485387-05:00] DEBUG [15/16] [visor:shutdown:sky_forwarding]: Shutting down module...
[2024-03-14T11:44:25.490552024-05:00] DEBUG [15/16] [visor:shutdown:sky_forwarding]: Module stopped cleanly. elapsed=72.551µs
[2024-03-14T11:44:25.490596165-05:00] DEBUG [14/16] [visor:shutdown:dmsgctrl]: Shutting down module...
[2024-03-14T11:44:25.490651586-05:00] DEBUG [14/16] [visor:shutdown:dmsgctrl]: Module stopped cleanly. elapsed=58.318µs
[2024-03-14T11:44:25.490698665-05:00] DEBUG [13/16] [visor:shutdown:launcher.proc_manager]: Shutting down module...
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x8 pc=0xeb3dea]

goroutine 70711 [running]:
go.etcd.io/bbolt.(*Bucket).Put(0xc0005fc018?, {0xc0007448a0?, 0x73?, 0x8?}, {0xc000558000?, 0xc0005fc000?, 0xc0005fc000?})
    go.etcd.io/bbolt@v1.3.7/bucket.go:279 +0x2a
github.com/skycoin/skywire/pkg/app/appcommon.(*bBoltLogStore).Fire.func2(0x523f3f?)
    github.com/skycoin/skywire/pkg/app/appcommon/log_store.go:221 +0xa9
go.etcd.io/bbolt.(*DB).Update(0xc00014c201?, 0xc0000d7230)
    go.etcd.io/bbolt@v1.3.7/db.go:862 +0x75
github.com/skycoin/skywire/pkg/app/appcommon.(*bBoltLogStore).Fire(0xc000780240, 0xc000388150)
    github.com/skycoin/skywire/pkg/app/appcommon/log_store.go:219 +0x226
github.com/sirupsen/logrus.LevelHooks.Fire(0xc0000d7440?, 0xd7400?, 0xc000388150)
    github.com/sirupsen/logrus@v1.9.3/hooks.go:28 +0x64
github.com/sirupsen/logrus.(*Entry).fireHooks(0xc000388150)
    github.com/sirupsen/logrus@v1.9.3/entry.go:280 +0x1fa
github.com/sirupsen/logrus.(*Entry).log(0xc000567180, 0x4, {0xc0003d6048, 0x16})
    github.com/sirupsen/logrus@v1.9.3/entry.go:242 +0x399
github.com/sirupsen/logrus.(*Entry).Log(0xc000567180, 0x4, {0xc0000d7600?, 0x2?, 0x2?})
    github.com/sirupsen/logrus@v1.9.3/entry.go:304 +0x48
github.com/sirupsen/logrus.(*Entry).Logf(0xc000567180, 0x4, {0x16e9967?, 0x4111a5?}, {0xc000786020?, 0x14905a0?, 0x1?})
    github.com/sirupsen/logrus@v1.9.3/entry.go:349 +0x7c
github.com/sirupsen/logrus.(*Entry).Infof(0xc00065c008?, {0x16e9967?, 0x0?}, {0xc000786020?, 0x0?, 0x0?})
    github.com/sirupsen/logrus@v1.9.3/entry.go:362 +0x31
github.com/skycoin/skywire/pkg/app/appserver.(*Proc).SetDetailedStatus(0xc00048e008, {0xc00065c008, 0x7})
    github.com/skycoin/skywire/pkg/app/appserver/proc.go:360 +0x254
github.com/skycoin/skywire/pkg/app/appserver.(*RPCIngressGateway).SetDetailedStatus(0xc000098120, 0xc00067a030, 0x0?)
    github.com/skycoin/skywire/pkg/app/appserver/rpc_ingress_gateway.go:83 +0xd3
reflect.Value.call({0xc000465200?, 0xc000126ca0?, 0x13?}, {0x16d5955, 0x4}, {0xc0003e1ef8, 0x3, 0x3?})
    reflect/value.go:596 +0xce5
reflect.Value.Call({0xc000465200?, 0xc000126ca0?, 0xc00029f750?}, {0xc00029f6f8?, 0xc00029f6f8?, 0xc00029f6bc?})
    reflect/value.go:380 +0xb9
net/rpc.(*service).call(0xc000780480, 0xc000780440, 0xc0006f4810, 0xc0006f4820, 0xc00038ca00, 0xc000312f00, {0x145ad80?, 0xc00067a030?, 0x75df05?}, {0x1476600, ...}, ...)
    net/rpc/server.go:381 +0x20e
created by net/rpc.(*Server).ServeCodec in goroutine 345
    net/rpc/server.go:478 +0x3d7
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x8 pc=0xeb3dea]

goroutine 341 [running]:
go.etcd.io/bbolt.(*Bucket).Put(0xc0004260f8?, {0xc000550360?, 0xc2?, 0x8?}, {0xc000048750?, 0xc0004260e0?, 0xc0004260e0?})
    go.etcd.io/bbolt@v1.3.7/bucket.go:279 +0x2a
github.com/skycoin/skywire/pkg/app/appcommon.(*bBoltLogStore).Fire.func2(0x523f3f?)
    github.com/skycoin/skywire/pkg/app/appcommon/log_store.go:221 +0xa9
go.etcd.io/bbolt.(*DB).Update(0xc000048271?, 0xc00074fae8)
    go.etcd.io/bbolt@v1.3.7/db.go:862 +0x75
github.com/skycoin/skywire/pkg/app/appcommon.(*bBoltLogStore).Fire(0xc000780380, 0xc000564000)
    github.com/skycoin/skywire/pkg/app/appcommon/log_store.go:219 +0x226
github.com/sirupsen/logrus.LevelHooks.Fire(0xc000719cf8?, 0x719cb8?, 0xc000564000)
    github.com/sirupsen/logrus@v1.9.3/hooks.go:28 +0x64
github.com/sirupsen/logrus.(*Entry).fireHooks(0xc000564000)
    github.com/sirupsen/logrus@v1.9.3/entry.go:280 +0x1fa
github.com/sirupsen/logrus.(*Entry).log(0xc000567880, 0x5, {0xc0002c0240, 0x60})
    github.com/sirupsen/logrus@v1.9.3/entry.go:242 +0x399
github.com/sirupsen/logrus.(*Entry).Log(0xc000567880, 0x5, {0xc000676000?, 0x14905a0?, 0x1?})
    github.com/sirupsen/logrus@v1.9.3/entry.go:304 +0x48
github.com/sirupsen/logrus.(*Entry).Debug(...)
    github.com/sirupsen/logrus@v1.9.3/entry.go:313
github.com/sirupsen/logrus.(*Entry).writerScanner(0xc000567880, 0xc000464a80, 0xc00041a560)
    github.com/sirupsen/logrus@v1.9.3/writer.go:87 +0x113
created by github.com/sirupsen/logrus.(*Entry).WriterLevel in goroutine 203
    github.com/sirupsen/logrus@v1.9.3/writer.go:57 +0x31f
mrpalide commented 3 months ago

This is out of our control and related to logrus (bbolt) lib. You remove log file during uninstallation, so logrus (bbolt in fact) couldn't fine that file and get panic. You should change logic of uninstalling in package to keep local folder there (logs file).