-
-
Notifications
You must be signed in to change notification settings - Fork 602
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
golang-pie-httpserver crashes on control-C #1026
Comments
@nyh What do you mean by "signal handler in Go which does not involve a shutdown"? |
I was assuming (but it's worth verifying too...) that the Go application captures that SIGINT, and then this case involves two things: a signal handler (written in Go?) and a shutdown from that signal handler. I don't know which of the two things causes this crash. It could be a crash caused by incorrect handling of system calls (e.g., exit()) inside a signal handler. It could be a crash caused by exit() in parallel with other threads running other system calls. Or it can be other things... In short, this needs debugging.... |
Here is is the crux of the problem: it looks Golang sets up a signal handler that gets run on OSv system thread (not an app thread) which obviously has no syscall stack setup (see RSP with 0 value as a result of it). That is why we get page fault accessing a value on non-existent stack. It looks like this patch fixes it:
Now when I do ctrl-C I get this:
The 39 syscall (getpid) is easy to fix. But what about 234 (sys_tgkill) - how shall we handle it? |
Good catch. Your patch seems reasonable (if there is no "tiny syscall stack", don't switch stacks at all, hoping this thread has a big enough stack already). There's perhaps another option we can consider, which is to make the thread running the signal handler (see libc/signal.cc, sched::thread::make() call in kill()) be tagged an application thread, and get the normal syscall stack handling. About tgkill(), I don't know what this is trying to do (send a signal to a specific thread? a thread group? what is this signal supposed to do?) so I don't know what is the minimal support we can add to make sense... |
@wkozaczuk If I understand correctly, the crash originally reported here was fixed by commit 33bea60, right? If so, what are the symptoms now? |
Yeah, I was a bit hesitant to close this issue as pressing Carl-C still does not make this application exit same way it happens on Linux. Or other hand that patch fixes the exact crash. So maybe we should close this one and open new clean one about tgkill. What do you think ?
The symptom now is that every time user presses Ctrl-C he gets a message about unimplemented tgkill syscall and the app stays up.
…Sent from my iPhone
On Jul 3, 2019, at 06:00, nyh ***@***.***> wrote:
@wkozaczuk If I understand correctly, the crash originally reported here was fixed by commit 33bea60, right? If so, what are the symptoms now?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or mute the thread.
|
This is a spinoff from issue #352.
If we run
This seems to work correctly despite issue #352. At least no obvious problem.
But there is a crash if we click on control-C to kill the server:
Unfortunately gdb gives us this:
I suspect the second problem comes from bad Dwarf CFA instructions we added for the SYSCALL instruction and didn't debug thoroughly well enough.
As for the crash itself, my guess is that maybe a SYSCALL inside a signal handler doesn't work. Did we ever test that? The crashing instruction inside
syscall_entry
is:The
syscall_entry
code seems to have that tiny/large syscall stack trickery, and maybe it somehow breaks inside a signal handler? Maybe the PIE has something to do with this problem?We can try a signal handler in Go which does not involve a shutdown, to at least get shutdown issues out of the equation.
The text was updated successfully, but these errors were encountered: