|
Contention issues with AddLegend Method |
Posted by Todd Thurheimer on Oct-21-2011 00:48 |
|
Hello,
I am working on a web application running Perl/Apache that utilizes Chart Director. Our graphs generate smoothly under normal circumstances. Under extremely heavy load, however, I am seeing an issue periodically when the same application server tries to generate multiple graphs at the same instant. A call to AddLegend returns an error in our apache error logs - "unknown method XYChart.addLegend". Each time this arises, there are two such error messages from two separate hits - so they are always paired. It's especially weird because AddLegend is the 3rd method we evoke after creating a new XYChart object. But it is always AddLegend that can't be found and causes the initial failure.
After this initial failure, any call to any XYChart method fails until Apache is restarted. The error message from our application in the Apache error logs is all I can find. Is there any way I can get more information from chartDirector about why AddLegend() no longer can be found? Have you seen behavior like this before?
Thank you for your time and for any assistance you can provide,
Todd |
Re: Contention issues with AddLegend Method |
Posted by Peter Kwan on Oct-22-2011 01:38 |
|
Hi Todd,
Unluckily, we have never seen this problem before.
The ChartDirector shared object "libchartdir.so" (I assume you are using the Linux, FreeBSD or Solaris edition of ChartDirector) contains a table that includes all supported methods. The "unknown method xxx" occurs when the method "xxx" cannot be found in the table.
The only mechanism I can think of that can cause the error is memory corruption. The table for some reason is corrupted. Furthermore, the libchartdir.so is cached by the server and is never unloaded/reloaded, so the corruption remains "until Apache is restarted".
I am not sure how the memory corruption can occur. The table is built up when the shared object is loaded (during the static variable initialization phase controlled by the shared object loader). After that, ChartDirector never writes to the table.
Anyway, even if memory corruption occurs, normally it should not cause all future request to fail. It is because on non-Windows machines, Apache normally is run using "forking" (as opposed to multi-threading). The Apache will spawn a large number of daughter "httpd" processes to handle concurrent requests, each with its own memory space. So even if one of the daughter process is corrupted, it should not affect other daughter process. Also, if the Perl is run as CGI or FastCGI (as opposed to mod_perl), it too has its own process and memory space, and the memory corruption should not affect all requests. If memory corruption still occurs system wide, it would mean the problem occurs at the OS kernel level (only at this level can a memory corruption affect multiple processes).
Unluckily, I can only suggest some ideas, but not a concrete solution. Are you using Apache in "forking" mode (is there multiple httpd processes in your system), or in multi-threading mode? Are you using Perl as mod_perl or as CGI/FastCGI? I am thinking, if you are using not forking or CGI/FastCGI, may be you can consider to use these methods. Even if it does not completely solve the problem, it may keep the problem from recurring "until Apache is restarted".
Regards
Peter Kwan |
Re: Contention issues with AddLegend Method |
Posted by Ben on Jan-12-2012 04:35 |
|
Peter,
We are using Apache in a Windows environment along with mod_perl. Expanding on Todd's original post, this "unknown method" error appears to only occur when calling inherited methods. For example, once "unknown method XYChart.addLegend" occurs, any call to a method in the BaseChart package will result in an "unknown method" error. Methods defined in the XYChart package, such as XYChart->new(), continue to work.
Thanks
Ben |
Re: Contention issues with AddLegend Method |
Posted by Peter Kwan on Jan-13-2012 03:04 |
|
Hi Ben,
In ChartDirector for Perl, when a method like XYChart.addLegend is called, ChartDirector will first check if the addLegend method exists in XYChart. If not, it will check its superclass or superclasses for the method. It will return "unknown method" if it cannot find the method.
The error pattern you mention can occur if the superclass table is corrupted (that is, ChartDirector cannot locate the superclass for XYChart).
I still do not know why the memory can be corrupted. My developer has told me he compile a modified DLL to you that contains more checking in the code, and can produce more detail error message to help the diagnostics. If you would like to try this method, please inform me if you are using native 64-bit Perl on 64 bit Windows or 32 bit Perl.
Regards
Peter Kwan |
Re: Contention issues with AddLegend Method |
Posted by Ben on Jan-13-2012 03:44 |
|
Peter,
We are using 32 bit Perl and would be interested in trying the modified DLL.
Thanks
Ben |
Re: Contention issues with AddLegend Method |
Posted by Peter Kwan on Jan-14-2012 02:59 |
|
Hi Ben,
I have just uploaded the modified "chartdir.dll" to:
http://www.advsofteng.com/cd_win32_503p5.zip
Please try to use this DLL to replace your existing "chartdir.dll" to see if you can reproduce the problem and obtain more detail error messages. Make sure you are replacing the "chartdir.dll" that your web server is actually using.
It is common for people to copy the "chartdir.dll" to multiple directories. If you are not sure which "chartdir.dll" is being used by your server, the safe way is to replace all of them. Also, note that on Windows, you may be unable to replace a DLL that is in use (Windows may "lock" the DLL). Even if you can replace it, it may not take effect until the process that uses the DLL terminates. (In your case, as you are using mod_perl, the Perl will not terminate until Apache terminates. It means you may need to restart the Apache server.)
Regards
Peter Kwan |
|