qlik-oss / enigma-go

Go library for consuming Qlik's Associative Engine.
MIT License
39 stars 12 forks source link

DoReloadEx runs indefinitely when using context from WithReservedRequestID #161

Closed swalke05 closed 4 years ago

swalke05 commented 4 years ago

Description

DoReloadEx() never returns when using the context returned from doc.WithReservedRequestID()

Steps to Reproduce

  1. Call doc.WithReservedRequestID(ctx)
  2. Call doc.DoReloadEx(ctxWithReservedRequestID)
  3. Observe reload attempt run indefinitely without returning
Expected behavior

DoReloadEx should return once the data has been reloaded, even if the context provided is the one returned from doc.WithReservedRequestID()

Actual behavior

Reload (even for an empty app) does not finish until the caller of DoReloadEx is forcefully exited.

Passing in the existing context instead of the ctxWithReservedRequestID consistently fixes the problem.

Environment

Local QCS

Operating system
[ ] Windows
[x] OSX
[ ] Linux

Versions

glooms commented 4 years ago

I've recreated this issue and I'm trying to find the cause now. Strange indeed.

glooms commented 4 years ago

@swalke05 I think I found the issue, are you using the same context for both checking progress and the reload? Because it seems that you can only make one call with the context from WithReservedRequestID as it corresponds to an ID from a single call. At least I think so.

I got it to work by using the context with a reserved request ID only for the DoReload call and another context for observing progress.

The reason you can only use the returned context with one request is that you will then send multiple unrelated requests with the same ID at more or less the same time which enigma cannot handle.

swalke05 commented 4 years ago

Thanks for the investigation @glooms! This was exactly what caused my problem, I was using the returned context with both DoReloadEx and GetProgress.