Skip to content
This repository has been archived by the owner on Jul 24, 2021. It is now read-only.

Crash when using TMS tiles #2316

Closed
openstreetmap-trac opened this issue Jul 23, 2021 · 8 comments
Closed

Crash when using TMS tiles #2316

openstreetmap-trac opened this issue Jul 23, 2021 · 8 comments

Comments

@openstreetmap-trac
Copy link

Reporter: tom_verbeure[at]yahoo.com
[Submitted to the original trac issue database at 12.47pm, Friday, 25th September 2009]

Configuration: Mac, version 0.14, compiled from source
QT: 4.5.1

When you specify a wrongly configured TMS server and then zoom in/zoom out to the same point (or move around the map etc), Merkaartor will crash as follows:

Program received signal EXC_BAD_ACCESS, Could not access memory.
Reason: KERN_PROTECTION_FAILURE at address: 0x00000004
0x034e0b80 in QCoreApplication::notifyInternal ()

> bt
#0  0x034e0b80 in QCoreApplication::notifyInternal ()
#1  0x0294a31a in qt_mac_socket_callback ()
#2  0x9709c6f0 in __CFSocketDoCallback ()
#3  0x9709dd35 in __CFSocketPerformV0 ()
#4  0x970933c5 in CFRunLoopRunSpecific ()
#5  0x97093aa8 in CFRunLoopRunInMode ()
#6  0x0294a760 in QEventDispatcherMac::processEvents ()
#7  0x034e0151 in QEventLoop::processEvents ()
#8  0x034e02fd in QEventLoop::exec ()
#9  0x034e414e in QCoreApplication::exec ()
#10 0x001ca547 in main (argc=1, argv=0xbffff03c) at Main.cpp:201

The TMS server configuration was: localhost with some bogus path parameters

The local server running was simply a freshly created rails application with no changes whatsoever that was started as ./scripts/server -p 80

@openstreetmap-trac
Copy link
Author

Author: tom_verbeure[at]yahoo.com
[Added to the original trac issue at 5.16pm, Saturday, 26th September 2009]

This crash also happens in Windows on the released 0.14 binary.

@openstreetmap-trac
Copy link
Author

Author: tom_verbeure[at]yahoo.com
[Added to the original trac issue at 7.21am, Tuesday, 29th September 2009]

I spent two full battery chargers of my laptop to track this one down, but without much success.

However, I did find a couple of things that are fishy in the current code:

  • According to the QHttp documentation, setProxy needs to come before setHost.

  • The number of inflight requests could easily exceed the number given by MAX_REQ in the case of errors because requestFinished for setProxy and setHost weren't filtered out up front.

  • 404 errors weren't treated at all. As a result, QPixmap would try to parse the HTML of the 404 request.

See patch.txt for the (trivial) fixes.

I have further questions about the code:

  • in my compiled version, QT is not set to threaded, so it doesn't matter, but the code is using vectorMutex.tryLock() instead of vectorMutex.lock(). In the context of where it is used, that doesn't seem to make a lot of sense, but maybe I'm missing something?

  • Overall, when a TMS layer is selected upon startup, merkaartor will always ask for some bogus tile first, presumably because MapView doesn't have its layout setup yet at startup. So, I'm always seeing it requesting tile 9/256/256.png and such.

Also, coming back to the real problem of this bug: I tried putting a spelling mistake in on of the existing entires and then I'm never seeing a crash! Could it be that this bug ONLY happens when dealing with localhost ?

@openstreetmap-trac
Copy link
Author

Author: Koying
[Added to the original trac issue at 9.21am, Tuesday, 29th September 2009]

Thanks for your effort.

I've not much availability for Merkaartor right now, unfortunately...

Re:

  • vectorMutex: This is legacy code; Never understood myself but prefered not to touch it, either.

  • MapView: Yeah, I know. There is some race condition between the loading of initial tiles and the restore of the windows size/postion (which imply a change in the viewport). Never quite succeeded to get it right...

  • The main bug: The strange thing is that it doesn't crash in Merkaartor code, nor in code called by Merkaartor...
    Could it be a Qt/Mac bug in socket handling?

@openstreetmap-trac
Copy link
Author

Author: koying
[Added to the original trac issue at 9.38am, Tuesday, 29th September 2009]

(In [17843]) FIX : Tiles network patch by Tom Verbeure (refs #2316)

@openstreetmap-trac
Copy link
Author

Author: tom_verbeure[at]yahoo.com
[Added to the original trac issue at 12.09pm, Tuesday, 29th September 2009]

I see the same crashing problem in the currently released 0.14 binary when I run it in on Windows XP (in a Vmware Fusion virtual machine). It looks like it's crashing in code related to the signals/slots dispatcher. Running a tile server on localhost is obviously an obscure use case... I'm going to look into it a bit more.

@openstreetmap-trac
Copy link
Author

Author: tom_verbeure[at]yahoo.com
[Added to the original trac issue at 1.15pm, Tuesday, 29th September 2009]

After compiling to a debug version from source of Qt 4.5.2, I tracked this down to line 268 of src/gui/kernel/qeventdispatcher_mac.mm.

Guess, what, there was a patch for that in Qt two months ago! [http://qt.gitorious.com/qt/qt/commit/84abdaa41e6c3bde6ac653e02bd72300b6681572?diffmode=sidebyside]

I patched just that in Qt 4.5.2 and the crash behavior has gone.

The crash that I'm seeing in Windows XP may be something else? I can't check because I don't have a development environment for that...

In any case, I believe this bug can be closed...

@openstreetmap-trac
Copy link
Author

Author: tom_verbeure[at]yahoo.com
[Added to the original trac issue at 1.40pm, Tuesday, 29th September 2009]

Final comment: this probably doesn't crash on Windows after all. The crash on Windows is probably due to bug 2317...

@openstreetmap-trac
Copy link
Author

Author: Koying
[Added to the original trac issue at 1.51pm, Tuesday, 29th September 2009]

Thanks for your investigations...

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

1 participant