Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
manta_dev
Partner - Contributor II
Partner - Contributor II

Unable to close server sessions

Hi,

so I am trying to connect to a Qlik Sense Enterprise server's virtual proxy using certificates and doing a metadata retrieval of many applications using the Java's websockets (in my case implementation by TooTallNate: https://github.com/TooTallNate/Java-WebSocket) and Qlik Engine JSON API.

Naturally, I have to connect again for every application I want to open and this means that for 10 apps I have 11 connections (the first one only retrieves a list of apps using the GetDocList method.

However, virtual proxies limit maximum parallel sessions to 5 at a time and whenever I close a websocket, for some reason, the session remains open. Does anyone have any idea how to make the virtual proxy session close on websocket close?

More details:

- I am using a static user directory authentication

- I tried to add the content of 'Set-Cookie' header from the server's handshake response that didn't work:

 

addHeader("cookie", handshakeData.getFieldValue("Set-Cookie"));

 

- I am properly closing the websockets, when I only connected to a normal Proxy, there was no problem with this

 

Any ideas would be greatly appreciated, thanks!

1 Solution

Accepted Solutions
manta_dev
Partner - Contributor II
Partner - Contributor II
Author

I did not see any errors in logs, however, connecting directly to the server node (therefore bypassing the virtual proxy) solve the problem. Fortunately, using the virtual proxy is not necessary for us and we can work with the Engine directly.

View solution in original post

7 Replies
Damien_Villaret
Support
Support

Hi @manta_dev 

It should work to add the cookie as a request header on subsequent requests as you've pointed as it would cookie on the same proxy session.

There must be something wrong in the code logic or a timing issue if it's not trying to reuse the session.
Did you try to check the Qlik Proxy logs, if you've tried to use an invalid cookie you should have a WARN or ERROR in that log: C:\programdata\qlik\sense\log\trace\servername_audit_proxy.txt

If the issue is solved please mark the answer with Accept as Solution.
manta_dev
Partner - Contributor II
Partner - Contributor II
Author

I checked the log and there are only a couple of Redirect/LoadBalancing logs, presumably from when I logged through my browser to the QMC as admin.

The Set-Cookie data contains following information:

X-Qlik-Session-manta={23DA935C-D834-43BA-AA16-9F1ADCB88879}:0b07499c-92f5-4cf9-b48e-b53357b9a55e; Path=/; HttpOnly; SameSite=Lax; Secure

Do I only have to set a sub-string of the data into the 'Cookie' header?

Damien_Villaret
Support
Support

I believe in this case the correct format to reuse that cookie would be

X-Qlik-Session-manta=0b07499c-92f5-4cf9-b48e-b53357b9a55e;

 

The rest is not needed when it's in the "Cookie" request header

If the issue is solved please mark the answer with Accept as Solution.
manta_dev
Partner - Contributor II
Partner - Contributor II
Author

I tried to add the following pair into the header map:

Cookie: X-Qlik-Session=<the session ID sent in handshake>;

and I am still getting the same error message after I try to use the 6th session:

{
  "method": "OnMaxParallelSessionsExceeded",
  "jsonrpc": "2.0",
  "params": {
    "severity": "fatal",
    "message": "Access to the app is denied: MaxParallelSessionsExceeded",
    "timestamp": "2021-07-07T14:25:09.4092842Z"
  }
}
Damien_Villaret
Support
Support

@manta_dev 

Do you see any error in the Qlik Proxy logs that states that the session you're trying to use is invalid ?

If the issue is solved please mark the answer with Accept as Solution.
manta_dev
Partner - Contributor II
Partner - Contributor II
Author

I did not see any errors in logs, however, connecting directly to the server node (therefore bypassing the virtual proxy) solve the problem. Fortunately, using the virtual proxy is not necessary for us and we can work with the Engine directly.

Damien_Villaret
Support
Support

I would suspect the Qlik Proxy service hasn't receive the cookie if it doesn't throw an error, it would show an error if you try to use a cookie that it doesn't consider to be valid.

Glad that you found an alternative solution that works for your use case.

If the issue is solved please mark the answer with Accept as Solution.