vradarserver / vrs

A .NET web server that can plot the positions of aircraft on a map
http://www.virtualradarserver.co.uk/
Other
275 stars 50 forks source link

Aircraft flags and silhouettes not showing OSx Catalina with correct path.....may have to do with HiDpi? #40

Closed 96jtaylor closed 3 years ago

96jtaylor commented 3 years ago

I tried the VRS stable release and the preview release and it is the same. Image folders are populated and path is correct but images will not show. I noticed when I copy image address and paste it has the /HiDpi/ path and it does not show, but if I remove the /HiDpi/ it works. Any suggestions?

vradarserver commented 3 years ago

Unfortunately Catalina won't install on my ageing MBP so I can't try it out... but my recollection of the HiDpi stuff was that it just tells the server to send a double-sized image. Which browser are you using? Are you getting any messages in the browser's console (usually accessed by pressing F12) when the images don't appear?

96jtaylor commented 3 years ago

I am using Chrome. Attached is a picture of the console message. Also, it seems to be able to find the image but it just shows up as blank. See attached.

Screen Shot 2021-02-20 at 4 23 21 PM Screen Shot 2021-02-20 at 4 21 04 PM
vradarserver commented 3 years ago

The warning message is for a Chrome extension that you have installed, it's not related to VRS.

You can get a blank image sent back if there isn't a suitable silhouette or operator flag, e.g. if you don't have either A20N.bmp or 4ACAA1.bmp in the silhouettes folder. However, if that were the case then removing the hidpi part of the URL wouldn't make a difference, you'd just get a smaller (85x20) blank returned. My guess is that there's something going on when VRS tries to double-up the size of the image in memory before sending it to the browser.

Could you attach your A20N.bmp image to the issue please? I'll see if I can reproduce the problem here.

96jtaylor commented 3 years ago

I actually don't think I had an A20N image but the problem remains with images I do have. See attached for FINE190

Screen Shot 2021-02-20 at 5 19 53 PM

FIN.bmp.zip E190.bmp.zip

96jtaylor commented 3 years ago

I think you may be on to something with the doubling because I downloaded the pictures in 85x20 but it's reporting them in 170x40. I don't know if that can make it so they do not appear.

vradarserver commented 3 years ago

The files that you attached don't match up with what the site is looking for. It's trying to find FINE190.bmp or 461E14.bmp.

I'm guessing that you have FINE190 in the operator code field for the aircraft? VRS is expecting to see three character ICAO operator codes in that field, FINE190 isn't a valid operator code. I think you'd need to set the operator code to FIN and the model code to E190, after which you should have the FIN flag in the operator flag column and the E190 silhouette in the silhouette column.

The HiDpi part of the URL path is responsible for the image getting doubled-up. By default the flags are 85x20, the HiDpi in the URL tells the server to load the image and double its width and height before returning it to the site. The site then draws the doubled-up image in a normal-sized space (85x20 in this case). This was to counteract an issue on high resolution devices where images could appear blurry. It was done a long time ago, TBH I'd forgotten that it was there. It has no effect on the loading of the image, it's just an instruction to the server to switch on the image size doubling.

96jtaylor commented 3 years ago

I see what you mean but still. SASA20N does not load and I have it.

Screen Shot 2021-02-20 at 5 57 43 PM

SASA20N.bmp.zip

96jtaylor commented 3 years ago

This is what I mean when I say deleting the /HiDpi in the image address works. Also how I know it can pull the image from the folder but something goes wrong before it displays on the site.

Screen Shot 2021-02-20 at 7 20 02 PM Screen Shot 2021-02-20 at 7 20 16 PM
vradarserver commented 3 years ago

Could you open a terminal and do mono -V and report back on the version of mono that's installed please?

96jtaylor commented 3 years ago

Mono JIT compiler version 6.12.0.123

ger-pakon commented 3 years ago

Hey,

I'm facing the same issue under Ubuntu 20.04.

    mono --version
    Mono JIT compiler version 6.8.0.105 (Debian 6.8.0.105+dfsg-2 Wed Feb 26 23:23:50 UTC 2020)
    Copyright (C) 2002-2014 Novell, Inc, Xamarin Inc and Contributors. www.mono-project.com
    TLS: __thread
    SIGSEGV: altstack
    Notifications: epoll
    Architecture: amd64
    Disabled: none
    Misc: softdebug
    Interpreter: yes
    LLVM: supported, not enabled.
    Suspend: hybrid
    GC: sgen (concurrent by default)
