ASE Home Page Products Download Purchase Support About ASE
ChartDirector Support
Forum HomeForum Home   SearchSearch

Message ListMessage List     Post MessagePost Message

  WebChartViewer zoom sometimes returns the wrong chart
Posted by reims on Apr-25-2019 17:09
Hi.

I am displaying charts on our website. We recently did some server side upgrades and found that sometimes (about one in ten) the WebChartViewers zoom feature returns the wrong chart. This only happens if multiple people use the zoom at roughly the same time.

Our programming language is perl.
We found that this happens in other parts of our website, and that the problem disappears if we stop using the CGI module.

My question is this: The WebChartViewer's constructor needs a CGI instance. Would it be possible to use something else instead of that? What changes would I have to make?

Regards and thanks in advance

  Re: WebChartViewer zoom sometimes returns the wrong chart
Posted by Peter Kwan on May-02-2019 15:19
Hi reim,

Sorry for the late reply. For some reasons, we miss your post.

For "this happens in other parts of our website", do you mean the problem appears on other parts of your website that does not use ChartDirector or WebChartViewer? Or the problem appears in other parts of your website that also use ChartDirector or WebChartViewer?

If the problem only occurs for ChartDirector charts, I suspect it may be due to the temporary image file (the makeTmpFile method call). Does "the other parts of your website" also use makeTmpFile to create the chart?

The makeTmpFile method creates the chart as a temporary file on the hard disk. For this to work, each temporary file must have a unique name, otherwise the files from different users can overwrite each other. ChartDirector creates a unique name based on the environmental variable $ENV[UNIQUE_ID] and other factors. The UNIQUE_ID is supposed to be set by the web server and should be unique. See:

https://httpd.apache.org/docs/2.4/env.html

If the UNIQUE_ID does not exist, ChartDirector will use the IP address, TCP port, process id and the timestamp to generate the hopefully unique filename. It will check if the filename already exists, and if so, it will try up to 100 sequence number (from 0 to 99) to generate unique hopefully a unique filename.

In theory, it should still be possible to create non-unique filename if the UNIQUE_ID does not exist (or the UNIQUE_ID set by Apache is not really unique), and all users are using the same IP address from the server's point of view (which is possible if there is a NAT gateway in between), and there are more than 100 temporary files created in one second. Another possibility is that the file system reports the file does not exist, the file actually exists by the time ChartDirector uses the filename. (This is more likely for remote/distributed/mirrored storage.)

To check if duplicated temporary filename is the cause of the problem, you can try the followings:

- When you see s wrong image, try to obtain the URL of the chart image. On Chrome, you can right click on the image, and select "Copy Image Address".

- In the web server log file, try to see if the same image filename is used multiple times by different users.

If the UNIQUE_ID is disabled on the web server, try to enable it to see if it makes any difference.

Regards
Peter Kwan