You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@iceberg.apache.org by "laskoviymishka (via GitHub)" <gi...@apache.org> on 2026/03/25 23:10:57 UTC

[PR] fix(table): deadlock in MapExec when workers error [iceberg-go]

laskoviymishka opened a new pull request, #810:
URL: https://github.com/apache/iceberg-go/pull/810

   Use errgroup.WithContext so the first worker error cancels a derived context. Add select on ctx.Done() for both the feeder (ch <- v) and worker (out <- result) sends, allowing them to unblock when the context is cancelled instead of blocking forever.
   
   Closes #796


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org


Re: [PR] fix(table): deadlock in MapExec when workers error [iceberg-go]

Posted by "laskoviymishka (via GitHub)" <gi...@apache.org>.
laskoviymishka commented on code in PR #810:
URL: https://github.com/apache/iceberg-go/pull/810#discussion_r3002164417


##########
table/internal/utils.go:
##########
@@ -525,7 +526,7 @@ func MapExec[T, S any](nWorkers int, slice iter.Seq[T], fn func(T) (S, error)) i
 		nWorkers = runtime.GOMAXPROCS(0)
 	}
 
-	var g errgroup.Group
+	g, ctx := errgroup.WithContext(context.Background())

Review Comment:
   a bit bigger refacotr, but i can do that



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org


Re: [PR] fix(table): deadlock in MapExec when workers error [iceberg-go]

Posted by "zeroshade (via GitHub)" <gi...@apache.org>.
zeroshade commented on code in PR #810:
URL: https://github.com/apache/iceberg-go/pull/810#discussion_r3001987031


##########
table/internal/utils.go:
##########
@@ -547,7 +552,14 @@ func MapExec[T, S any](nWorkers int, slice iter.Seq[T], fn func(T) (S, error)) i
 	go func() {
 		defer close(out)
 		for v := range slice {
-			ch <- v
+			select {
+			case ch <- v:
+			case <-ctx.Done():
+				close(ch)
+				err = g.Wait()

Review Comment:
   should we just add these as part of the top defer? i.e.
   
   ```go
   defer func() {
       close(ch)
       close(out)
       err = g.Wait()
   }()
   ```



##########
table/internal/utils.go:
##########
@@ -525,7 +526,7 @@ func MapExec[T, S any](nWorkers int, slice iter.Seq[T], fn func(T) (S, error)) i
 		nWorkers = runtime.GOMAXPROCS(0)
 	}
 
-	var g errgroup.Group
+	g, ctx := errgroup.WithContext(context.Background())

Review Comment:
   instead of using `context.Background()` should `MapExec` itself take a context?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org


Re: [PR] fix(table): deadlock in MapExec when workers error [iceberg-go]

Posted by "laskoviymishka (via GitHub)" <gi...@apache.org>.
laskoviymishka commented on code in PR #810:
URL: https://github.com/apache/iceberg-go/pull/810#discussion_r3002173595


##########
table/internal/utils.go:
##########
@@ -547,7 +552,14 @@ func MapExec[T, S any](nWorkers int, slice iter.Seq[T], fn func(T) (S, error)) i
 	go func() {
 		defer close(out)
 		for v := range slice {
-			ch <- v
+			select {
+			case ch <- v:
+			case <-ctx.Done():
+				close(ch)
+				err = g.Wait()

Review Comment:
   yeah, that would be nicer



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org


Re: [PR] fix(table): deadlock in MapExec when workers error [iceberg-go]

Posted by "zeroshade (via GitHub)" <gi...@apache.org>.
zeroshade merged PR #810:
URL: https://github.com/apache/iceberg-go/pull/810


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org