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

Remove hideTempErr to allow downstream users to check for errors like net.ErrClosed #894

Merged
merged 2 commits into from
Feb 15, 2024

Conversation

UnAfraid
Copy link
Contributor

@UnAfraid UnAfraid commented Feb 7, 2024

What type of PR is this? (check all applicable)

  • Refactor
  • Feature
  • Bug Fix
  • Optimization
  • Documentation Update
  • Go Version Update
  • Dependency Update

Description

Since this change https://github.com/gorilla/websocket/pull/840/files#diff-4f427d2b022907c552328e63f137561f6de92396d7a6e8f6c2ea1bcf0db52654L190-R197 we can no longer determinate if the errors coming from ReadMessage() are net.ErrClosed for example
Hardcoding the error message is not great option because it may vary from OS to OS and system locale

Related Tickets & Documents

Added/updated tests?

  • Yes
  • No, and this is why: please replace this line with details on why tests
    have not been included
  • I need help with writing tests

Run verifications and test

  • make verify is passing
  • make test is passing

@StevenACoffman
Copy link

@AlexVulaj This would fix several issues with the 1.5.1 release. Please take a look. Thanks!

@UnAfraid UnAfraid changed the title Remove hideTempErr to allow external users to check for errors like net.ErrClosed Remove hideTempErr to allow downstream users to check for errors like net.ErrClosed Feb 12, 2024
jaitaiwan
jaitaiwan previously approved these changes Feb 13, 2024
Copy link
Member

@jaitaiwan jaitaiwan left a comment

Choose a reason for hiding this comment

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

LGTM, one small nit. I am a little cautious about this change because I haven't looked at the context of c.readErr. If other Members are happy then I don't see any structural issues with this.

conn_test.go Outdated Show resolved Hide resolved
@AlexVulaj
Copy link
Member

I'm happy to merge this @jaitaiwan , feel free to make a final call on the "t.Parallel" comment but I don't have any strong feelings.

@UnAfraid
Copy link
Contributor Author

Please let me know if t.Parallel() should be used and i can bring it back, i don't mind either way.

Copy link
Member

@jaitaiwan jaitaiwan left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link

codecov bot commented Feb 15, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (d293aa5) 71.30% compared to head (52188df) 71.38%.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #894      +/-   ##
==========================================
+ Coverage   71.30%   71.38%   +0.08%     
==========================================
  Files          11       11              
  Lines        1589     1583       -6     
==========================================
- Hits         1133     1130       -3     
+ Misses        349      347       -2     
+ Partials      107      106       -1     

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

@StevenACoffman
Copy link

StevenACoffman commented Feb 15, 2024

Security and lint failures are unrelated to this change.

@jaitaiwan jaitaiwan merged commit 695e909 into gorilla:main Feb 15, 2024
9 of 12 checks passed
@jaitaiwan
Copy link
Member

Agreed. Thanks for the contribution!

