-
Notifications
You must be signed in to change notification settings - Fork 557
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: fix process hang when run with dagger run #5712
Conversation
8e7c809
to
a210009
Compare
Will need to do some careful testing here; the intent is to ensure things like |
That is the one I’m worry about. I didn’t have a chance to test it more and I have no linux machine. :( |
@wingyplus If you have a Mac I think it should be the same code + behavior |
Let me know if we have another cases need to test. :) |
The 10 second delay comes from the Verified with the following: package main
import (
"fmt"
"time"
)
func main() {
for {
time.Sleep(time.Second)
fmt.Println("sup")
}
}
# in another shell:
while sleep 0.1; ps auxf | grep 'go run\|/test' | grep -v grep; end Then, press You'll see the # initializing
vito 16562 0.0 0.1 737724 23688 pts/6 Sl+ 14:38 0:00 \_ dagger run go run .
# running subcmd
vito 16562 4.0 0.1 739068 28240 pts/6 Sl+ 14:38 0:00 \_ dagger run go run .
vito 16690 0.0 0.0 1090972 8992 pts/6 Dl+ 14:38 0:00 \_ go run .
# running child process
vito 16562 5.0 0.1 739324 28488 pts/6 Sl+ 14:38 0:00 \_ dagger run go run .
vito 16690 0.0 0.1 2127792 17932 pts/6 Sl+ 14:38 0:00 \_ go run .
vito 16826 0.0 0.0 710252 1844 pts/6 Sl+ 14:38 0:00 \_ /tmp/go-build3457198731/b001/exe/test
# pressing q or Ctrl+C stops `go run .` but not the child
vito 16562 4.3 0.1 739580 29096 pts/6 Sl+ 14:38 0:00 | \_ dagger run go run .
vito 16826 0.0 0.0 710508 1844 pts/6 Sl+ 14:38 0:00 \_ /tmp/go-build3457198731/b001/exe/test
# 10 seconds later, everything stops Maybe we can figure out what |
I still cannot figure out why Go is stuck on wait delay but it seems it exits with SIGTERM instead of For the gradle (https://github.com/wingyplus/dagger-kotlin) exit with code 143 due to SIGTERM instead of |
Go cmd will listen the signal SIGINT. If we change to that signal it’ll exit without waiting. But it can’t be used with Elixir because when the VM receive that signal, it’ll open a prompt for reconfirmation. T T |
@wingyplus So as far as I understand, we are blocked on the kind of signal to send to end the process? @vito @sipsma Do you have any idea in mind? This PR is important to fix a major issue with gradle, I'll also check on my own but I'm not an expert in this area haha |
This issue discover in dagger#5666, the Elixir got hang when running with `dagger run`. After debugging, the process hang somehow when using `SysProcAttr.Setpgid`. Remove it fixes the issue. Luckily, it fixes dagger#5287 that found with Gradle also. Fixes dagger#5666 Fixes dagger#5287 Signed-off-by: Thanabodee Charoenpiriyakij <wingyminus@gmail.com>
a210009
to
18427f8
Compare
I rebased the PR, I'm taking a look again at this PR |
Something went wrong after the rebase, the process still hang with See: #5287 (comment) |
I'll help looking into it tomorrow. 🙇 |
@TomChv I faced 2 problems here:
|
Really looking forward to seeing this one fixed. Writing pipelines using Elixir SDK through |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry for the radio silence on this, I've got a lot of spinning plates and this is a particular rabbit hole I've been avoiding due to the intersection of various ecosystems and platform-specific behavior. 😅
To be honest my feeling is it's Go who is in the wrong here, and that go run
should propagate signals to its child process so we don't have to jump through hoops. There are two bugs open for this upstream (golang/go#54868 and golang/go#40467) but no one has found the time to fix it yet. I suppose it's not a high priority because it doesn't normally matter in a shell, where there's already a process group for each command and Ctrl+C gets sent to the whole group.
At this point I'm OK with just leaving go run
just as broken as it was before, since this seems to be causing a harsher pain for those in other ecosystems.
Approving now before I forget, won't merge since it's the weekend, but if anyone wants to go ahead and merge it feel free.
@vito Thank you. ^^ |
This issue discover in dagger#5666, the Elixir got hang when running with `dagger run`. After debugging, the process hang somehow when using `SysProcAttr.Setpgid`. Remove it fixes the issue. Luckily, it fixes dagger#5287 that found with Gradle also. Fixes dagger#5666 Fixes dagger#5287 Signed-off-by: Thanabodee Charoenpiriyakij <wingyminus@gmail.com> Signed-off-by: Christian Schlatter <schlatter@puzzle.ch>
This issue discover in dagger#5666, the Elixir got hang when running with `dagger run`. After debugging, the process hang somehow when using `SysProcAttr.Setpgid`. Remove it fixes the issue. Luckily, it fixes dagger#5287 that found with Gradle also. Fixes dagger#5666 Fixes dagger#5287 Signed-off-by: Thanabodee Charoenpiriyakij <wingyminus@gmail.com> Signed-off-by: Christian Schlatter <schlatter@puzzle.ch>
This issue discover in dagger#5666, the Elixir got hang when running with `dagger run`. After debugging, the process hang somehow when using `SysProcAttr.Setpgid`. Remove it fixes the issue. Luckily, it fixes dagger#5287 that found with Gradle also. Fixes dagger#5666 Fixes dagger#5287 Signed-off-by: Thanabodee Charoenpiriyakij <wingyminus@gmail.com>
This issue discover in dagger#5666, the Elixir got hang when running with `dagger run`. After debugging, the process hang somehow when using `SysProcAttr.Setpgid`. Remove it fixes the issue. Luckily, it fixes dagger#5287 that found with Gradle also. Fixes dagger#5666 Fixes dagger#5287 Signed-off-by: Thanabodee Charoenpiriyakij <wingyminus@gmail.com>
This issue discover in dagger#5666, the Elixir got hang when running with `dagger run`. After debugging, the process hang somehow when using `SysProcAttr.Setpgid`. Remove it fixes the issue. Luckily, it fixes dagger#5287 that found with Gradle also. Fixes dagger#5666 Fixes dagger#5287 Signed-off-by: Thanabodee Charoenpiriyakij <wingyminus@gmail.com>
This issue discover in dagger#5666, the Elixir got hang when running with `dagger run`. After debugging, the process hang somehow when using `SysProcAttr.Setpgid`. Remove it fixes the issue. Luckily, it fixes dagger#5287 that found with Gradle also. Fixes dagger#5666 Fixes dagger#5287 Signed-off-by: Thanabodee Charoenpiriyakij <wingyminus@gmail.com>
This issue discover in #5666, the Elixir got hang when running with
dagger run
. After debugging, the process hang somehow when usingSysProcAttr.Setpgid
. Remove it fixes the issue.Luckily, it fixes #5287 that found with Gradle also.
Fixes #5666
Fixes #5287