Skip to content
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

Improve stacktrace to fix tech debts #1132

Merged
merged 1 commit into from
Oct 30, 2023
Merged
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
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
/.atom-build.yml
/.project
/.vagrant
.vscode/
cmd/s2i/debug
*~

Expand Down
10 changes: 9 additions & 1 deletion pkg/docker/docker.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package docker

import (
"archive/tar"
"bufio"
"bytes"
"encoding/base64"
"encoding/json"
Expand Down Expand Up @@ -995,7 +996,14 @@ func (d *stiDocker) RunContainer(opts RunContainerOptions) error {
if signal == syscall.SIGQUIT {
buf := make([]byte, 1<<16)
runtime.Stack(buf, true)
fmt.Printf("%s", buf)
f, err := os.Create("/var/log/s2i_docker_stack_trace.log")
if err != nil {
return
}
defer f.Close()
w := bufio.NewWriter(f)
w.Write(buf)
w.Flush()
}
os.Exit(2)
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/scripts/download.go
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ type FileURLReader struct{}
func (*FileURLReader) Read(url *url.URL) (io.ReadCloser, error) {
// for some reason url.Host may contain information about the ./ or ../ when
// specifying relative path, thus using that value as well
return os.Open(filepath.Join(url.Host, url.Path))
return os.Open(filepath.Clean(filepath.Join(url.Host, url.Path)))
}

// ImageReader just returns information the URL is from inside the image
Expand Down