Make stdcopy.StdWriter thread safe.#20706
Conversation
fd1d239 to
c16a782
Compare
|
Not fixed :( |
|
Yes I am. It took a couple of runs but I did get it... also getting a panic from writing to the buffer (slice out of bounds). |
|
yeah, I saw the panic, but I think it's a completely different issue, caused by using a bounded buffer. |
|
@cpuguy83 can you try with this other script? Please, make sure you're importing the right package and not a precompiled one without this patch. |
|
@calavera your script has a bug, it is calling |
|
Using your branch I still get things like: Running with |
|
Thanks @dpiddy it should be fixed now. I wonder what's different in my environment, I don't get any error and I don't have |
|
I had to add this back to your script to get the debug output: logrus.StandardLogger().Level = logrus.DebugLevelCan you try that? |
|
okay, I finally got that corruption error. |
|
Cool. I think it would be good to eventually fill out the focused test script a bit to include a single net.Conn for stdout & stderr. Much like you needed to lock reads and writes on the buffer I think something similar will need to be done when using a single net.Conn. |
|
I still think this change fixes the original input header issue, fwiw 😛 |
There was a problem hiding this comment.
Should this be [stdWriterPrefixLen]byte{...} instead of [8]byte{...}?
There was a problem hiding this comment.
yeah, there are a few hardcoded values that we might be able to replace by constants.
|
Ah, looking over it now I see that stdcopy's |
|
I'm trying to change that. |
c16a782 to
987891a
Compare
|
I think that's done it! I was able to run this new test script which uses a tls.Conn for over a minute without weirdness. |
|
LGTM |
Stop using global variables as prefixes to inject the writer header. That can cause issues when two writers set the length of the buffer in the same header concurrently. Stop Writing to the internal buffer twice for each write. This could mess up with the ordering information is written. Signed-off-by: David Calavera <david.calavera@gmail.com>
987891a to
443a5c2
Compare
|
🙌 thanks for checking @dpiddy 🎉 |
|
LGTM |
|
retest this |
|
retest that |
|
please retest this |
|
test this please |
|
Great process, ⭐⭐⭐⭐⭐, would test again. |
|
Maybe sudo? :) |
|
Aaaaaaaand it's failing. Halp @SvenDowideit! |
|
test this please 🙏 |
|
test this please |
|
Test is a known failure on win2lin. |
…tdtypes Make stdcopy.StdWriter thread safe.
Stop using global variables as prefixes to inject the writer header.
That can cause issues when two writers set the length of the buffer in
the same header concurrently.
Fixes #19950 (~~maybe?~~totally 🤘)
Signed-off-by: David Calavera david.calavera@gmail.com