• Joe Tsai's avatar
    io: fix MultiReader panic on nil reader. · 29125441
    Joe Tsai authored
    The combination of two prior CLs can cause panics:
    * CL/17873: make chained multiReader Read more efficient
    * CL/28533: make MultiReader nil exhausted Readers for earlier GC
    
    The first CL allows MultiReader to "inherit" another MultiReader's list of Readers
    for efficiency reasons. This is problematic when combined with the
    later CL since that can set prior Readers in that list to nil for GC reasons.
    This causes panics when two MultiReaders are used together (even synchronously).
    
    To fix this, rather than setting consumed Readers as nil, we set them with
    a special eofReader that always returns EOF.
    
    Fixes #18232
    
    Change-Id: I2a9357ab217e3d54d38ea9022d18e4d14f4182d3
    Reviewed-on: https://go-review.googlesource.com/34140Reviewed-by: 's avatarBrad Fitzpatrick <bradfitz@golang.org>
    Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
    TryBot-Result: Gobot Gobot <gobot@golang.org>
    29125441
Name
Last commit
Last update
.github Loading commit data...
api Loading commit data...
doc Loading commit data...
lib/time Loading commit data...
misc Loading commit data...
src Loading commit data...
test Loading commit data...
.gitattributes Loading commit data...
.gitignore Loading commit data...
AUTHORS Loading commit data...
CONTRIBUTING.md Loading commit data...
CONTRIBUTORS Loading commit data...
LICENSE Loading commit data...
PATENTS Loading commit data...
README.md Loading commit data...
favicon.ico Loading commit data...
robots.txt Loading commit data...