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

Avoid process crash when elasticsearch response is nil #1467

Merged

Conversation

YEXINGZHE54
Copy link
Contributor

Add nil pointer check in elasticsearch bulkprocessor's
after callback, defined inside pkg/es/config/config.go.
In some rare cases, elasticsearch request will return
error with nil response, and then nil response will
be passed into after callback, and using of nil pointer
will cause process crash.
Signed-off-by: YEXINGZHE54 429567185@qq.com

Which problem is this PR solving?

Short description of the changes

  • Add nil pointer check inside es after callback

Add nil pointer check in elasticsearch bulkprocessor's
after callback, defined inside pkg/es/config/config.go.
In some rare cases, elasticsearch request will return
error with nil response, and then nil response will
be passed into after callback, and using of nil pointer
will cause process crash.

Signed-off-by: Li Zhaoxing <lizhaoxing@4paradigm.com>
@codecov
Copy link

codecov bot commented Apr 10, 2019

Codecov Report

Merging #1467 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #1467   +/-   ##
=======================================
  Coverage   99.82%   99.82%           
=======================================
  Files         173      173           
  Lines        8179     8179           
=======================================
  Hits         8165     8165           
  Misses          7        7           
  Partials        7        7

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 64f8bce...c86aefe. Read the comment docs.

var respval interface{}
if response == nil {
failed = 0
respval = "nil"
Copy link
Member

Choose a reason for hiding this comment

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

isn't this logged by default as nil when it's nil?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yes , it will be logged as null by default; I will remove unneeded action

Signed-off-by: Li Zhaoxing <lizhaoxing@4paradigm.com>
@pavolloffay pavolloffay merged commit 48555a8 into jaegertracing:master Apr 10, 2019
stefanvassilev pushed a commit to stefanvassilev/jaeger that referenced this pull request Apr 10, 2019
* Avoid process crash when elasticsearch response is nil

Add nil pointer check in elasticsearch bulkprocessor's
after callback, defined inside pkg/es/config/config.go.
In some rare cases, elasticsearch request will return
error with nil response, and then nil response will
be passed into after callback, and using of nil pointer
will cause process crash.

Signed-off-by: Li Zhaoxing <lizhaoxing@4paradigm.com>

* Remove unnecessary wrap arround nil pointer in log
Signed-off-by: Li Zhaoxing <lizhaoxing@4paradigm.com>
stefanvassilev pushed a commit to stefanvassilev/jaeger that referenced this pull request Apr 10, 2019
* Avoid process crash when elasticsearch response is nil

Add nil pointer check in elasticsearch bulkprocessor's
after callback, defined inside pkg/es/config/config.go.
In some rare cases, elasticsearch request will return
error with nil response, and then nil response will
be passed into after callback, and using of nil pointer
will cause process crash.

Signed-off-by: Li Zhaoxing <lizhaoxing@4paradigm.com>

* Remove unnecessary wrap arround nil pointer in log
Signed-off-by: Li Zhaoxing <lizhaoxing@4paradigm.com>
Signed-off-by: stefan vassilev <stefanvassilev1@gmail.com>
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.

2 participants