[SailfishDevel] GPS not turned off if app exits without stopping the GPS

Marcel marcel at aliquis.de
Mon Jan 13 23:01:40 UTC 2014


Hi all,

my app is far away from being a test object ;) I've just created the C++ 
source to check if it is giving me two different accuracies (vertical and 
horizontal) and I never removed it. But if that found a bug, I'm glad that I 
could help... :D

Sorry to be slightly offtoppic, but a small question on this: what would be 
the best practice then if I would need the position in QML and in C++, or in 
two different pages in QML? Shouldn't I use two PositionSources? I have this 
problem for my app if I want to show the position in the app cover...

And as you can see in the archive page, all your mails have gone to the 
mailing list, the one you've forgotten the CC you had added it to the To 
field.

Greets,
Marcel

Am Montag, 13. Januar 2014 schrieb christopher.lamb at thurweb.ch:
> Hi Aaron and Marcel
> 
> this evening I have done the following battery of tests on my Jolla  
> taking input from Aaron.
> 
> As test GPS-consuming-apps I used:
> 
> a) Maps (as suggested by Aaron)
> b) Marcel's GPSInfo app very kindly posted to  
> https://github.com/balta3/sailfish-gpsinfo
> c) My semi-ported landed25_QT5 app
> 
> More on b) and C) later.
> 
> These are the steps I ran. The arrow symbol --> indicates the result  
> of the test on the line immediately above.
> 
> 
> 1) pkcon install qt5-qttools-qdbus
> 
> 2) Shutdown, waited 5 minutes, restarted Jolla
> 
> 3) connected via ssh as memo
> 
> 4) /usr/lib/qt5/bin/qdbus org.freedesktop.Geoclue.Master | grep  
> '/org/freedesktop/Geoclue/Master/client' | wc -l
> 
> --> 0
> 
> 5) started Maps
> 
> 6) /usr/lib/qt5/bin/qdbus org.freedesktop.Geoclue.Master | grep  
> '/org/freedesktop/Geoclue/Master/client' | wc -l
> 
> --> 1
> 
> 7) pkill -9 sailfish-maps
> 
> 8) /usr/lib/qt5/bin/qdbus org.freedesktop.Geoclue.Master | grep  
> '/org/freedesktop/Geoclue/Master/client' | wc -l
> 
> --> 0
> 
> 9) ps aux | grep geoclue
> 
> -->
> nemo      2003  0.0  0.3   7616  2708 ?        S    22:01   0:00  
> /usr/libexec/geoclue-master
> nemo      2201  0.0  0.1   5912   856 pts/0    S+   22:06   0:00 grep 
geoclue
> 
> 10) pgrep -l geoclue
> 
> -->
> 2003 geoclue-master
> 
> Additional note: GPS icon gone.
> 
> 11) restarted maps
> 
> 12) grep -l geoclue
> 
> -->
> 2003 geoclue-master
> 2438 geoclue-hybris
> 2445 geoclue-here
> 
> 
> 13) killed maps by down-swipe
> 
> 14) rerun step 12) x 4
> 
> --> first 3 runs give output as step 12
> run 4 (within 30 secs) gives
> 
> -->
> 2003 geoclue-master
> 
> Additional note: GPS icon gone.
> 
> 15) Shutdown, waited, restarted, reconnected as nemo via ssh
> 
> 16) /usr/lib/qt5/bin/qdbus org.freedesktop.Geoclue.Master | grep  
> '/org/freedesktop/Geoclue/Master/client' | wc -l
> 
> -->
> 
> 
> 17) started app GPSInfo
> 
> 18) /usr/lib/qt5/bin/qdbus org.freedesktop.Geoclue.Master | grep  
> '/org/freedesktop/Geoclue/Master/client' | wc -l
> 
> -->
> 2
> 
> 19) pgrep -l geoclue
> 
> -->
> 1798 geoclue-master
> 1841 geoclue-hybris
> 1847 geoclue-here
> 
> 20) pkill GPSInfo
> 
> 21) pgrep -l geoclue
> 
> -->
> 1798 geoclue-master
> 1841 geoclue-hybris
> 1847 geoclue-here
> 
> 22) /usr/lib/qt5/bin/qdbus org.freedesktop.Geoclue.Master | grep  
> '/org/freedesktop/Geoclue/Master/client' | wc -l
> 
> -->
> 1
> 
> 23) Steps 21) and 22) repeated X times over many minutes, same result,  
> also GPS Icon still shown.
> 
> 24) Shutdown, waited, restarted, reconnected as nemo via ssh
> 
> 25) started landed25_QT5
> 
> 26) /usr/lib/qt5/bin/qdbus org.freedesktop.Geoclue.Master | grep  
> '/org/freedesktop/Geoclue/Master/client' | wc -l
> 
> -->
> 1
> 
> 27) killed landed25_QT5 manually
> 
> 28) /usr/lib/qt5/bin/qdbus org.freedesktop.Geoclue.Master | grep  
> '/org/freedesktop/Geoclue/Master/client' | wc -l
> 
> -->
> 
> 
> Conclusions:
> 
> The symptoms I reported (GPS stays running after app exits) appears to  
> be limited to Marcel's app GPSInfo (sorry Marcel), or perhaps the way  
> Sailfish handles his app.
> 
> So what does Marcel's app do differently?
> 
> His app was the only one that gave an answer of 2 to  
> "/usr/lib/qt5/bin/qdbus org.freedesktop.Geoclue.Master | grep  
> '/org/freedesktop/Geoclue/Master/client' | wc -l"
> 
> So why 2?
> 
> Well it turns out that Marcel has 2 PositionSources in his code, one  
> in C++, and one in QML, and only one of these is properly cleaned up  
> when the app is killed. One the one-hand the app probably should not  
> have 2 PositionSources, but maybe the OS should still be able to  
> handle this?
> 
> Thanks for your time
> 
> Chris
> 
> p.s, @Marcel, as you was kind enough to post me your code when I was  
> kicking and screaming about a possible bug, I have purposely not cced  
> this to the mailing list, but if you want to forward it there for the  
> benefit of others, I have no objections 8-)
> 
> p.p.s all tests above using 1.0.2.5, I had to resist the temptation to  
> accept the upgrade halfway through. Now about to upgrade ?.
> 
> 
> 
> 
> 
> Zitat von "Aaron McCarthy" <aaron.mccarthy at jolla.com>:
> 
> > Hi,
> >
> > On Mon, 13 Jan 2014 08:11:05 christopher.lamb at thurweb.ch wrote:
> >> I will call this a behaviour for the moment. Yesterday I noticed that
> >> if an app that uses the GPS exits without stopping the GPS, then the
> >> GPS remains running on the Jolla.
> >
> > How did you confirm this? Presence of the Location icon on the lock 
screen?
> >
> >> I compared this to my Nokia N9. On that device if an app using the GPS
> >> exits (e.g. the user closes it), then the GPS stops soon after that
> >> app has exited (even if the app does not explicitly shut the GPS down).
> >>
> >> On the N9 this even works with multiple apps open using the GPS. In
> >> this test, when the last GPS-consuming app exits, the GPS shuts down.
> >
> > This is expected to work. Both the Geoclue master and the provider 
processes
> > monitor DBus disconnections and will clean up any associated interfaces. 
The
> > provider processes will then close 30 seconds after there are no more
> > connections.
> >
> > How to test that geoclue-master is working:
> >
> > Run
> >
> > /usr/lib/qt5/bin/qdbus org.freedesktop.Geoclue.Master | grep
> > '/org/freedesktop/Geoclue/Master/client' | wc -l
> >
> > to see how many processes have started positioning.
> >
> > Run the above command, expect 0
> > Run sailfish-maps
> > Run the above command, expect 1
> > pkill -9 sailfish-maps
> > Run the above command, expect 0
> >
> > It is harder to test this functionality in the providers as the number of
> > connections are not readily available.
> >
> > Can you check whether there are any client interfaces exported by geoclue-
> > master with the above command. Also what geoclue processes are  
> > running (ps aux
> > | grep geoclue).
> >
> > Cheers,
> >
> > --
> > Aaron McCarthy
> > _______________________________________________
> > SailfishOS.org Devel mailing list
> >
> 
> 
> 


More information about the Devel mailing list