Skip to content

fix: Log exception for closed socket - #12829

Merged
Artur- merged 2 commits into
masterfrom
issues/12646-log-broken-pipe
Jan 25, 2022
Merged

Artur- merged 2 commits into
masterfrom
issues/12646-log-broken-pipe

Conversation

@caalador

Copy link
Copy Markdown
Contributor

Instead of throwing an exception if the
client has closed the stream socket, log a
message in debug mode.

Closes #12646

Instead of throwing an exception if the
client has closed the stream socket, log a
message in debug mode.

Closes #12646
@github-actions

github-actions Bot commented Jan 25, 2022 •

Copy link
Copy Markdown
Contributor

Unit Test Results

   773 files  ±0     773 suites  ±0   24m 22s ⏱️ - 1m 12s
5 752 tests +1  5 702 ✔️ +1  50 💤 ±0  0 ❌ ±0 
5 784 runs  +2  5 733 ✔️ +2  51 💤 ±0  0 ❌ ±0 

Results for commit f22c1fa. ± Comparison against base commit b2e96d7.

♻️ This comment has been updated with latest results.

try (InputStream input = createInputStream(session)) {
copy(session, input, stream);
} catch (IOException ioe) {
if (!"Broken pipe".equals(ioe.getMessage())) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

nit: This would be a little more readable if it was

if (theCase) {
  log
} else {
  throw ioe;
}

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

done

throw ioe;
}
LoggerFactory.getLogger(StreamResource.class).debug(
"Broken pipe. Client has most likely cancelled link.",

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

What does "cancelled link" mean? Should it be something like "The client browser has most likely cancelled the request"?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

👍 done

@sonarqubecloud

Copy link
Copy Markdown

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

@Artur-
Artur- enabled auto-merge (squash) January 25, 2022 12:57
@Artur-
Artur- merged commit 5896c55 into master Jan 25, 2022
@Artur-
Artur- deleted the issues/12646-log-broken-pipe branch January 25, 2022 13:02
vaadin-bot pushed a commit that referenced this pull request Jan 25, 2022
Instead of throwing an exception if the client has closed the stream socket, log a message in debug mode.

Closes #12646
vaadin-bot pushed a commit that referenced this pull request Jan 25, 2022
Instead of throwing an exception if the client has closed the stream socket, log a message in debug mode.

Closes #12646
vaadin-bot added a commit that referenced this pull request Jan 25, 2022
Instead of throwing an exception if the client has closed the stream socket, log a message in debug mode.

Closes #12646

Co-authored-by: caalador <mikael.grankvist@vaadin.com>
vaadin-bot added a commit that referenced this pull request Jan 25, 2022
Instead of throwing an exception if the client has closed the stream socket, log a message in debug mode.

Closes #12646

Co-authored-by: caalador <mikael.grankvist@vaadin.com>
@vaadin-bot

Copy link
Copy Markdown
Collaborator

This ticket/PR has been released with platform 23.0.0.alpha4 and is also targeting the upcoming stable 23.0.0 version.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

IOException - Broken Pipe

3 participants