Closed liggitt closed 1 year ago
For the next time we run into something like this: It's actually slightly more complex than that in the general case but not here since we always set os.Stdout and os.Stderr
This should use a mutex wrapped buffer.
Actually, I will just do this before PRing myself to emeritus, since this is such a trivial but important fix ...
https://github.com/kubernetes-sigs/kubetest2/blob/master/pkg/process/junitexec.go#L59-L61 uses the same bytes.Buffer in two output streams, which means it can be written to concurrently. That is not threadsafe.
This panics randomly with changes made to bytes.Buffer growing in go1.19.
The code should be changes to make use of the buffer threadsafe or use two separate buffers