I suspect your apex won't be run if there will be a timeout (meaning that for all practical purposes you can treat UserInfo.getSessionId()
as never null).
Can you wrap your methods in client-side check?
var currentTime=new Date().getTime();
var sessionTimeLeft=secondsLeftValue-((currentTime-lastPageActivityTime)/1000);
alert(sessionTimeLeft);
It's based on stuff you can see when you view page source a bit under <form id="sessiontimeout"
...
Alternatively maybe you can make a simple call to server from JS before calling actual remoteAction?
See sample calls in the AJAX toolkit.
You'd have to query for something or perhaps retrieve something really small:
var result = sforce.connection.getServerTimestamp();
log(result.timestamp);
var user = sforce.connection.getUserInfo();
log("Hello " + user.userName);
log("Your email id is " + user.userEmail);
log("and you work for " + user.organizationName);
But I recall reading somewhere we shouldn't mix VF and the connection.js
library...