@UnAfraid UnAfraid deleted the bugfix/net-errors branch February 15, 2024 14:12
algitbot pushed a commit to alpinelinux/build-server-status that referenced this pull request Sep 15, 2024
This MR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
| [github.com/gorilla/websocket](https://github.com/gorilla/websocket) | require | patch | `v1.5.1` -> `v1.5.3` |

---

### Release Notes

<details>
<summary>gorilla/websocket (github.com/gorilla/websocket)</summary>

### [`v1.5.3`](https://github.com/gorilla/websocket/releases/tag/v1.5.3)

[Compare Source](gorilla/websocket@v1.5.2...v1.5.3)

#### Important change

This reverts the websockets package back to gorilla/websocket@931041c

#### What's Changed

-   Fixes subprotocol selection (aling with rfc6455) by [@&#8203;KSDaemon](https://github.com/KSDaemon) in gorilla/websocket#823
-   Update README.md, replace master to main by [@&#8203;mstmdev](https://github.com/mstmdev) in gorilla/websocket#862
-   Use status code constant by [@&#8203;mstmdev](https://github.com/mstmdev) in gorilla/websocket#864
-   conn.go: default close handler should not return ErrCloseSent. by [@&#8203;pnx](https://github.com/pnx) in gorilla/websocket#865
-   fix: replace ioutil.readfile with os.readfile by [@&#8203;rfyiamcool](https://github.com/rfyiamcool) in gorilla/websocket#868
-   fix: add comment for the readBufferSize and writeBufferSize by [@&#8203;rfyiamcool](https://github.com/rfyiamcool) in gorilla/websocket#869
-   Remove noisy printf in NextReader() and beginMessage() by [@&#8203;bcreane](https://github.com/bcreane) in gorilla/websocket#878
-   docs(echoreadall): fix function echoReadAll comment by [@&#8203;XdpCs](https://github.com/XdpCs) in gorilla/websocket#881
-   make tests parallel by [@&#8203;ninedraft](https://github.com/ninedraft) in gorilla/websocket#872
-   Upgrader.Upgrade: use http.ResposnseController by [@&#8203;ninedraft](https://github.com/ninedraft) in gorilla/websocket#871
-   Do not handle network error in `SetCloseHandler()` by [@&#8203;nak3](https://github.com/nak3) in gorilla/websocket#863
-   perf: reduce timer in write_control by [@&#8203;rfyiamcool](https://github.com/rfyiamcool) in gorilla/websocket#879
-   fix: lint example code by [@&#8203;rfyiamcool](https://github.com/rfyiamcool) in gorilla/websocket#890
-   feat: format message type by [@&#8203;rfyiamcool](https://github.com/rfyiamcool) in gorilla/websocket#889
-   Remove hideTempErr to allow downstream users to check for errors like net.ErrClosed by [@&#8203;UnAfraid](https://github.com/UnAfraid) in gorilla/websocket#894
-   Do not timeout when WriteControl deadline is zero in gorilla/websocket#898
-   Excludes errchecks linter by [@&#8203;apoorvajagtap](https://github.com/apoorvajagtap) in gorilla/websocket#904
-   Return errors instead of printing to logs by [@&#8203;apoorvajagtap](https://github.com/apoorvajagtap) in gorilla/websocket#897
-   Revert " Update go version & add verification/testing tools ([#&#8203;840](gorilla/websocket#840))" by [@&#8203;apoorvajagtap](https://github.com/apoorvajagtap) in gorilla/websocket#908
-   Fixes broken random value generation by [@&#8203;apoorvajagtap](https://github.com/apoorvajagtap) in gorilla/websocket#926
-   Reverts back to v1.5.0 by [@&#8203;apoorvajagtap](https://github.com/apoorvajagtap) in gorilla/websocket#929

#### New Contributors

-   [@&#8203;KSDaemon](https://github.com/KSDaemon) made their first contribution in gorilla/websocket#823
-   [@&#8203;mstmdev](https://github.com/mstmdev) made their first contribution in gorilla/websocket#862
-   [@&#8203;pnx](https://github.com/pnx) made their first contribution in gorilla/websocket#865
-   [@&#8203;rfyiamcool](https://github.com/rfyiamcool) made their first contribution in gorilla/websocket#868
-   [@&#8203;bcreane](https://github.com/bcreane) made their first contribution in gorilla/websocket#878
-   [@&#8203;XdpCs](https://github.com/XdpCs) made their first contribution in gorilla/websocket#881
-   [@&#8203;ninedraft](https://github.com/ninedraft) made their first contribution in gorilla/websocket#872
-   [@&#8203;nak3](https://github.com/nak3) made their first contribution in gorilla/websocket#863
-   [@&#8203;UnAfraid](https://github.com/UnAfraid) made their first contribution in gorilla/websocket#894
-   [@&#8203;apoorvajagtap](https://github.com/apoorvajagtap) made their first contribution in gorilla/websocket#904

**Full Changelog**: gorilla/websocket@v1.5.1...v1.5.3

### [`v1.5.2`](https://github.com/gorilla/websocket/releases/tag/v1.5.2)

[Compare Source](gorilla/websocket@v1.5.1...v1.5.2)

#### What's Changed

-   Fixes subprotocol selection (aling with rfc6455) by [@&#8203;KSDaemon](https://github.com/KSDaemon) in gorilla/websocket#823
-   Update README.md, replace master to main by [@&#8203;mstmdev](https://github.com/mstmdev) in gorilla/websocket#862
-   Use status code constant by [@&#8203;mstmdev](https://github.com/mstmdev) in gorilla/websocket#864
-   conn.go: default close handler should not return ErrCloseSent. by [@&#8203;pnx](https://github.com/pnx) in gorilla/websocket#865
-   fix: replace ioutil.readfile with os.readfile by [@&#8203;rfyiamcool](https://github.com/rfyiamcool) in gorilla/websocket#868
-   fix: add comment for the readBufferSize and writeBufferSize by [@&#8203;rfyiamcool](https://github.com/rfyiamcool) in gorilla/websocket#869
-   Remove noisy printf in NextReader() and beginMessage() by [@&#8203;bcreane](https://github.com/bcreane) in gorilla/websocket#878
-   docs(echoreadall): fix function echoReadAll comment by [@&#8203;XdpCs](https://github.com/XdpCs) in gorilla/websocket#881
-   make tests parallel by [@&#8203;ninedraft](https://github.com/ninedraft) in gorilla/websocket#872
-   Upgrader.Upgrade: use http.ResposnseController by [@&#8203;ninedraft](https://github.com/ninedraft) in gorilla/websocket#871
-   Do not handle network error in `SetCloseHandler()` by [@&#8203;nak3](https://github.com/nak3) in gorilla/websocket#863
-   perf: reduce timer in write_control by [@&#8203;rfyiamcool](https://github.com/rfyiamcool) in gorilla/websocket#879
-   fix: lint example code by [@&#8203;rfyiamcool](https://github.com/rfyiamcool) in gorilla/websocket#890
-   feat: format message type by [@&#8203;rfyiamcool](https://github.com/rfyiamcool) in gorilla/websocket#889
-   Remove hideTempErr to allow downstream users to check for errors like net.ErrClosed by [@&#8203;UnAfraid](https://github.com/UnAfraid) in gorilla/websocket#894
-   Do not timeout when WriteControl deadline is zero in gorilla/websocket#898
-   Excludes errchecks linter by [@&#8203;apoorvajagtap](https://github.com/apoorvajagtap) in gorilla/websocket#904
-   Return errors instead of printing to logs by [@&#8203;apoorvajagtap](https://github.com/apoorvajagtap) in gorilla/websocket#897
-   Revert " Update go version & add verification/testing tools ([#&#8203;840](gorilla/websocket#840))" by [@&#8203;apoorvajagtap](https://github.com/apoorvajagtap) in gorilla/websocket#908
-   Fixes broken random value generation by [@&#8203;apoorvajagtap](https://github.com/apoorvajagtap) in gorilla/websocket#926

#### New Contributors

-   [@&#8203;KSDaemon](https://github.com/KSDaemon) made their first contribution in gorilla/websocket#823
-   [@&#8203;mstmdev](https://github.com/mstmdev) made their first contribution in gorilla/websocket#862
-   [@&#8203;pnx](https://github.com/pnx) made their first contribution in gorilla/websocket#865
-   [@&#8203;rfyiamcool](https://github.com/rfyiamcool) made their first contribution in gorilla/websocket#868
-   [@&#8203;bcreane](https://github.com/bcreane) made their first contribution in gorilla/websocket#878
-   [@&#8203;XdpCs](https://github.com/XdpCs) made their first contribution in gorilla/websocket#881
-   [@&#8203;ninedraft](https://github.com/ninedraft) made their first contribution in gorilla/websocket#872
-   [@&#8203;nak3](https://github.com/nak3) made their first contribution in gorilla/websocket#863
-   [@&#8203;UnAfraid](https://github.com/UnAfraid) made their first contribution in gorilla/websocket#894
-   [@&#8203;apoorvajagtap](https://github.com/apoorvajagtap) made their first contribution in gorilla/websocket#904

**Full Changelog**: gorilla/websocket@v1.5.1...v1.5.2

</details>

---

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

---

&nbsp;
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNy4yODYuMSIsInVwZGF0ZWRJblZlciI6IjM3LjQxOS4xIiwidGFyZ2V0QnJhbmNoIjoibWFzdGVyIiwibGFiZWxzIjpbXX0=-->

See merge request alpine/infra/build-server-status!14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants