-
-
Notifications
You must be signed in to change notification settings - Fork 364
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Labeling - Compressed Label Overwrite #4581
Comments
|
You say that it is random, but when it happens, could you capture the GetMap URL (with firebug or other) and confirm that a given GetMap URL always reproduces the issue? That would get us closer to producing a testcase to reproduce the issue which is really what we need in order to troubleshoot this. |
|
Daniel, I have captured the following url using Firebug: This above url was causing the problem labels; not all labels but a significant number. When I viewed the url in a browser on it's own, it repeatedly showed the problem labels. I restarted my laptop and tried out the url and all was working well i.e. no problem labels. I am thinking that the problem labels appear only after a great number of requests; maybe > 50 or 60 or more. That's anecdotal as I cannot replicate this absolutely. Regards, Donald |
|
Based on the info we have so far, that could be a side-effect of some kind of memory/buffer corruption/management problem. The best way to verify this would be to run this same request under Valgrind (valgrind.org). Even if the problem is intermittent, Valgrind would tell us if there is a memory management issue. Unfortunately Valgrind is only available on Linux. Do you have access to a Linux box to install your data, mapfile, symbolset/fontset and run this same request under Valgrind? (I can provide advice to use Valgrind if needed) |
|
Thanks, Daniel. That was all sounding great until you said Linux only :( I will see what I can do about a Valgrind alternative or maybe a virtual Linux install on my Windows (spit) laptop. Will get back to you. Thanks. Regards, Donald |
|
I was going to suggest you send me a testcase, but since the data source is ODBC that makes it harder to port it. Actually, are you able to test using a shapefile as data source instead of ODBC? Just to rule out the (likely) possibility of the problem coming from the ODBC driver or its support libs causing some kind of memory corruption. |
|
I'll see what I can do. Will look at it shortly as I need to pop out. I've found this which may help as an alternative to Valgrind: http://code.google.com/p/drmemory/ Will also try to look at porting to shapefile to see if the problem can be replicated with that as data source. |
|
I had never heard of Dr.Memory but would love to hear your feedback once you try it |
|
No joy for me with Dr Memory - Ran the following with IE, Firefox and Chrome but never got any mention of Mapserver related dlls: drmemory.exe -- "C:\Program Files\Internet Explorer\iexplore.exe" "http://maps1/cgi-bin/mapserv. Not sure where to go from here. I'll see what I can do about converting the MS Access data to shapfile though I'm not sure that's going to be easy. |
|
The command above runs and tests the internet explorer process. We need to run it on mapserv.exe. Please try the following command: FYI the QUERY_STRING=... arg is a special hook for debugging MapServer at the command-line. |
|
Thanks, Daniel. Here's the results of the above: http://www.dkerr.co.uk/DrMemory-mapserv.exe.5720.zip Regards, Donald |
|
Ouch! Lots of uninitialized reads, that's scary! Many seem to come from initialization of underlying libs on which MapServer has no control so MapServer itself cannot be the direct cause of all of them for sure. This makes me wonder if Dr.Memory is giving false positives or just too picky. I do however see several errors related to reading ODBC data so we cannot completely rule out the possibility of your problem being related to the OGR ODBC driver (or its support libs). I'm not sure what to suggest at this point... it would be interesting if one of the MapServer devs on Windows could run regular MapServer requests under Dr. Memory and see if those issues are real or not... and fix them if they are. This may not be a small task though. BTW, is your server setup with FastCGI? Maybe a way to work around your issue would be to disable FastCGI if it was enabled? (But that's not a real fix I agree) |
|
There's a bit about Dr. memory uninitialized reads here: http://www.drmemory.org/docs/page_uninit.html - This is way out my comfort zone! OGR ODBC may well be the cause of the labelling problem and I will work on a test (shapefile) that will hopefully eliminate that as soon as I can. Having said that, and having studied the rendered labels, it does look like some are being drawn with some overwrite rather than characters always being missing; to me, this would imply that the problem may be related to when the string is rendered rather than an incorrect string being returned to Mapserver for rendering. The above image examples show missing characters only which could mean that an incorrect string is being returned. The video in the above link shows an example of a label with overwrite rather than characters missing, I do have FastCGI running with IIS 5.1 and this is pretty much essential for an end to end system that's at all useable. I could not turn that off. I'm not sure how that would affect the labelling problem. |
|
We can discount ODBC as being the issue as I can confirm that I am also getting this in a PostgreSQL layer. See images below: Relevant part of map file: One other point to note is that the above images are from a Windows Server 2003 installation whilst all other sample images further above are from a Windows XP SP3 installation. Both MS4W 6.2-beta4). |
|
I'd be tempted to say that it's good news that it is not specific to ODBC and that it happens on another system. The next step would be to package a small test case for a dev to reproduce it. |
|
I have put together a test setup and I've made it available here: SAMPLE REMOVED AND REPLACED SEE NEXT MESSAGE. This has data contained in a shapefile rather than a PostGIS table; the former is an export from the latter. There's some info in ReadMe.txt about setting up the demo. Basically, the file MyMap.htm will reload a map image every second until it breaks. Unfortunately, or maybe fortunately, it has only broken and produced a compressed label, as described in this thread, once today despite me running this for a few hours. There's a stop button on the htm page that will stop the image refresh should a faulty label appear. |
|
I have removed the above test setup and replaced it with this one: http://www.dkerr.co.uk/MyMapV2.zip (538K). This falls over for me very quickly i.e. within a minute and shows the label overwrite consistently. Look for a label coming in from the top. It should say "Standing Stone". There's another label that comes in from the right. This should say "Rocks". If you leave it to cycle round for a few times, the labels will materialise in various forms (including correctly displayed). |
|
Donald, /Umberto |
|
Umberto, I capture the following request but when I post it in another browser, it renders as it should do i.e. no compressed labels; even with multiple F5 refreshes. This is the exact same WMS request that showed faulty labels. Regards, Donald |
|
I have narrowed down the problem a good bit. I have the following OUTPUTFORMAT statement in my map file. This uses CAIRO to render output. If I change CAIRO to AGG then I DO NOT get the label overwrite problem. Is this a CAIRO bug? I've tried commenting out some of the options like FORMATOPTION AND TRANSPARENT to no avail. |
|
Just to say that I have FONTSET "osfonts.txt" in the map file. The file osfonts.txt contains: "arial arial.ttf" (no quotes). I have changed this physical file (arial.ttf) to another TTF and the problem persists thus eliminating the font file. |
|
@DonaldKerr I will grab your test case and try in a new Cairo build. Is the test case here? http://www.dkerr.co.uk/MyMapV2.zip |
|
Yes, Jeff. Try with the old Cairo first to ensure that you can see the issue. For me, if falls over almost within the first few image creations using MyMap.htm (in the zip file) which requests a new image every second. If I change "CAIRO/PNG" to "AGG/PNG" in the map file live whilst MyMap.htm is requesting images, it goes from creating bad labels to creating good labels and vice versa. Many thanks. Regards, Donald |
|
@DonaldKerr I've tried with the old Cairo in MS4W. Here are my commands: I don't see any problems. Unfortunately I must run now so I cannot test your full application. |
|
Thanks for looking at that Jeff. All looks as it should. I suggest that you try to set up MyMap.htm which requests images once every second. Within a few images it falls over. There is definitely a repeatable problem. Many thanks. Regards, Donald |
|
@DonaldKerr I just ran this command (it will create 100 pngs). Give it a try. I don't see any changes in the results. When I get time I will configure you application. I wish I was cloned right now :) Until I'm cloned, try reproducing your problem with that script, through mapserv or shp2img calls. |
|
I'll give that a go right now and will post back. The only difference is that my htm page changes the BBOX values very slightly for each call below: Each time the image is refreshed, this is done to change the BBOX slightly and to move the image on the htm page so that the viewer can actually see something happening: |
|
Jeff, The following is a Windows batch file (save as test.bat): This basically replicates what I'm doing with the html test file (MyMap.htm) by changing the BBOX (or MAPEXT as this is mapserv CGI). However, this DOES NOT replicate the issue and all images are created correctly. The WMS request, as per the MyMap.htm example, DOES replicate the issue. So, I still think this is maybe a Cairo related problem but when called via a WMS: When I change CAIRO to AGG in the map file it starts working. Maybe it's a WMS related issue when coupled with Cairo. |
|
Here is a test example that shows the error both with CGI and WMS calls using Mapserver's built-in OpenLayers viewer. Download and extract the following file: http://www.dkerr.co.uk/MyMapV3.zip (269K). You will need to edit my.map and replace "D:\MyMap", "D:\MyMap" and "d:/MyMap" with the loction to which you've extracted the example. There are some changes to my.map that makes it different from MyMapV2.zip (above) so don't mix up the example files. To replicate the issue, enter one or other of the above urls into a browser. Zoom in four times then drag the map about. You should see the compressed labels with both the CGI and WMS calls. Change DRIVER "CAIRO/PNG" to DRIVER "AGG/PNG" in the OUTPUTFORMAT section of the map file and the issue goes away. N.B. I had to use double-backslashes for my map file location in the urls above when pasted into a browser address bar.. |
|
Guys, I believe this will be reproducible only with FastCGI... so it is normal that a loop of calls to mapserv.exe from a script or command window doesn't reproduce it. |
|
Further information: I have both IIS and Apache (on port 81) set up; both use FastCGI. I tested the example in the previous post in Apache by adding ":81" to the url e.g. "http://localhost:81/cgi-bin/..." and the issue DOES NOT appear i.e. labels are drawn correctly. I turned off FastCGI in IIS and again, the issue DOES NOT appear. The version of IIS on this machine is 5.1 (Win XP SP3) but the same thing is happening with IIS 7 (Server 2003) on another machine that I can access. So, this issue appears to involve FastCGI in IIS (@dmorissette - you had previously suggested disabling FastCGI) though turning off FastCGI is not an option. The combination of Cairo and IIS FastCGI appears to consistently cause this problem. |
|
Since the issue would apparently involve IIS FastCGI specifically (i.e. not reproducible with Apache+FastCGI), then I'll step out of this ticket for now and let other Windows devs look into it. My short term fix would be "use Apache" ;-) but I realize that this is not an option for everyone. @DonaldKerr, it may be fair at this point to contract with one of the Windows devs to work on this if this issue is really important to you. |
|
Thanks for your input, Daniel. Much as I would love to, I cannot use Apache in these circumstances. This still appears to be a CAIRO, IIS and FastCGI issue. In the meantime, I've changed the map file thus: i.e. I'm using AGG instead of CAIRO until this is resolved. Many thanks. Regards, Donald |
|
Entertaining ticket to read. @DonaldKerr , have you tried if current versions of Mapserver, IIS, and Cairo show the same issue? |
|
Thank you. I haven't carried out any recent development as I have changed jobs and no longer support or develop the system in question. I might revisit this in the future as I may look at developing a replacement system on a commercial basis. |
|
closing now as label handling has been rewritten for mapserver 7.0 |






For some time, and with various Mapserver versions (currently, I'm using MS4W 6.2-beta4 ), I am getting a strange compressed label overwrite as demonstrated in the following video file (5Mb): http://www.dkerr.co.uk/LabelIssue.wmv
Apologies for the file size but a video seems like the best way to demonstrate the issue.
It appears to be completely random in that the label will be written correctly most times but will then, for no apparent reason, will appear to compress and overwrite.
Here is the layer definition:
Is there a problem with the LABEL part of the above layer definition or is this a bug?
Some sample images (screenshots):
Correct display of the label:

Incorrect display of the label:

The above labels are multiline with WRAP using the "|" character. This is also a problem with single line (non-wrapped) labels as shown in the video link above and the examples below.
Correct display of the label:

Incorrect display of the label:

Many thanks.
Regards,
Donald
The text was updated successfully, but these errors were encountered: