Skip to content

Conversation

@Mpdreamz
Copy link
Member

@Mpdreamz Mpdreamz commented Nov 21, 2019

When using the low levelclient and asking for a DyamicResponse while the
server is unreachable you would get a NRE

Unhandled exception. Elasticsearch.Net.UnexpectedElasticsearchClientException: Object reference not set to an instance of an object.
---> System.NullReferenceException: Object reference not set to an instance of an object.
at Elasticsearch.Net.ResponseBuilder.SetSpecialTypes[TResponse](String mimeType, Byte[] bytes, IMemoryStreamFactory memoryStreamFactory, TResponse& cs) in /home/mpdreamz/projects/elastic/net-7/src/Elasticsearch.Net/Transport/Pipeline/ResponseBuilder.cs:line 169

This hit the sockets exception as can be seen after applying this fix:

 Unsuccessful () low level call on GET: /
 # Audit trail of this API call:
  - [1] BadRequest: Node: http://localhost:9200/ Took: 00:00:00.0657238
 # OriginalException: System.Net.Http.HttpRequestException: Connection refused
  ---> System.Net.Sockets.SocketException (111): Connection refused
    at System.Net.Http.ConnectHelper.ConnectAsync(String host, Int32 port, CancellationToken cancellationToken)
    --- End of inner exception stack trace ---

When using the low levelclient and asking for a DyamicResponse while the
server is unreachable you would get a NRE

Unhandled exception. Elasticsearch.Net.UnexpectedElasticsearchClientException: Object reference not set to an instance of an object.
 ---> System.NullReferenceException: Object reference not set to an instance of an object.
   at Elasticsearch.Net.ResponseBuilder.SetSpecialTypes[TResponse](String mimeType, Byte[] bytes, IMemoryStreamFactory memoryStreamFactory, TResponse& cs) in /home/mpdreamz/projects/elastic/net-7/src/Elasticsearch.Net/Transport/Pipeline/ResponseBuilder.cs:line 169

This hit the sockets exception as can be seen after applying this fix:

 Unsuccessful () low level call on GET: /
 # Audit trail of this API call:
  - [1] BadRequest: Node: http://localhost:9200/ Took: 00:00:00.0657238
 # OriginalException: System.Net.Http.HttpRequestException: Connection refused
  ---> System.Net.Sockets.SocketException (111): Connection refused
    at System.Net.Http.ConnectHelper.ConnectAsync(String host, Int32 port, CancellationToken cancellationToken)
    --- End of inner exception stack trace ---
Copy link
Contributor

@russcam russcam left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍

@Mpdreamz Mpdreamz merged commit b8980ca into 7.x Nov 26, 2019
@Mpdreamz Mpdreamz deleted the fix/7.x/mimetype-null-check branch November 26, 2019 10:17
Mpdreamz added a commit that referenced this pull request Nov 26, 2019
When using the low levelclient and asking for a DyamicResponse while the
server is unreachable you would get a NRE

Unhandled exception. Elasticsearch.Net.UnexpectedElasticsearchClientException: Object reference not set to an instance of an object.
 ---> System.NullReferenceException: Object reference not set to an instance of an object.
   at Elasticsearch.Net.ResponseBuilder.SetSpecialTypes[TResponse](String mimeType, Byte[] bytes, IMemoryStreamFactory memoryStreamFactory, TResponse& cs) in /home/mpdreamz/projects/elastic/net-7/src/Elasticsearch.Net/Transport/Pipeline/ResponseBuilder.cs:line 169

This hit the sockets exception as can be seen after applying this fix:

 Unsuccessful () low level call on GET: /
 # Audit trail of this API call:
  - [1] BadRequest: Node: http://localhost:9200/ Took: 00:00:00.0657238
 # OriginalException: System.Net.Http.HttpRequestException: Connection refused
  ---> System.Net.Sockets.SocketException (111): Connection refused
    at System.Net.Http.ConnectHelper.ConnectAsync(String host, Int32 port, CancellationToken cancellationToken)
    --- End of inner exception stack trace ---

(cherry picked from commit b8980ca)
@Mpdreamz
Copy link
Member Author

ported to master

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

Successfully merging this pull request may close these issues.

3 participants