Giter VIP home page Giter VIP logo

Comments (2)

xiaoxiaoHe-E avatar xiaoxiaoHe-E commented on July 19, 2024

I think we figure out the reason now:

How to reproduce the issue:

  1. tcpkill the according connection
  2. use tc to make network packages corrupt
sudo tc qdisc add dev ens192 root netem corrupt 30%

So the snappy can always report the error snappy: corrupt input in our environment.

Misleading error message corrupt input

We get this error from here. But the real reason is that snappy read from a closed connection and get an empty data next time. So cannot decode incomplete data correctly. We think it's better to report an ununexpected EOF error here.

Here is the code we modified during testing:

diff --git a/decode.go b/decode.go
index 23c6e26..208f054 100644
--- a/decode.go
+++ b/decode.go
@@ -13,6 +13,7 @@ import (
 var (
        // ErrCorrupt reports that the input is invalid.
        ErrCorrupt = errors.New("snappy: corrupt input")
+       ErrEof = errors.New("snappy: unexpected EOF")
        // ErrTooLarge reports that the uncompressed length is too large.
        ErrTooLarge = errors.New("snappy: decoded block is too large")
        // ErrUnsupported reports that the input isn't supported.
@@ -111,7 +112,7 @@ func (r *Reader) Reset(reader io.Reader) {
 func (r *Reader) readFull(p []byte, allowEOF bool) (ok bool) {
        if _, r.err = io.ReadFull(r.r, p); r.err != nil {
                if r.err == io.ErrUnexpectedEOF || (r.err == io.EOF && !allowEOF) {
-                       r.err = ErrCorrupt
+                       r.err = ErrEof
                }
                return false
        }
(END)

from snappy.

codenoid avatar codenoid commented on July 19, 2024

I got this error because the net.Conn being read multiple times concurrently

from snappy.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.