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

Is there a good way to track how recently data was received from the remote end of an http2 session? #21730

Closed
murgatroid99 opened this issue Jul 9, 2018 · 9 comments
Labels
feature request Issues that request new features to be added to Node.js. http2 Issues or PRs related to the http2 subsystem. stale

Comments

@murgatroid99
Copy link
Contributor

I am trying to detect when a connection underlying an http2 session is broken using this strategy. In short, I want to send an http2 ping when I have at least one active stream (which I can track myself) and when I have not received any data from the server. Is there a good way to determine when was the latest time that I received any data from the server?

@ChALkeR ChALkeR added question Issues that look for answers. http2 Issues or PRs related to the http2 subsystem. labels Jul 9, 2018
@davisjam
Copy link
Contributor

If you're looking for an application-level solution:

You could update a timestamp (process.hrtime) every time data is received and compare it to the current time. Perhaps perform this comparison in a recurring timer.

@murgatroid99
Copy link
Contributor Author

The issue here is that I am working with a http2 session object, but what I really want to track is every time data comes in on the underlying socket. That includes a variety of events on the http2 session and http2 stream objects, plus frames that don't trigger events at all, like WINDOW_UPDATE frames.

Would it cause any problems to add an additional "data" event handler to the underlying http2session.socket?

@jasnell
Copy link
Member

jasnell commented Aug 10, 2018

This would be a bit difficult to do and would limit performance. One thing we could do is update an internal timestamp whenever data is received, but invoking a callback or event on every chunk of data would result in a significant performance loss.

@murgatroid99
Copy link
Contributor Author

That timestamp would be all I really need here.

@jasnell jasnell added feature request Issues that request new features to be added to Node.js. and removed question Issues that look for answers. labels Aug 10, 2018
@jasnell
Copy link
Member

jasnell commented Aug 10, 2018

Will investigate the possibilities here. Marking as a feature request.

jasnell added a commit to jasnell/node that referenced this issue Sep 23, 2018
Adds a time stamp indicating the last time data was received from
the connected peer.

Fixes: nodejs#21730
@Trott
Copy link
Member

Trott commented Nov 16, 2018

Will investigate the possibilities here. Marking as a feature request.

@jasnell Any results to report?

@jasnell
Copy link
Member

jasnell commented Nov 16, 2018

I've got an open pr that I need to revisit in the next few weeks

@github-actions
Copy link
Contributor

There has been no activity on this feature request for 5 months and it is unlikely to be implemented. It will be closed 6 months after the last non-automated comment.

For more information on how the project manages feature requests, please consult the feature request management document.

@github-actions github-actions bot added the stale label Feb 28, 2022
@targos targos moved this to Pending Triage in Node.js feature requests Feb 28, 2022
@targos targos moved this from Pending Triage to Stale in Node.js feature requests Feb 28, 2022
@github-actions
Copy link
Contributor

github-actions bot commented Apr 4, 2022

There has been no activity on this feature request and it is being closed. If you feel closing this issue is not the right thing to do, please leave a comment.

For more information on how the project manages feature requests, please consult the feature request management document.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request Issues that request new features to be added to Node.js. http2 Issues or PRs related to the http2 subsystem. stale
Projects
None yet
Development

No branches or pull requests

5 participants