{"record":{"id":"ba4ba50946073278","repo":"juicedata/juicefs","slug":"errfunctimeout","errorCode":"ErrFuncTimeout","errorMessage":"function timeout","messagePattern":"function timeout","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/utils/errors.go","lineNumber":26,"sourceCode":" *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage utils\n\nimport (\n\t\"errors\"\n\t\"syscall\"\n)\n\nvar (\n\tErrNotSUP      = errors.New(\"not supported\")\n\tErrFuncTimeout = errors.New(\"function timeout\")\n\tErrSkipped     = errors.New(\"skipped\")\n\tErrExtlink     = syscall.Errno(1000)\n)\n","sourceCodeStart":8,"sourceCodeEnd":30,"githubUrl":"https://github.com/juicedata/juicefs/blob/c9a67b23e8e08ec23ec331aa6f1675e2319e921c/pkg/utils/errors.go#L8-L30","documentation":"utils.ErrFuncTimeout signals that a wrapped function exceeded its deadline. It is treated as a first-class cancellation: chunk reads propagate it, and the disk cache treats it like an I/O failure, marking the cache store unavailable.","triggerScenarios":"A cached_store read or disk-cache operation wrapped in utils.WithTimeout exceeds its deadline; the timeout error then flows back through Read and cache handling.","commonSituations":"Slow or failing cache disk causing operations to hit the timeout; overloaded object storage increasing latency past configured limits.","solutions":["Increase the relevant timeout configuration or reduce load","Check the cache disk health (smartctl/dmesg) and replace if it is failing — the cache is put into a degraded state on this error","Investigate slow upstream storage/network causing the deadline breach","Retry; transient slowness may clear after the cache recovers"],"exampleFix":"// before\nresult, err := utils.WithTimeout(func(ctx context.Context) (...) { ... }, timeout)\n// after\nresult, err := utils.WithTimeout(func(ctx context.Context) (...) { ... }, timeout*2) // raise timeout for slow disks","handlingStrategy":"retry","validationCode":"// check cache disk writable and has space before heavy reads\nif st, err := os.Stat(cacheDir); err != nil || !st.IsDir() {\n\tlogger.Warnf(\"cache dir unavailable: %v\", err)\n}","typeGuard":"func isTimeout(err error) bool { return errors.Is(err, utils.ErrFuncTimeout) }","tryCatchPattern":"n, err := cs.Read(ctx, key, p, off)\nif errors.Is(err, utils.ErrFuncTimeout) {\n\t// propagate or retry with backoff after cache recovers\n\treturn 0, err\n}","preventionTips":["Monitor cache disk health and capacity (onIOErr marks store unavailable)","Tune timeout settings to realistic storage latency","Alert on repeated ErrFuncTimeout — it usually indicates failing hardware or overloaded storage"],"tags":["timeout","cache","chunk"],"backgroundTag":"request-timeout","analyzedSha":"c9a67b23e8e08ec23ec331aa6f1675e2319e921c","analyzedAt":"2026-09-06T17:55:48.476Z","contentChangedAt":"2026-09-06T17:55:48.476Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}