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

Fully read heartbeat stream in RESTMBeanServerConnection #30746

Merged
merged 2 commits into from
Feb 14, 2025

Conversation

idlewis
Copy link
Member

@idlewis idlewis commented Feb 10, 2025

The server response to the heartbeat/notification request is the class name string 'com.ibm.ws.kernel.boot.jmx.internal.PlatformMBeanServer'. This needs to be read, and the stream closed, to allow the HTTPURLConnection to be properly pooled/reused. Not reading the stream was causing dangling sockets in close_wait state

fixes #30758

The server response to the heartbeat/notification request is
the class name string 'com.ibm.ws.kernel.boot.jmx.internal.PlatformMBeanServer'.
This needs to be read, and the stream closed, to allow the HTTPURLConnection
to be properly pooled/reused. Not reading the stream was causing dangling
sockets in close_wait state
@idlewis idlewis self-assigned this Feb 10, 2025
@idlewis
Copy link
Member Author

idlewis commented Feb 10, 2025

#build (view Open Liberty Personal Build - ❌ completed with errors/failures.)

Note: Target locations of links might be accessible only to IBM employees.

@idlewis idlewis requested a review from leochr February 10, 2025 15:18
@LibbyBot
Copy link

Code analysis and actions

DO NOT DELETE THIS COMMENT.
  • 1 product code files were changed.
  • Please describe in a separate comment how you tested your changes.

@LibbyBot
Copy link

Your personal build request is at https://wasrtc.hursley.ibm.com:9443/jazz/resource/itemOid/com.ibm.team.build.BuildResult/_Yo5igefaEe-iabY-3Iflhw

Target locations of links might be accessible only to IBM employees.

Copy link
Member

@leochr leochr left a comment

Choose a reason for hiding this comment

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

@idlewis Thanks for the PR. Just one clarification about the while loop.

// Server sends a string back that needs to be consumed to close the connection
InputStream is = connection.getInputStream();
int data = is.read();
while (data != -1) {
Copy link
Member

@leochr leochr Feb 10, 2025

Choose a reason for hiding this comment

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

Just want to make sure that it won't get stuck here indefinitely. Otherwise, a maximum retry may need to be set.

leochr
leochr previously approved these changes Feb 10, 2025
Copy link
Member

@leochr leochr left a comment

Choose a reason for hiding this comment

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

@idlewis Adding approval in case the above inquiry is not a real concern and you want to go ahead and merge.

@idlewis
Copy link
Member Author

idlewis commented Feb 11, 2025

#build (view Open Liberty Personal Build - ❌ completed with errors/failures.)

Note: Target locations of links might be accessible only to IBM employees.

@LibbyBot
Copy link

Code analysis and actions

DO NOT DELETE THIS COMMENT.
  • 1 product code files were changed.
  • Please describe in a separate comment how you tested your changes.

@idlewis
Copy link
Member Author

idlewis commented Feb 11, 2025

I'm happy that the read loop for the stream is okay. This is how we consume the input streams in other parts of the JMX client

@LibbyBot
Copy link

Your personal build request is at https://wasrtc.hursley.ibm.com:9443/jazz/resource/itemOid/com.ibm.team.build.BuildResult/_QsNOIOidEe-iabY-3Iflhw

Target locations of links might be accessible only to IBM employees.

@idlewis
Copy link
Member Author

idlewis commented Feb 13, 2025

#build (view Open Liberty Personal Build - ❌ completed with errors/failures.)

Note: Target locations of links might be accessible only to IBM employees.

Copy link
Member

@Azquelt Azquelt left a comment

Choose a reason for hiding this comment

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

I approve the change in the second commit which uses a try-with-resources.

@LibbyBot
Copy link

Code analysis and actions

DO NOT DELETE THIS COMMENT.
  • 1 product code files were changed.
  • Please describe in a separate comment how you tested your changes.

@LibbyBot
Copy link

Your personal build request is at https://wasrtc.hursley.ibm.com:9443/jazz/resource/itemOid/com.ibm.team.build.BuildResult/_rIHy4Op3Ee-iabY-3Iflhw

Target locations of links might be accessible only to IBM employees.

@idlewis idlewis merged commit a5a500a into OpenLiberty:integration Feb 14, 2025
2 checks passed
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.

JMX client doesn't fully consume heartbeat input stream, leaving sockets in CLOSE_WAIT state
4 participants