VMware {code} Community
sunilkumardm
Enthusiast
Enthusiast

UserSessionService.getUserSession() is throwing exception after long inactivity on vSphere web client

Hi,

We have a html plugin for vSphere Web Client. After a long inactivity (an hour or so) on vSphere web client, navigating around web client seems fine (session timeout has not occurred). But when navigated to our plugin, an null pointer exception is thrown in the service layer. When debugged further, we found that userSession or userSession.serversInfo is NULL. When this occurs, we always have to logout and relogin again to navigate to our plugin.

UserSession userSession = _userSessionService.getUserSession();

Do you have any suggestions why his might be occurring and how to fix it?

Appreciate any responses. Thanks in advance.

Reply
0 Kudos
3 Replies
_vladi_
VMware Employee
VMware Employee

Hi,

I think this is expected behavior. After 1 hour of inactivity the session should have been closed in any case so I am surprised that the Client seemed to work. Please specify what worked from the Client and try it with one of the SDK samples which uses the same call to getSessionService (e.g. WSSDK sample).

Another reason for this behavior might be that your vCenter was down.

If you can still reproduce it please provide some log output from the vsphere_client_virgo.log that shows the error. Thanks.

Cheers,

Vladimir

Reply
0 Kudos
kumartade
Enthusiast
Enthusiast

This behavior is observed with new html5 client as well.

Could you please provide some workaround?

Reply
0 Kudos
_vladi_
VMware Employee
VMware Employee

Hi,

Note that the exact scenario desribed above is expected if the session has timed out. At the moment there is no way for an open plugin UI view to know when the session timed out - hence, the user realizes that only after navigating away from the plugin iframe.

That said, since the last discussion on this thread there have been a couple of fixes on other edge scenarios when getUserSession() returns null. Those have been released with vSphere Client 6.7U1 and 6.5U2d.

If you still reproduce such cases not mentioned above please provide more details, parts of the log and tested version.

Cheers,

Vladi