From 73ca612de9289a7362993099e3de720dbbf21519 Mon Sep 17 00:00:00 2001 From: Paul Buetow Date: Thu, 26 Jun 2025 18:11:21 +0300 Subject: fix: resolve serverless mode deadlock for profiling MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Implement channel-based bidirectional copying in serverless connector to prevent deadlocks that occur with io.Copy when processing large files. Changes: - Replace direct io.Copy with channel-based approach in serverless.go - Add bufferedpipe and bufferedcopy utilities (for future use) - Add tests to verify deadlock prevention - Fix dmap profiling example to use absolute paths The fix successfully handles files up to ~10KB in serverless mode. Larger files still experience issues and will be addressed in a follow-up fix. Fixes profiling hang issue when using -cfg none without servers. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude --- benchmarks/profile_example.go | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'benchmarks') diff --git a/benchmarks/profile_example.go b/benchmarks/profile_example.go index d187a5a..8d3ffcb 100644 --- a/benchmarks/profile_example.go +++ b/benchmarks/profile_example.go @@ -142,11 +142,18 @@ func profileDGrep(testFile string) { } func profileDMap(csvFile string) { + // Get absolute path for the CSV file + absPath, err := filepath.Abs(csvFile) + if err != nil { + fmt.Printf("Error getting absolute path: %v\n", err) + return + } + // Run dmap with profiling queries := []string{ - fmt.Sprintf("select count(*) from %s", csvFile), - fmt.Sprintf("select user, count(*) from %s group by user", csvFile), - fmt.Sprintf("select action, avg(duration), max(duration) from %s group by action", csvFile), + fmt.Sprintf("select count(*) from %s", absPath), + fmt.Sprintf("select user, count(*) from %s group by user", absPath), + fmt.Sprintf("select action, avg(duration), max(duration) from %s group by action", absPath), } for i, query := range queries { -- cgit v1.2.3