Skip to content
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

"invalid internal transport message format" error message #12355

Closed
markwalkom opened this issue Jul 21, 2015 · 4 comments
Closed

"invalid internal transport message format" error message #12355

markwalkom opened this issue Jul 21, 2015 · 4 comments

Comments

@markwalkom
Copy link
Contributor

It'd be nice if we made this error a little more human readable -
java.io.StreamCorruptedException: invalid internal transport message format, got (47,45,54,20)

From what I understand it's due to someone talking to Elasticsearch via HTTP but to the binary API port - eg curl localhost:9300 - so we should really just say something along those lines.

@bleskes
Copy link
Contributor

bleskes commented Jul 21, 2015

Here is where the exception comes from. As you can see we already have a best effort attempt to detect and report http traffic

 if (buffer.getByte(readerIndex) != 'E' || buffer.getByte(readerIndex + 1) != 'S') {
            // special handling for what is probably HTTP
            if (bufferStartsWith(buffer, readerIndex, "GET ") ||
                bufferStartsWith(buffer, readerIndex, "POST ") ||
                bufferStartsWith(buffer, readerIndex, "PUT ") ||
                bufferStartsWith(buffer, readerIndex, "HEAD ") ||
                bufferStartsWith(buffer, readerIndex, "DELETE ") ||
                bufferStartsWith(buffer, readerIndex, "OPTIONS ") ||
                bufferStartsWith(buffer, readerIndex, "PATCH ") ||
                bufferStartsWith(buffer, readerIndex, "TRACE ")) {

                throw new HttpOnTransportException("This is not a HTTP port");
            }

            // we have 6 readable bytes, show 4 (should be enough)
            throw new StreamCorruptedException("invalid internal transport message format, got ("
                    + Integer.toHexString(buffer.getByte(readerIndex) & 0xFF) + ","
                    + Integer.toHexString(buffer.getByte(readerIndex + 1) & 0xFF) + ","
                    + Integer.toHexString(buffer.getByte(readerIndex + 2) & 0xFF) + ","
                    + Integer.toHexString(buffer.getByte(readerIndex + 3) & 0xFF) + ")");
        }

This works for me:

$ curl http://127.0.0.1:9300
This is not a HTTP port

Can you dig some more?

@markwalkom
Copy link
Contributor Author

This error is from 1.4.5, I can see 1.7.0 reports this response.
When did we add this?

On 21 July 2015 at 17:08, Boaz Leskes [email protected] wrote:

Here is where the exception comes from. As you can see we already have a
best effort attempt to detect and report http traffic

if (buffer.getByte(readerIndex) != 'E' || buffer.getByte(readerIndex + 1) != 'S') {
// special handling for what is probably HTTP
if (bufferStartsWith(buffer, readerIndex, "GET ") ||
bufferStartsWith(buffer, readerIndex, "POST ") ||
bufferStartsWith(buffer, readerIndex, "PUT ") ||
bufferStartsWith(buffer, readerIndex, "HEAD ") ||
bufferStartsWith(buffer, readerIndex, "DELETE ") ||
bufferStartsWith(buffer, readerIndex, "OPTIONS ") ||
bufferStartsWith(buffer, readerIndex, "PATCH ") ||
bufferStartsWith(buffer, readerIndex, "TRACE ")) {

            throw new HttpOnTransportException("This is not a HTTP port");
        }

        // we have 6 readable bytes, show 4 (should be enough)
        throw new StreamCorruptedException("invalid internal transport message format, got ("
                + Integer.toHexString(buffer.getByte(readerIndex) & 0xFF) + ","
                + Integer.toHexString(buffer.getByte(readerIndex + 1) & 0xFF) + ","
                + Integer.toHexString(buffer.getByte(readerIndex + 2) & 0xFF) + ","
                + Integer.toHexString(buffer.getByte(readerIndex + 3) & 0xFF) + ")");
    }

This works for me:

$ curl http://127.0.0.1:9300
This is not a HTTP port

Can you dig some more?


Reply to this email directly or view it on GitHub
#12355 (comment)
.

@bleskes
Copy link
Contributor

bleskes commented Jul 21, 2015

issue demystified : #10108

Closing as a duplicate then. I think it covers it well enough?

@bleskes bleskes closed this as completed Jul 21, 2015
@markwalkom
Copy link
Contributor Author

Thanks mate.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants