Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pkg/dump/dump.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ func InstallgoroutineDumpGenerator() {
timestamp := fmt.Sprint(t.Format("20060102150405"))
log.Info("User uses kill -3 to generate goroutine dump")
dumpfileMutex.RLock()
filename := fmt.Sprintf(dumpfile, "/tmp", "go", timestamp)
filename := fmt.Sprintf(dumpfile, "/tmp/go", timestamp)
dumpfileMutex.RUnlock()
coredump(filename)
default:
Expand Down
11 changes: 1 addition & 10 deletions pkg/dump/dump_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -250,13 +250,9 @@ func formatDumpfile(prefix, timestamp string) string {
}

// Helper function to find dump files in /tmp
// Updated to match the actual filename pattern based on the code bug
func findDumpFile() (string, bool) {
// Due to the bug in the code, the actual pattern is /tmp-go.txt
// because fmt.Sprintf("%s-%s.txt", "/tmp", "go", timestamp) only uses first 2 args
patterns := []string{
"/tmp-go.txt", // What the buggy code actually creates
"/tmp/go-*.txt", // What it should create
"/tmp/go-*.txt",
}

for _, pattern := range patterns {
Expand All @@ -276,7 +272,6 @@ func findDumpFile() (string, bool) {
// Helper function to clean up dump files
func cleanupDumpFiles() {
patterns := []string{
"/tmp-go.txt", // What the buggy code actually creates
"/tmp/go-*.txt",
"/tmp/test_coredump*.txt",
"/tmp/go-test-signal.txt",
Expand All @@ -299,9 +294,5 @@ func cleanupDumpFiles() {
if strings.HasPrefix(name, "test_coredump") {
_ = os.Remove(filepath.Join("/tmp", name))
}
// Also check for the buggy pattern
if name == "tmp-go.txt" {
_ = os.Remove(filepath.Join("/tmp", name))
}
}
}