{"record":{"id":"a5649dab116054c1","repo":"lionsoul2014/ip2region","slug":"v4-searcher-pool-already-closed","errorCode":null,"errorMessage":"v4 searcher pool already closed","messagePattern":"v4 searcher pool already closed","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"binding/golang/service/ip2region.go","lineNumber":157,"sourceCode":"\t\treturn ip2r.v6Search(ipBytes)\n\t} else {\n\t\treturn \"\", fmt.Errorf(\"invalid byte ip address with len=%d\", l)\n\t}\n}\n\nfunc (ip2r *Ip2Region) v4Search(ipBytes []byte) (string, error) {\n\tif ip2r.v4InMemSearcher != nil {\n\t\treturn ip2r.v4InMemSearcher.Search(ipBytes)\n\t}\n\n\t// v4 search is disabled\n\tif ip2r.v4Pool == nil {\n\t\treturn \"\", nil\n\t}\n\n\tv4Searcher := ip2r.v4Pool.BorrowSearcher()\n\tif v4Searcher == nil {\n\t\treturn \"\", fmt.Errorf(\"v4 searcher pool already closed\")\n\t}\n\tdefer ip2r.v4Pool.ReturnSearcher(v4Searcher)\n\treturn v4Searcher.Search(ipBytes)\n}\n\nfunc (ip2r *Ip2Region) v6Search(ipBytes []byte) (string, error) {\n\tif ip2r.v6InMemSearcher != nil {\n\t\treturn ip2r.v6InMemSearcher.Search(ipBytes)\n\t}\n\n\t// v6 search is disabled\n\tif ip2r.v6Pool == nil {\n\t\treturn \"\", nil\n\t}\n\n\tv6Searcher := ip2r.v6Pool.BorrowSearcher()\n\tif v6Searcher == nil {\n\t\treturn \"\", fmt.Errorf(\"v6 searcher pool already closed\")","sourceCodeStart":139,"sourceCodeEnd":175,"githubUrl":"https://github.com/lionsoul2014/ip2region/blob/c1a1fc7d5941760db3f8431dc05c48cf7f0e30a1/binding/golang/service/ip2region.go#L139-L175","documentation":"Go service lifecycle error: v4Search tried to borrow a searcher from the v4 pool but BorrowSearcher returned nil, which happens after the pool has been closed (Close drains and shuts down the channel). Searching on a closed service is rejected by this sentinel.","triggerScenarios":"Thrown at binding/golang/service/ip2region.go:157 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Do not call Search after Ip2Region.Close; create a new service instead","Guard concurrent shutdown vs. in-flight searches with a WaitGroup or context","Return a typed sentinel error so callers can distinguish closed-pool from real failures"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"c1a1fc7d5941760db3f8431dc05c48cf7f0e30a1","analyzedAt":"2026-09-02T16:58:39.988Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-09T21:17:11.164Z"}