vradarserver commented 3 years ago

When you say it's the same issue are you getting the image if you remove the HiDpi portion of the link?

ger-pakon commented 3 years ago

@vradarserver yes, that's what i mean. I currently switched to svg, so I can see at least the aircrafts.

Is there anything I/we can provide to you to fix this error?

/Edit:

I think, this is also related: https://github.com/vradarserver/vrs/issues/25

Thanks in advance, Pakon

96jtaylor commented 3 years ago

Glad I am not the only one. It also seems to appear here https://forum.virtualradarserver.co.uk/viewtopic.php?t=2034 on the VRS forum. I see @ger-pakon posted there as well. I also switched to the 3.0.0 preview for the SVG support but I had the same problems in 2.4.4. Like Pakon at least now I have markers.

ger-pakon commented 3 years ago

@vradarserver can you disable HiDpi for mono? Or is it not possible to determine the .NET evironment? May another suggestion is to let it disable for ourselves in the configuration!?

The svg is a workaround, but I'cant see any picture (set by the custom content plugin) or in the mobile view the arrow to switch to the aircraft list.

Thanks and cheers, Pakon

ger-pakon commented 3 years ago

Hey,

just for your Information. I tried it with an older ubuntu on a pc with a lower resolution. In this case, the marker and silhouettes are working, again. The generated URL was without HiDpi.

Thanks, Pakon

vradarserver commented 3 years ago

@ger-pakon The hidpi switch really isn't doing anything taxing, it's just resizing the image. Mono doesn't have its own graphics handling as far as I'm aware, I think it calls down to Linux libraries, so there could be an issue there. However, one of the changes that will have to be made to version 3 before I can ditch Mono and compile for Microsoft's preferred alternative, DotNet Core, is I need to switch to a standalone graphics library because DNC doesn't have support for cross-platform drawing. I have a test implementation of that in one of the branches, if the worst comes to the worst and it turns out that it's a Mono issue then I can implement that a bit sooner than I was intending.

When I get a bit of free time I'll take a look at forcing the hidpi switch on with Ubuntu 20.04 and see if I can reproduce it.

ger-pakon commented 3 years ago

If I can support you in any case, just let me know...

vradarserver commented 3 years ago

OK - I can get this to fail under Ubuntu 18.04 by just updating to 18.04.5. This updated Mono (among other things) and after the update no images are showing under version 2 regardless of the hidpi flag. This means that the hidpi problem might be something else, but there is a fundamental issue with some versions of Mono. The version of Mono that I updated to is 6.12.0.107.

The issue appears to be that System.Drawing.Image.Clone isn't returning a copy of the image. VRS starts by cloning of all of its stock images and every image, regardless of whether it was built from a clone or not, is cloned before it is returned to the browser in a web request. If Clone doesn't work then it will affect all images.

I have written a workaround for Image.Clone that seems to work but I'm not sure of the performance implications yet. Unfortunately I've run out of time but hopefully this coming week I should have something in preview for people to try.

vradarserver commented 3 years ago

I've released the 2.4.5-preview-5 and 3.0.0-preview-5 previews that fix the issue on my local Ubuntu 18.0.5. Let me know if you still see the problem with one of those installed.

Also I have no idea whether this will fix the original hidpi thing :) It should, hopefully. I think the issues were down to VRS calling System.Drawing from multiple threads - I was making an effort in various places to use it single-threaded but there wasn't any choke point in the system where single-threaded access could be enforced. This change introduces a single point through which all System.Drawing calls must pass and it enforces single threading, so any weirdness arising from multi-threaded calls to GDI+ in Windows or libcairo in Mono should now be resolved.

V2: fd5ad82 V3: 3ceb772

96jtaylor commented 3 years ago

@vradarserver Now working perfect with preview 5 on Mas OSx Catalina! Thanks for your help!

ger-pakon commented 3 years ago

Hey @vradarserver, also works fine for me! Thank you very much!