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

fix: 'invalid memory address or nil pointer dereference' in response logger #872

Merged
merged 1 commit into from
Sep 26, 2024

Conversation

matlockx
Copy link
Contributor

@matlockx matlockx commented Sep 26, 2024

An error like ‘dial tcp 10.66.0.229:80: connect: connection refused’ when request and response logging is activated causes an ‘invalid memory address or nil pointer dereference’. This is due to changes from version 2.14 to 2.15, where the logging call was moved up in the execute function. In version 2.14, the function returned early on this error, so the logging call was not made. Now, the logging call is made, and res.RawResponseProto is used without a nil check on RawResponse.

The fix is simple: use res.Proto(), which performs the nil check.

fixes #873

Copy link
Member

@jeevatkm jeevatkm left a comment

Choose a reason for hiding this comment

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

@matlockx Thanks for the PR.

Copy link

codecov bot commented Sep 26, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 96.15%. Comparing base (231ca0e) to head (b71c78a).
Report is 1 commits behind head on v2.

Additional details and impacted files
@@           Coverage Diff           @@
##               v2     #872   +/-   ##
=======================================
  Coverage   96.15%   96.15%           
=======================================
  Files          14       14           
  Lines        1821     1821           
=======================================
  Hits         1751     1751           
  Misses         46       46           
  Partials       24       24           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@jeevatkm jeevatkm merged commit e11af35 into go-resty:v2 Sep 26, 2024
5 checks passed
@jeevatkm
Copy link
Member

@matlockx I was able to make the release prep work on the browser. Now, v2.15.3 has been released.

renovate bot referenced this pull request in Michsior14/transmission-gluetun-port-update Sep 26, 2024
This PR contains the following updates:

| Package | Change | Age | Adoption | Passing | Confidence |
|---|---|---|---|---|---|
|
[github.com/go-resty/resty/v2](https://redirect.github.com/go-resty/resty)
| `v2.15.2` -> `v2.15.3` |
[![age](https://developer.mend.io/api/mc/badges/age/go/github.com%2fgo-resty%2fresty%2fv2/v2.15.3?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://developer.mend.io/api/mc/badges/adoption/go/github.com%2fgo-resty%2fresty%2fv2/v2.15.3?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://developer.mend.io/api/mc/badges/compatibility/go/github.com%2fgo-resty%2fresty%2fv2/v2.15.2/v2.15.3?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://developer.mend.io/api/mc/badges/confidence/go/github.com%2fgo-resty%2fresty%2fv2/v2.15.2/v2.15.3?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|

---

### Release Notes

<details>
<summary>go-resty/resty (github.com/go-resty/resty/v2)</summary>

###
[`v2.15.3`](https://redirect.github.com/go-resty/resty/releases/tag/v2.15.3)

[Compare
Source](https://redirect.github.com/go-resty/resty/compare/v2.15.2...v2.15.3)

### Release Notes

#### Bug Fixes

- fix: 'invalid memory address or nil pointer dereference' in response
logger by [@&#8203;matlockx](https://redirect.github.com/matlockx) in
[https://github.com/go-resty/resty/pull/872](https://redirect.github.com/go-resty/resty/pull/872)

#### Documentation

- For release v2.15.3 by
[@&#8203;jeevatkm](https://redirect.github.com/jeevatkm) in
[https://github.com/go-resty/resty/pull/874](https://redirect.github.com/go-resty/resty/pull/874)

#### New Contributors

- [@&#8203;matlockx](https://redirect.github.com/matlockx) made their
first contribution in
[https://github.com/go-resty/resty/pull/872](https://redirect.github.com/go-resty/resty/pull/872)

**Full Changelog**:
go-resty/resty@v2.15.2...v2.15.3

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined),
Automerge - At any time (no schedule defined).

🚦 **Automerge**: Enabled.

♻ **Rebasing**: Whenever PR is behind base branch, or you tick the
rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update
again.

---

- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check
this box

---

This PR was generated by [Mend Renovate](https://mend.io/renovate/).
View the [repository job
log](https://developer.mend.io/github/Michsior14/transmission-gluetun-port-update).

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzOC45Ny4wIiwidXBkYXRlZEluVmVyIjoiMzguOTcuMCIsInRhcmdldEJyYW5jaCI6Im1haW4iLCJsYWJlbHMiOlsiZGVwZW5kZW5jaWVzIl19-->

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

Successfully merging this pull request may close these issues.

panic when URL address is down
2 participants