Focal Point Banner
Community Center Education Summit Technical Support User Groups
Let's Get Social!

Facebook Twitter LinkedIn YouTube
Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     [Case opened] Bug in WebFOCUS handling of global variables
Go
New
Search
Notify
Tools
Reply
  
[Case opened] Bug in WebFOCUS handling of global variables
 Login/Join
 
Gold member
posted
Hello WF community,

after a long debugging session due to a problem in our webfocus application (WF 7.7) I seem to have found a severe problem in WebFOCUS handling of global variables (- still hoping I am mistaken -). We are already about to submit a case to IBI but I would also like to ask you if you have experienced similar problems or may even have already found a solution:

Note: The parameter "IBIF_persistentamp" on our server is set to "yes" to enable the usage of global amper variables across different reports.

But now the problem:
It seems that all global variables are read into a cache at the beginning of each fex, might be changed during runtime and than written back from that cache into the temp-file (referenced by the cookie "WF_AMPERFILE" on the client-browser).
The problem now occurs when two or more fexes are run in parallel (which almost always occurs if you have multiple reports on one html page).

Suppose that report (A) starts prior to (B), but also runs longer than (B). (B) now changes one or more of the &&VARs and terminates before (A) has finished, than (A) will override all "work" that has been done to the global variables by (B) regardless if (A) even accessed the variables changed by (B) or not. A race condition which is even more severe due to the fact, that (A) might have "nothing to do" with the variables of (B) but influences or invalidates them anyhow.
The same effect is true if (B) is executed (using EX) by (A) - global variables set by (B) never reach (A) and (changes) are subsequently discarded.

One may easily confirm this problem using the following small fexes:

 
-* REPORT (A)
-SET &&VAR_LONGRUN=&INPUT1;
-RUN
-* you may replace SLEEP with a long running
-* TABLE FILE - same result for me
-SET &A=SLEEP(5, 'I2');


 
-* REPORT (B)
-SET &&VAR_SHORTRUN=&INPUT2;


If you run (A) and then (B) while (A) is still running, &&VAR_SHORTRUN will be available "shortly" while (A) has not yet finished, but will not exist anymore after (A) has finished.

IMHO this is absolutely incorrect and should not occur - left alone I did not find this in any documentation.

Has anybody experienced similar problems or might even found a solution for this (preferably still based on global variables). Are there more flags in WF to avoid this?

The only solution I came up with so far is to sequentially (opposed to parallel) execute all requests - but I guess that would mean that I cannot use the standard WF. report handling (as created by the composer) anymore.

Thanks in advance for your help!

Best regards
Bastian

This message has been edited. Last edited by: linnex,


WebFOCUS 7.7.03
 
Posts: 67 | Registered: January 05, 2011Reply With QuoteReport This Post
Expert
posted Hide Post
Bastian,

I can't help with the problem you describe (and you should open a case with Tech Support), but perhaps if you explained why you require
quote:
the usage of global amper variables across different reports
perhaps we could suggest an alternative. In my dozen years working with WebFOCUS, I've never had to save global amper variables for use with another fex - other than User ID or Language, where I've used cookies.


Francis


Give me code, or give me retirement. In FOCUS since 1991

Production: WF 7.7.05M, Dev Studio, BID, MRE, WebSphere, DB2 / Test: WF 8.1.05M, App Studio, BI Portal, Report Caster, jQuery, HighCharts, Apache Tomcat, MS SQL Server
 
Posts: 10577 | Location: Toronto, Ontario, Canada | Registered: April 27, 2005Reply With QuoteReport This Post
Gold member
posted Hide Post
Dear Francis,

thanks for your response to my problem. Our WF / IBI consultant informed me that he has opened a case on my behalf.

To explain what I might have to say that this application was actually developed by 2 IBI/WF consultants and myself (not affiliated with IBI). Our application is already up and running and already contains some dozen reports almost all depending on the selection of global parameters: these are e.g. the project name and project-ID, the project's status, user-id etc. These variables are used as filters and/or headings in most of the reports.
They are read (e.g. user) at the portal of the application or several of them can be selected / changed (e.g. the project specific stuff) at this portal, too. Inside the application, you can go back to the portal whenever you want.
The portal contains the selection itself (and calls fexes to actually apply those variables) but also other reports that run in parallel (user checks, self-made authorisation checks, new-boxes etc.)
Thus we have multiple reports on one page and it is not trivial to guarantee "a sequential fex queue".

A solution based on cookies might work for us but we then would have to adapt most of the reports which I estimate to be time consuming in our case. But maybe you could explain to me what you did in more detail: I am familiar with the use of cookies, JS, AJAX etc.. If you say you used cookies does that mean you did not use the standard wf. request system to run reports, but your own calls passing the cookies' contents as parameters? - or is there an easier way?

Thanks again
Bastian


WebFOCUS 7.7.03
 
Posts: 67 | Registered: January 05, 2011Reply With QuoteReport This Post
Expert
posted Hide Post
What is this "portal"? WebFOCUS Business Intelligence Dashboard?

Multiple reports on one page? Contained within one HTML page or fex?


Francis


Give me code, or give me retirement. In FOCUS since 1991

Production: WF 7.7.05M, Dev Studio, BID, MRE, WebSphere, DB2 / Test: WF 8.1.05M, App Studio, BI Portal, Report Caster, jQuery, HighCharts, Apache Tomcat, MS SQL Server
 
