Invalid session ID found in SessionHeader

Issue #601 resolved
Peter Limbach created an issue
  • this error comes up at my sfdx version of illuminate cloud
  • killing IntelliJ solves the problem for 1 day

Screen Shot 2017-04-28 at 11.41.27.png

Comments (20)

  1. Scott Wells repo owner

    Peter, just to clarify, this problem only occurs against SFDX scratch orgs, correct? If so, I'll see if I can address that in the next SFDX test build. If it's with connections to standard orgs, I'll need to see your idea.log so I can correct it ASAP.

  2. Scott Wells repo owner

    Thanks, Peter. Is there any more to that stack trace? I'd need to see the portion that goes through com.illuminatedcloud.* classes.

  3. Scott Wells repo owner

    If it's happening specifically on an SFDX org then it's an SFDX issue...and by that I mean an issue with Illuminated Cloud's SFDX support for connecting to scratch orgs. That takes a very different execution path than connection to normal orgs using credentials, so it's not surprising that there might be gaps in invalid session handling there. I still need to address it, but that code hasn't had nearly the same hardening as the normal path.

  4. Scott Wells repo owner

    Thanks! Yeah, this is what I needed to see:

    javax.xml.ws.soap.SOAPFaultException: INVALID_SESSION_ID: Invalid Session ID found in SessionHeader: Illegal Session. Session not found, missing session hash: NcKCaBvxXtRCiVoJV533OUjNYzxL4hACj04Sb3JDU58=
    This error usually occurs after a session expires or a user logs out. 
        at org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:161)
        at com.sun.proxy.$Proxy205.query(Unknown Source)
        at com.illuminatedcloud.intellij.builder.ForceComToolingApiDeployer$19.compute(SourceFile:2129)
        at com.illuminatedcloud.intellij.builder.ForceComToolingApiDeployer$19.compute(SourceFile:2122)
        at com.illuminatedcloud.client.ForceComApiClient.runWithClient(SourceFile:256)
        at com.illuminatedcloud.intellij.builder.ForceComBuilder.runWithClient(SourceFile:536)
        at com.illuminatedcloud.intellij.builder.ForceComToolingApiDeployer.getApexPage(SourceFile:2121)
        at com.illuminatedcloud.intellij.builder.ForceComToolingApiDeployer.createMissingMetadata(SourceFile:1057)
        at com.illuminatedcloud.intellij.builder.ForceComToolingApiDeployer.access$200(SourceFile:121)
        at com.illuminatedcloud.intellij.builder.ForceComToolingApiDeployer$1$1.compute(SourceFile:281)
        at com.illuminatedcloud.intellij.builder.ForceComToolingApiDeployer$1$1.compute(SourceFile:220)
        at com.illuminatedcloud.client.ForceComApiClient.runWithClient(SourceFile:220)
        at com.illuminatedcloud.intellij.builder.ForceComBuilder.runWithClient(SourceFile:536)
        at com.illuminatedcloud.intellij.builder.ForceComToolingApiDeployer$1.run(SourceFile:219)
    

    There are actually several stack traces that lead to that same error. Evidently the exceptions raised for invalid sessions against these orgs are slightly different and will require slightly different handling.

  5. Luke Kozakewycz

    Hi Scott,

    Have you had any updates on this?

    INVALID_SESSION.PNG

    javax.xml.ws.soap.SOAPFaultException: INVALID_SESSION_ID: Invalid Session ID found in SessionHeader: Illegal Session. Session not found, missing session hash: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
    This error usually occurs after a session expires or a user logs out. 
        at org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:161)
        at com.sun.proxy.$Proxy175.logout(Unknown Source)
        at com.illuminatedcloud.client.ForceComApiClient.logout(SourceFile:841)
        at com.illuminatedcloud.client.ForceComApiClient.runWithClient(SourceFile:248)
        at com.illuminatedcloud.client.ForceComApiClient.isProductionOrg(SourceFile:987)
        at com.illuminatedcloud.intellij.builder.ForceComBuilder.build(SourceFile:1102)
        at com.illuminatedcloud.intellij.builder.ForceComBuilder.buildForEdit(SourceFile:1359)
        at com.illuminatedcloud.intellij.builder.AsYouTypeEventProcessor.run(SourceFile:185)
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
        at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:308)
        at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:180)
        at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:294)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
        at java.lang.Thread.run(Thread.java:745)
    Caused by: org.apache.cxf.binding.soap.SoapFault: INVALID_SESSION_ID: Invalid Session ID found in SessionHeader: Illegal Session. Session not found, missing session hash: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
    This error usually occurs after a session expires or a user logs out. 
        at org.apache.cxf.binding.soap.interceptor.Soap11FaultInInterceptor.unmarshalFault(Soap11FaultInInterceptor.java:86)
        at org.apache.cxf.binding.soap.interceptor.Soap11FaultInInterceptor.handleMessage(Soap11FaultInInterceptor.java:52)
        at org.apache.cxf.binding.soap.interceptor.Soap11FaultInInterceptor.handleMessage(Soap11FaultInInterceptor.java:41)
        at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:308)
        at org.apache.cxf.interceptor.AbstractFaultChainInitiatorObserver.onMessage(AbstractFaultChainInitiatorObserver.java:112)
        at org.apache.cxf.binding.soap.interceptor.CheckFaultInterceptor.handleMessage(CheckFaultInterceptor.java:69)
        at org.apache.cxf.binding.soap.interceptor.CheckFaultInterceptor.handleMessage(CheckFaultInterceptor.java:34)
        at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:308)
        at org.apache.cxf.endpoint.ClientImpl.onMessage(ClientImpl.java:798)
        at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleResponseInternal(HTTPConduit.java:1670)
        at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleResponse(HTTPConduit.java:1551)
        at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.close(HTTPConduit.java:1348)
        at org.apache.cxf.transport.AbstractConduit.close(AbstractConduit.java:56)
        at org.apache.cxf.transport.http.HTTPConduit.close(HTTPConduit.java:651)
        at org.apache.cxf.interceptor.MessageSenderInterceptor$MessageSenderEndingInterceptor.handleMessage(MessageSenderInterceptor.java:62)
        at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:308)
        at org.apache.cxf.endpoint.ClientImpl.doInvoke(ClientImpl.java:514)
        at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:423)
        at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:324)
        at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:277)
        at org.apache.cxf.frontend.ClientProxy.invokeSync(ClientProxy.java:96)
        at org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:139)
        ... 14 more
    2017-07-06 11:01:44,232 [ 809793]   INFO - cloud.client.ForceComApiClient - Logging into Salesforce DX as test-xxxxxxxxxxxxxxx@learnsmarter_-_lk.net. 
    2017-07-06 11:01:44,232 [ 809793]   INFO - cloud.client.ForceComApiClient - Retrieving org display information from sfdx CLI. 
    2017-07-06 11:01:44,233 [ 809794]   INFO - y.ReflectionServiceFactoryBean - Creating Service {urn:partner.soap.sforce.com}PartnerService from class com.sforce.soap.partner.PartnerApi 
    2017-07-06 11:01:44,909 [ 810470]   WARN - cloud.client.ForceComApiClient - Failed to determine the organization type from the API. Using the configured organization type instead. 
    javax.xml.ws.soap.SOAPFaultException: INVALID_SESSION_ID: Invalid Session ID found in SessionHeader: Illegal Session. Session not found, missing session hash: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
    This error usually occurs after a session expires or a user logs out. 
        at org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:161)
        at com.sun.proxy.$Proxy175.query(Unknown Source)
        at com.illuminatedcloud.client.ForceComApiClient$7.compute(SourceFile:992)
        at com.illuminatedcloud.client.ForceComApiClient$7.compute(SourceFile:988)
        at com.illuminatedcloud.client.ForceComApiClient.runWithClient(SourceFile:256)
        at com.illuminatedcloud.client.ForceComApiClient.isProductionOrg(SourceFile:987)
        at com.illuminatedcloud.intellij.builder.ForceComBuilder.build(SourceFile:1102)
        at com.illuminatedcloud.intellij.builder.ForceComBuilder.buildForEdit(SourceFile:1359)
        at com.illuminatedcloud.intellij.builder.AsYouTypeEventProcessor.run(SourceFile:185)
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
        at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:308)
        at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:180)
        at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:294)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
        at java.lang.Thread.run(Thread.java:745)
    
  6. Scott Wells repo owner

    Luke, the log you've provided here should hopefully give me what I need to track down why this is happening. Let me take a look and I'll let you know if I need any more info. Thanks!

  7. Luke Kozakewycz

    No problem... I've gone ahead and created a new scratch org which I'm working in now. I love how quick and easy it all is!

  8. Scott Wells repo owner

    Oh...this was with a scratch org? You know what, I know what this is. I reported it to the SFDX team over the weekend. Right now you have to run some CLI command that actually interacts with the org before it'll refresh the access token. If you just make a nominal change to a file and save it from the IDE or CLI it should put things back into good shape. As you said, creating a new scratch org is trivial, but that's obviously not an ideal solution as a workaround for a session timeout. Hopefully Salesforce will provide a way for integrators to refresh the access token when it's expired without having to perform a command that might have side-effects and this problem will go away. I've even though about doing it myself by running some totally benign anonymous Apex via the CLI (e.g., System.debug('Refreshing access token');).

  9. Luke Kozakewycz

    I was actually trying to save an apex class - that is why I received that error. I also tried a number of commands to try and refresh the access token before I posted my original comment but couldn't figure a command that would do the job. Things like opening the org, display the details, etc. Maybe there was one command I didn't try.

  10. Scott Wells repo owner

    Gotcha. Guess there are still unguarded interactions with the API, or perhaps there's some other type of error coming back in SFDX and I'm not handling. Let me take a look and hopefully it'll be obvious.

  11. Luke Kozakewycz

    Yes - it was a scratch org.

    Is this a new build? I installed the latest build for the beta as I wasn't part of the pilot program so I might be on the latest build already.

  12. Scott Wells repo owner

    The log entry you supplied above was not from the latest build. It now uses the CLI's push/pull functionality for deployment/retrieval respectively, and that stack trace is in IC's native deployer. I just uploaded the new build on Monday of this week, so please make sure you're updated to that and let me know if you see the issue...or more specifically if do a quick push/pull of an actual change doesn't resolve the issue for you.

  13. Luke Kozakewycz

    Just to give you an update Scott - updated the build and haven't had any issues with the session headers since. :) Thanks!

  14. Scott Wells repo owner

    Okay, I'm going to resolve this but don't hesitate to let me know if you see it again (and it's not the known issue that I mentioned in the comments here).

  15. Log in to comment