{"record":{"id":"c7c8e1954ddab82e","repo":"shadow1ng/fscan","slug":"s-minidump-timeout","errorCode":null,"errorMessage":"%s [minidump_timeout]","messagePattern":"(.+?) \\[minidump_timeout\\]","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"plugins/local/minidump.go","lineNumber":420,"sourceCode":"\tif handle == 0 {\n\t\treturn 0, fmt.Errorf(\"%s\", i18n.GetText(\"minidump_current_process_failed\"))\n\t}\n\treturn syscall.Handle(handle), nil\n}\n\n// dumpProcessWithTimeout 带超时的转储进程内存\nfunc (pm *ProcessManager) dumpProcessWithTimeout(ctx context.Context, pid uint32, outputPath string) error {\n\tresultChan := make(chan error, 1)\n\n\tgo func() {\n\t\tresultChan <- pm.dumpProcess(pid, outputPath)\n\t}()\n\n\tselect {\n\tcase err := <-resultChan:\n\t\treturn err\n\tcase <-ctx.Done():\n\t\treturn fmt.Errorf(\"%s\", i18n.GetText(\"minidump_timeout\"))\n\t}\n}\n\n// dumpProcess 转储进程内存\nfunc (pm *ProcessManager) dumpProcess(pid uint32, outputPath string) error {\n\tprocessHandle, err := pm.openProcess(pid)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer pm.closeHandle(processHandle)\n\n\tfileHandle, err := pm.createDumpFile(outputPath)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer pm.closeHandle(fileHandle)\n\n\tminiDumpWriteDump, err := pm.dbghelp.FindProc(\"MiniDumpWriteDump\")","sourceCodeStart":402,"sourceCodeEnd":438,"githubUrl":"https://github.com/shadow1ng/fscan/blob/95cc12e753bf43de7004e5aef42a9ffba3934303/plugins/local/minidump.go#L402-L438","documentation":"Thrown by ProcessManager.dumpProcessWithTimeout when the context is cancelled (ctx.Done) before the dump goroutine posts a result on resultChan. The library enforces a timeout because MiniDumpWriteDump on large or hung processes can block indefinitely. It means the dump did not complete within the caller-supplied deadline.","triggerScenarios":"tryDirectDump calls dumpProcessWithTimeout with a ctx whose deadline expires while MiniDumpWriteDump is still writing the dump file — typically for very large process memory footprints, slow/late disk, or a suspended/hung target.","commonSituations":"Dumping multi-gigabyte processes (databases, browsers) with a too-short timeout; target process suspended or stuck in kernel; dumping to a network share or slow HDD.","solutions":["Increase the context timeout proportionally to the target process's committed memory size.","Write the dump to fast local storage instead of a network share or slow disk.","Check the target process state (hung/suspended) and retry once it is responsive; avoid dumping while the process is being debugged or suspended."],"exampleFix":"// before\nctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)\n// after — scale timeout to the dump size\nctx, cancel := context.WithTimeout(context.Background(), 120*time.Second)","handlingStrategy":"retry","validationCode":"// size the timeout to the target's memory footprint before dumping\nctx, cancel := context.WithTimeout(context.Background(), 120*time.Second)\ndefer cancel()","typeGuard":null,"tryCatchPattern":"err := pm.dumpProcessWithTimeout(ctx, pid, path)\nif err != nil && strings.Contains(err.Error(), \"minidump_timeout\") {\n    // retry once with a larger deadline and local output path\n}","preventionTips":["Set timeouts generously for large processes (GBs of committed memory).","Dump to fast local disk, never network shares.","Do not dump suspended or hung processes."],"tags":["timeout","minidump","context"],"backgroundTag":"request-timeout","analyzedSha":"95cc12e753bf43de7004e5aef42a9ffba3934303","analyzedAt":"2026-09-06T17:07:30.094Z","contentChangedAt":"2026-09-06T17:07:30.094Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}