Posts: 10577 | Location: Toronto, Ontario, Canada | Registered: April 27, 2005Reply With QuoteReport This Post
Virtuoso
posted Hide Post
I am with Francis on this one.

Reliance on &&variables and running 2 reports at once is not clever. There is one set of &&variables for the session, not for each report, so if these are changed, when are they picked up.

The general idea is that the user runs a report, waits for output, runs another report...

Cookies are far more reliable, and also totally under your control.


Alan.
WF 7.705/8.007
 
Posts: 1451 | Location: Portugal | Registered: February 07, 2007Reply With QuoteReport This Post
Gold member
posted Hide Post
Hi everyone,

to clarify what is meant by "portal". It is a WebFOCUS (composer created) HTML page placed on a WF dashboard (only page of this dashboard). This HTML page contains multiple IFrames that reference each reference an autoExecuted report. There are also some AJAX calls via own JS calls to other fexes on the page (e.g. for selecting the project from a combo box).

To Alan: Thank you for also helping.
quote:
The general idea is that the user runs a report, waits for output, runs another report...
. But (AFAIK) this is not how WebFOCUS handles reports when created by the composer, is it? When you have multiple report-IFrames on one page each request is sent (via AJAX by WF JScripts) and is not waited upon before starting / requesting the next one. The number of requests sent in parallel is limited only by browser settings (which I cannot change due to company policies).
Then my question would be: why is it not possible (or a bad idea) to rely on that one report may set a global variable while another report performs a completely different thing (not even "touching") that variable. This seems to be what is currently breaking our legs. I am aware that there is one set of global variables per session (and this is great for us, otherwise they would not be "global"): but would you not agree that one report accessing &&VAR1 should not be (accidentally) messing with &&VAR2 (changed by report2, running at the same time as 1 by chance).
I completely agree that it would be normal that it poses a problem if two reports access the same variable at the same time (WF does not seem to now anything about critical regions, semaphores etc. for concurrency control) but I am not talking about this here. I am talking about two different, independent variables. From my point of view (and every other programming language I know behaves exactly like this) - variables are only written when explicitly changed in the code - not by some caching algorithm at the end of a function / module / report as it seem to be done here in WF - messing up the variables' contents.

Wouldn't you agree to that? But I guess you are completely right about the reliability of cookies compared to those WF global variables. But from my point of view this renders WF global variables completely useless in the environment currently sold by IBI.

Thanks everyone for your help


WebFOCUS 7.7.03
 
Posts: 67 | Registered: January 05, 2011Reply With QuoteReport This Post
Virtuoso
posted Hide Post
linnex

I agree that one focexec should not affect &&vars that it does not reference, and in 7.6.11 it doesn't.

There are a couple of issues for persistentamp in 7.7. that may be worth looking at.


Alan.
WF 7.705/8.007
 
Posts: 1451 | Location: Portugal | Registered: February 07, 2007Reply With QuoteReport This Post
Member
posted Hide Post
Bastian,

First and unfortunately I think you're not mistaking and the issue will indeed occur as described :
- &&VAR_SHORTRUN returned by report (B) will indeed disappear when report (A) returns (because it was not set when A was called)

Well, this is linked to how IBIF_persistentamp works. If you trace it you'll see that a request is actually including a '? &&' at the end and this is what returns the list of global variables at that time. Unfortunately it is the whole list that gets saved on the client in the browser session and send back later on (hence no control for each individual && variable names).

Therefore IBIF_persistentamp will only "work" if indeed the requests updating (or creating) the global variables are serialized. Now maybe you should be handling yourself the storage of variables in the java session [you may want to look at WebFOCUS plug-in function CopyWFVarToSessionVar or to appendix A creating you own plug-in]

Another option i used was to store in the foccache directory a dynamically created FOCEXECs that gets -INCLUDEd in reports that needs this.
 
Posts: 11 | Location: Information Builders France | Registered: May 22, 2003Reply With QuoteReport This Post
Gold member
posted Hide Post
Hi Jean-Claude,

thank you for your response - and for confirming my fears that I was right about WF handling global &&vars -
and for your suggestion of using CopyWFVarToSessionVar and other solutions.

I actually have already had a look at a similar function of the plug-in "CopyHTTPCookieToWFVar" based on the ideas of Alan and Francis.
I hope (and your suggestions also points in that direction) that using this one will enable me to use a &VAR instead of my &&VAR and thus only replace all occurences in some dozen fexes using a powershell script or similar things.
This would only require minor changes yet provide the same functionality.

On the other hand, a case was now opened with IBI but (sorry to say this) I have little hope that they will change / repair anything soon.

Therefore I am really grateful for your suggestions for a different solutions.

So Thanks everybody once again.
Best regards

Bastian


WebFOCUS 7.7.03
 
Posts: 67 | Registered: January 05, 2011Reply With QuoteReport This Post
<JG>
posted
Bastian,

I'm putting together a cookie based solution for you with Norbert.

The variables need exporting to a cookie and then can be read back
via the domain profile using the GETCOOKI function
 
Reply With QuoteReport This Post
  Powered by Social Strata  
 

Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     [Case opened] Bug in WebFOCUS handling of global variables

Copyright © 1996-2018 Information Builders, leaders in enterprise business intelligence.