Open LiilyZhang opened 2 months ago
See nil pointer when failed to create index. The code should throw out a defined error
* CSS: 2024/07/30 21:09:22 INFO: CConnecting to mongo... * CSS: 2024/07/30 21:09:22 INFO: connect to mongo... * CSS: 2024/07/30 21:09:22 INFO: Connected to mongo... * CSS: 2024/07/30 21:09:22 INFO: Connected to the database CSS: 2024/07/30 21:09:22 INFO: Connected to the database CSS: 2024/07/30 21:09:22 ERROR: Failed to create an index on syncObjects. Error: (Unauthorized) there are no users authenticated CSS: 2024/07/30 21:09:22 ERROR: Failed to create an index on syncObjects. Error: (Unauthorized) there are no users authenticated panic: runtime error: invalid memory address or nil pointer dereference [signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x14a1057] goroutine 1 [running]: github.com/open-horizon/edge-sync-service/core/storage.(*MongoStorage).update.func1(0xc000496840?) /tmp/anax-gopath/pkg/mod/github.com/open-horizon/edge-sync-service@v1.11.0/core/storage/mongoStorageHelpers.go:214 +0x97 github.com/open-horizon/edge-sync-service/core/storage.(*MongoStorage).withCollectionHelper(0xc00018ce40, {0x18673a1, 0x12}, 0xc000525a38, 0x0) /tmp/anax-gopath/pkg/mod/github.com/open-horizon/edge-sync-service@v1.11.0/core/storage/mongoStorageHelpers.go:532 +0xf2 github.com/open-horizon/edge-sync-service/core/storage.(*MongoStorage).update(0x1698260?, {0x18673a1, 0x12}, {0x1698260?, 0xc0005e2990}, {0x1698260?, 0xc0005e29c0}) /tmp/anax-gopath/pkg/mod/github.com/open-horizon/edge-sync-service@v1.11.0/core/storage/mongoStorageHelpers.go:221 +0x8f github.com/open-horizon/edge-sync-service/core/storage.(*MongoStorage).LeaderPeriodicUpdate(0xbd46fe692ca07889?, {0xc0004c6090, 0x24}) /tmp/anax-gopath/pkg/mod/github.com/open-horizon/edge-sync-service@v1.11.0/core/storage/mongoStorage.go:2045 +0x26e github.com/open-horizon/edge-sync-service/core/leader.initializeLeadership() /tmp/anax-gopath/pkg/mod/github.com/open-horizon/edge-sync-service@v1.11.0/core/leader/leader.go:54 +0x1d7 github.com/open-horizon/edge-sync-service/core/leader.StartLeaderDetermination({0x1b5ac80?, 0xc00018ce40?}) /tmp/anax-gopath/pkg/mod/github.com/open-horizon/edge-sync-service@v1.11.0/core/leader/leader.go:39 +0x8f github.com/open-horizon/edge-sync-service/core/base.Start({0x0, 0x0}, 0x15?) /tmp/anax-gopath/pkg/mod/github.com/open-horizon/edge-sync-service@v1.11.0/core/base/base.go:122 +0x737 github.com/open-horizon/edge-sync-service/core/base.StandaloneSyncService({0x1b38930?, 0xc0003f6fe8}) /tmp/anax-gopath/pkg/mod/github.com/open-horizon/edge-sync-service@v1.11.0/core/base/standalone.go:118 +0x5bc main.main() /tmp/anax-gopath/src/github.com/open-horizon/anax/css/cmd/cloud-sync-service/main.go:28 +0x2e
See nil pointer when failed to create index. The code should throw out a defined error