openbmc / bmcweb

A do everything Redfish, KVM, GUI, and DBus webserver for OpenBMC
Apache License 2.0
156 stars 131 forks source link

Set timeout to websocket. #170

Closed edineshkumar closed 3 years ago

edineshkumar commented 3 years ago

How to set timeout to virtual-media websocket ? Once virtual media redirection is getting success, Whenever client network will disconnect, virtual-media socket is not getting close.

Suggest to me some inputs..!!

edineshkumar commented 3 years ago

After client network gets disconnected, almost 15minutes are taken for websocket is getting close. If I am right, where the implementation is there in bmcweb, How to change 15 minutes into 2 minutes.

Yours suggestions are most welcome.

edtanous commented 3 years ago

What SHA1 of OpenBMC are you using? What platform did you test on?

What daemon are you using bmcweb to connect to virtual media on the bmc?

How are you disconnecting the network?

edineshkumar commented 3 years ago

What SHA1 of OpenBMC are you using? What platform did you test on?

What daemon are you using bmcweb to connect to virtual media on the bmc?

How are you disconnecting the network?

I am currently using the latest OpenBMC released 2.8 source code. Platform : evb-ast2600 User machine OS: windows 10 Broswer: Chrome - Version 86.0.4240.75

And I am disconnecting the user network by disabling the wi-fi. I am using the in window webui virtual media for media redirection.

Below are my issues : Case 1) Actually, if I start the media session from webui, then the redirected image is getting inserted in host side. But my issue is, when I keep the session active without performing any operation with the redirected image, then is there a inactive time support exists ?

Case 2) In case, while media direction is going on and mistakenly if user network (wifi) goes, then expected behaviour is like nbd processes should stop and redirected media image should be disconnected from host immediately . But right now I am seeing the different behaviour like once the user network goes, then exactly after 15mins nbd related processes getting stopped and media image is getting disconnected from host machine. In this case, is there any parameter in webserver side, who is checking the timeout period of 15mins ? If yes, then whether is it possible to modify that count period ?

Do you have any inputs on this?

edineshkumar commented 3 years ago

@edtanous

May I know the reason for closing this issue. And I didn't get the solution yet.

Please share your inputs.

edtanous commented 3 years ago

Apologies, I clicked the wrong button. Your second comment seemed to imply that the connections were getting closed after 15 minutes, as is expected when you are removing the network, as you're relying on TCP and/or websocket ping timeout when you disconnect the WIFI. If the connection closes gracefully, the connection is closed immediately. This seems like the intended behavior. Are you looking for a shorter timeout? That could certainly be implemented.

What backend are you using for your virtual media implementation? It's possible that has something to do with it.

edineshkumar commented 3 years ago

Yes, I am looking for shorter timeout. jsnbd is using for virtual media redirection in backend.

@jk-ozlabs @bradbishop @raviteja-b Can you give some suggestion to implement, which I want exactly?

edineshkumar commented 3 years ago

@edtanous I have applied suggested timeout options for the server role to the stream by websocket::stream_base::timeout in class ConnectionImpl , which is in bmcweb/http/websocket.h .

Now the Websocket idle time limits of 15 minutes, reduced into 2 minutes. But as per my understanding, bmcweb/http/websocket.h is also applicable for KVM, GUI and other webserver related features. So it may reflected into other features too in bad manner ? If yes, please suggest any test case to validate the same...

edtanous commented 3 years ago

Have you pushed said change to somewhere that it can be commented on?

I'm still not clear why it matters that it's 2 minutes instead of 15 minutes in the case of a network error, and not a clean disconnect, but I'm not sure I'd really be against it if the patch is relatively clean.

edineshkumar commented 3 years ago

Have you pushed said change to somewhere that it can be commented on?

I'm still not clear why it matters that it's 2 minutes instead of 15 minutes in the case of a network error, and not a clean disconnect, but I'm not sure I'd really be against it if the patch is relatively clean.

My code changes till now not yet pushed in community.

As per my feature requirement, Virtual media websocket should gracefully close within 2minutes, when network error will occur. That is the reason why I have tried these implementation.

Thank you for your useful inputs.