Fix nrf#47: Panic on empty JSON Patch #19
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hi free5gc team,
This PR updates the json-path and mongoapi dependency.
json-path's upgrade fixes the panic mentioned in free5gc/nrf#47.
New version of the util package will need to be released, and this new version will need to be used in the NRF.
After the PR, the panic is replaced with the following error in the NRF. There might be additional checks to be done on the NRF.
PCAP: NRF - Panic on Patch after Util upgrade.zip
2024-12-05T12:45:55.155472540Z [ERRO][NRF][NFM] UpdateNFInstanceProcedure err: RestfulAPIJSONPatch Apply err: missing value github.com/evanphx/json-patch/v5.init /go/pkg/mod/github.com/evanphx/json-patch/[email protected]/merge.go:106 runtime.doInit1 /usr/local/go/src/runtime/proc.go:6735 runtime.doInit /usr/local/go/src/runtime/proc.go:6702 runtime.main /usr/local/go/src/runtime/proc.go:249 runtime.goexit /usr/local/go/src/runtime/asm_amd64.s:1650 replace operation does not apply: doc is missing key: /nfStatus github.com/evanphx/json-patch/v5.Patch.replace /go/pkg/mod/github.com/evanphx/json-patch/[email protected]/patch.go:1016 github.com/evanphx/json-patch/v5.Patch.ApplyIndentWithOptions /go/pkg/mod/github.com/evanphx/json-patch/[email protected]/patch.go:1262 github.com/evanphx/json-patch/v5.Patch.ApplyWithOptions /go/pkg/mod/github.com/evanphx/json-patch/[email protected]/patch.go:1210 github.com/evanphx/json-patch/v5.Patch.Apply /go/pkg/mod/github.com/evanphx/json-patch/[email protected]/patch.go:1204 github.com/free5gc/util/mongoapi.RestfulAPIJSONPatch /go/pkg/mod/github.com/linouxis9/[email protected]/mongoapi/mongoapi.go:357 github.com/free5gc/nrf/internal/sbi/processor.(*Processor).UpdateNFInstanceProcedure /go/src/free5gc/NFs/nrf/internal/sbi/processor/nf_management.go:333 github.com/free5gc/nrf/internal/sbi/processor.(*Processor).HandleUpdateNFInstanceRequest /go/src/free5gc/NFs/nrf/internal/sbi/processor/nf_management.go:51 github.com/free5gc/nrf/internal/sbi.(*Server).HTTPUpdateNFInstance /go/src/free5gc/NFs/nrf/internal/sbi/api_nfmanagement.go:196 github.com/gin-gonic/gin.(*Context).Next /go/pkg/mod/github.com/gin-gonic/[email protected]/context.go:174 github.com/free5gc/util/logger.NewGinWithLogrus.ginRecover.func2 /go/pkg/mod/github.com/linouxis9/[email protected]/logger/logger.go:330 github.com/gin-gonic/gin.(*Context).Next /go/pkg/mod/github.com/gin-gonic/[email protected]/context.go:174 github.com/free5gc/util/logger.NewGinWithLogrus.ginToLogrus.func1 /go/pkg/mod/github.com/linouxis9/[email protected]/logger/logger.go:256 github.com/gin-gonic/gin.(*Context).Next /go/pkg/mod/github.com/gin-gonic/[email protected]/context.go:174 github.com/gin-gonic/gin.(*Engine).handleHTTPRequest /go/pkg/mod/github.com/gin-gonic/[email protected]/gin.go:620 github.com/gin-gonic/gin.(*Engine).ServeHTTP /go/pkg/mod/github.com/gin-gonic/[email protected]/gin.go:576 golang.org/x/net/http2.(*serverConn).runHandler /go/pkg/mod/golang.org/x/[email protected]/http2/server.go:2369 runtime.goexit /usr/local/go/src/runtime/asm_amd64.s:1650Thanks!
Valentin