-
Notifications
You must be signed in to change notification settings - Fork 789
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
Stabilize & simplify build log stream #7422
Comments
mgoltzsche
added a commit
to mgoltzsche/jx
that referenced
this issue
Jul 7, 2020
improvements: * let the caller handle streamed log lines within its own goroutine. * stream build log to long-term storage (instead of loading it into memory first). Closes jenkins-x#7422 Signed-off-by: Max Goltzsche <mgoltzsche@cloudbees.com>
mgoltzsche
added a commit
to mgoltzsche/jx
that referenced
this issue
Jul 7, 2020
improvements: * let the caller handle streamed log lines within its own goroutine. * stream build log to long-term storage (instead of loading it into memory first). Closes jenkins-x#7422 Signed-off-by: Max Goltzsche <mgoltzsche@cloudbees.com>
mgoltzsche
added a commit
to mgoltzsche/jx
that referenced
this issue
Jul 8, 2020
improvements: * let the caller handle streamed log lines within its own goroutine. * stream build log to long-term storage (instead of loading it into memory first). Closes jenkins-x#7422 Signed-off-by: Max Goltzsche <mgoltzsche@cloudbees.com>
mgoltzsche
added a commit
to mgoltzsche/jx
that referenced
this issue
Jul 8, 2020
improvements: * let the caller handle streamed log lines within its own goroutine. * stream build log to long-term storage (instead of loading it into memory first). Closes jenkins-x#7422 Signed-off-by: Max Goltzsche <mgoltzsche@cloudbees.com>
mgoltzsche
added a commit
to mgoltzsche/jx
that referenced
this issue
Jul 8, 2020
improvements: * let the caller handle streamed log lines within its own goroutine. * stream build log to long-term storage (instead of loading it into memory first). Closes jenkins-x#7422 Signed-off-by: Max Goltzsche <mgoltzsche@cloudbees.com>
mgoltzsche
added a commit
to mgoltzsche/jx
that referenced
this issue
Jul 8, 2020
improvements: * let the caller handle streamed log lines within its own goroutine. * stream build log to long-term storage (instead of loading it into memory first). * change bucket provider interface to stream data. Closes jenkins-x#7422 Signed-off-by: Max Goltzsche <mgoltzsche@cloudbees.com>
mgoltzsche
added a commit
to mgoltzsche/jx
that referenced
this issue
Jul 9, 2020
improvements: * let the caller handle streamed log lines within its own goroutine. * stream build log to long-term storage (instead of loading it into memory first). * change bucket provider interface to stream data. Closes jenkins-x#7422 Signed-off-by: Max Goltzsche <mgoltzsche@cloudbees.com>
mgoltzsche
added a commit
to mgoltzsche/jx
that referenced
this issue
Jul 9, 2020
improvements: * let the caller handle streamed log lines within its own goroutine. * stream build log to long-term storage (instead of loading it into memory first). * change bucket provider interface to stream data. Closes jenkins-x#7422 Signed-off-by: Max Goltzsche <mgoltzsche@cloudbees.com>
mgoltzsche
added a commit
to mgoltzsche/jx
that referenced
this issue
Jul 9, 2020
improvements: * let the caller handle streamed log lines within its own goroutine. * stream build log to long-term storage (instead of loading it into memory first). * change bucket provider interface to stream data. Closes jenkins-x#7422 Signed-off-by: Max Goltzsche <mgoltzsche@cloudbees.com>
mgoltzsche
added a commit
to mgoltzsche/jx
that referenced
this issue
Jul 9, 2020
improvements: * let build log methods return channel to let the caller handle streamed log lines within its own goroutine. * stream build log to long-term storage. * change storage provider interface to stream data. Closes jenkins-x#7422 Signed-off-by: Max Goltzsche <mgoltzsche@cloudbees.com>
I removed two problems from the list above because this is not required now and should be considered in a build log stream redesign (see #6759):
Therefore the interface looks as follows now (error handling changed + log destination handled in caller's goroutine):
|
jenkins-x-bot
pushed a commit
that referenced
this issue
Jul 9, 2020
improvements: * let build log methods return channel to let the caller handle streamed log lines within its own goroutine. * stream build log to long-term storage. * change storage provider interface to stream data. Closes #7422 Signed-off-by: Max Goltzsche <mgoltzsche@cloudbees.com>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Summary
I propose to refactor the
pkg/logs
package because its current interface and implementation comes with some problems:LogWriter
interface with methods that accept two channels (one for the log stream and one for an error). This is cumbersome and error-prone for callers to implement (can cause concurrency issues + deadlocks potentially).LogWriter
methods are called from within another goroutine (in case of JXUI this seems to be the reason for a randomly occurring panic when flushing the log stream - currently simply recovered to avoid a complete crash)LogWriter
interface mixes multiple concerns: a) writing logs, b) obfuscating secrets in logs.Steps to reproduce the behavior
Look at
jx get build logs
cmd impl (caller): https://github.com/jenkins-x/jx/blob/v2.1.95/pkg/cmd/get/get_build_logs.go#L189The JXUI log stream impl is similar to the latter and does not crash in such a case simply because the panic gets recovered now.
Expected behavior
The logging interface should be simple, reliable and not involve the caller in the selection of the underlying log storage which depends on jx' internal state and should not be the caller's concern.
Therefore I propose to simplify the logging interface as follows:
(Secret obfuscation could be implemented separately and/or as a decorator.)
The new interface could be used as follows:
Though this is a breaking change which needs to be aligned with all callers/users of the package.
Actual behavior
Randomly occuring concurrency issues like a panic when flushing a shared writer within a
LogWriter
impl and potential deadlocks, lack of separation of concerns, redundant and cumbersome code in callers - for instance https://github.com/jenkins-x/jx/blob/v2.1.95/pkg/cmd/get/get_build_logs.go#L189Jx version
The output of
jx version
is:Diagnostic information
The output of
jx diagnose version
is:Kubernetes cluster
v1.14.10-gke.36
Though when we reproduced the panic in JXUI previously it was reliably/often happening on an EKS cluster using the same jx version.
Kubectl version
The output of
kubectl version --client
is:Operating system / Environment
Ubuntu 18.04
The text was updated successfully, but these errors were encountered: