[SailfishDevel] Keeping background process running in Sailfish OS

2015-05-02 Thread Taixzo
I notice that Sailfish tends to close all running applications when some limit 
of RAM or CPU is reached. Is there a way to make an app launch a daemon process 
that does not get killed by this?


--
Sent from Whiteout Mail - https://whiteout.io

My PGP key: https://keys.whiteout.io/tai...@gmail.com

pgp1GXoTIb6Iw.pgp
Description: PGP signature
___
SailfishOS.org Devel mailing list
To unsubscribe, please send a mail to devel-unsubscr...@lists.sailfishos.org

Re: [SailfishDevel] Keeping background process running in Sailfish OS

2015-05-03 Thread E.S. Rosenberg
I think it's the regular linux OOM killer, in general it doesn't kill
everything but it will/should kill up to the point that enough RAM was
freed to regain system stability...
So if your deamon has a very small RAM footprint the chance it will get
killed is much lower then if it's a RAM hog...

HTH,
Eli

2015-05-03 8:08 GMT+03:00 Taixzo :

> I notice that Sailfish tends to close all running applications when some
> limit of RAM or CPU is reached. Is there a way to make an app launch a
> daemon process that does not get killed by this?
>
>
> --
> Sent from Whiteout Mail - https://whiteout.io
>
> My PGP key: https://keys.whiteout.io/tai...@gmail.com
> ___
> SailfishOS.org Devel mailing list
> To unsubscribe, please send a mail to
> devel-unsubscr...@lists.sailfishos.org
>
___
SailfishOS.org Devel mailing list
To unsubscribe, please send a mail to devel-unsubscr...@lists.sailfishos.org

Re: [SailfishDevel] Keeping background process running in Sailfish OS

2015-05-03 Thread E.S. Rosenberg
This may also help:
http://unix.stackexchange.com/questions/153585/how-oom-killer-decides-which-process-to-kill-first

2015-05-03 11:39 GMT+03:00 E.S. Rosenberg <
es.rosenberg+sailfishos@gmail.com>:

> I think it's the regular linux OOM killer, in general it doesn't kill
> everything but it will/should kill up to the point that enough RAM was
> freed to regain system stability...
> So if your deamon has a very small RAM footprint the chance it will get
> killed is much lower then if it's a RAM hog...
>
> HTH,
> Eli
>
> 2015-05-03 8:08 GMT+03:00 Taixzo :
>
>> I notice that Sailfish tends to close all running applications when some
>> limit of RAM or CPU is reached. Is there a way to make an app launch a
>> daemon process that does not get killed by this?
>>
>>
>> --
>> Sent from Whiteout Mail - https://whiteout.io
>>
>> My PGP key: https://keys.whiteout.io/tai...@gmail.com
>> ___
>> SailfishOS.org Devel mailing list
>> To unsubscribe, please send a mail to
>> devel-unsubscr...@lists.sailfishos.org
>>
>
>
___
SailfishOS.org Devel mailing list
To unsubscribe, please send a mail to devel-unsubscr...@lists.sailfishos.org

Re: [SailfishDevel] Keeping background process running in Sailfish OS

2015-05-03 Thread Andrey Kozhevnikov

afaik it only closing propcesses with windows, no?

03.05.2015 10:08, Taixzo пишет:

I notice that Sailfish tends to close all running applications when some limit 
of RAM or CPU is reached. Is there a way to make an app launch a daemon process 
that does not get killed by this?


--
Sent from Whiteout Mail - https://whiteout.io

My PGP key: https://keys.whiteout.io/tai...@gmail.com


___
SailfishOS.org Devel mailing list
To unsubscribe, please send a mail to devel-unsubscr...@lists.sailfishos.org


___
SailfishOS.org Devel mailing list
To unsubscribe, please send a mail to devel-unsubscr...@lists.sailfishos.org

Re: [SailfishDevel] Keeping background process running in Sailfish OS

2015-05-03 Thread Martin Grimme
Hi,

2015-05-03 13:09 GMT+02:00, Andrey Kozhevnikov :
> afaik it only closing propcesses with windows, no?

No, it is the Linux OOM handler, which does not care or know about
what a Wayland window is.
If your daemon is invoked as a systemd service, you can adjust the
OOMScore in the system .service file of the daemon, like this:

  [Service]
  ExecStart=/usr/sbin/mydaemon
  OOMScoreAdjust=-250

The lower the value the less likely the process will be selected by
the OOM killer.
However, if you want to remain harbour-compatible, you cannot run the
daemon as a systemd service. In that case maybe you can write the
score directly at runtime to

  /proc//oom_score_adj

but I did not test that solution.


Martin
___
SailfishOS.org Devel mailing list
To unsubscribe, please send a mail to devel-unsubscr...@lists.sailfishos.org


Re: [SailfishDevel] Keeping background process running in Sailfish OS

2015-05-03 Thread E.S. Rosenberg
Also note that if you skew it too much in favor of yourself the system may
end up killing genuinely important system processes instead of your daemon,
no user will be happy about that

2015-05-03 14:43 GMT+03:00 Martin Grimme :

> Hi,
>
> 2015-05-03 13:09 GMT+02:00, Andrey Kozhevnikov :
> > afaik it only closing propcesses with windows, no?
>
> No, it is the Linux OOM handler, which does not care or know about
> what a Wayland window is.
> If your daemon is invoked as a systemd service, you can adjust the
> OOMScore in the system .service file of the daemon, like this:
>
>   [Service]
>   ExecStart=/usr/sbin/mydaemon
>   OOMScoreAdjust=-250
>
> The lower the value the less likely the process will be selected by
> the OOM killer.
> However, if you want to remain harbour-compatible, you cannot run the
> daemon as a systemd service. In that case maybe you can write the
> score directly at runtime to
>
>   /proc//oom_score_adj
>
> but I did not test that solution.
>
>
> Martin
> ___
> SailfishOS.org Devel mailing list
> To unsubscribe, please send a mail to
> devel-unsubscr...@lists.sailfishos.org
>
___
SailfishOS.org Devel mailing list
To unsubscribe, please send a mail to devel-unsubscr...@lists.sailfishos.org

Re: [SailfishDevel] Keeping background process running in Sailfish OS

2015-05-03 Thread Taixzo
I wonder why Sailfish OS does this while Harmattan and Maemo did not? They 
certainly didn't have more RAM to work with.

Sunday, May 3, 2015 7:56 AM E.S. Rosenberg wrote:
> Also note that if you skew it too much in favor of yourself the system may
> end up killing genuinely important system processes instead of your daemon,
> no user will be happy about that
> 
> 2015-05-03 14:43 GMT+03:00 Martin Grimme :
> 
>> Hi,
>>
>> 2015-05-03 13:09 GMT+02:00, Andrey Kozhevnikov :
>>> afaik it only closing propcesses with windows, no?
>>
>> No, it is the Linux OOM handler, which does not care or know about
>> what a Wayland window is.
>> If your daemon is invoked as a systemd service, you can adjust the
>> OOMScore in the system .service file of the daemon, like this:
>>
>>   [Service]
>>   ExecStart=/usr/sbin/mydaemon
>>   OOMScoreAdjust=-250
>>
>> The lower the value the less likely the process will be selected by
>> the OOM killer.
>> However, if you want to remain harbour-compatible, you cannot run the
>> daemon as a systemd service. In that case maybe you can write the
>> score directly at runtime to
>>
>>   /proc//oom_score_adj
>>
>> but I did not test that solution.
>>
>>
>> Martin
>> ___
>> SailfishOS.org Devel mailing list
>> To unsubscribe, please send a mail to
>> devel-unsubscr...@lists.sailfishos.org
>>
> ___
> SailfishOS.org Devel mailing list
> To unsubscribe, please send a mail to devel-unsubscr...@lists.sailfishos.org


--
Sent from Whiteout Mail - https://whiteout.io

My PGP key: https://keys.whiteout.io/tai...@gmail.com

pgpgu8dZ3suup.pgp
Description: PGP signature
___
SailfishOS.org Devel mailing list
To unsubscribe, please send a mail to devel-unsubscr...@lists.sailfishos.org

Re: [SailfishDevel] Keeping background process running in Sailfish OS

2015-05-03 Thread E.S. Rosenberg
Well for one thing you have the extremely RAM hungry Android environment
which they didn't have...

2015-05-03 17:16 GMT+03:00 Taixzo :

> I wonder why Sailfish OS does this while Harmattan and Maemo did not? They
> certainly didn't have more RAM to work with.
>
> Sunday, May 3, 2015 7:56 AM E.S. Rosenberg wrote:
> > Also note that if you skew it too much in favor of yourself the system
> may
> > end up killing genuinely important system processes instead of your
> daemon,
> > no user will be happy about that
> >
> > 2015-05-03 14:43 GMT+03:00 Martin Grimme :
> >
> >> Hi,
> >>
> >> 2015-05-03 13:09 GMT+02:00, Andrey Kozhevnikov  >:
> >>> afaik it only closing propcesses with windows, no?
> >>
> >> No, it is the Linux OOM handler, which does not care or know about
> >> what a Wayland window is.
> >> If your daemon is invoked as a systemd service, you can adjust the
> >> OOMScore in the system .service file of the daemon, like this:
> >>
> >>   [Service]
> >>   ExecStart=/usr/sbin/mydaemon
> >>   OOMScoreAdjust=-250
> >>
> >> The lower the value the less likely the process will be selected by
> >> the OOM killer.
> >> However, if you want to remain harbour-compatible, you cannot run the
> >> daemon as a systemd service. In that case maybe you can write the
> >> score directly at runtime to
> >>
> >>   /proc//oom_score_adj
> >>
> >> but I did not test that solution.
> >>
> >>
> >> Martin
> >> ___
> >> SailfishOS.org Devel mailing list
> >> To unsubscribe, please send a mail to
> >> devel-unsubscr...@lists.sailfishos.org
> >>
> > ___
> > SailfishOS.org Devel mailing list
> > To unsubscribe, please send a mail to
> devel-unsubscr...@lists.sailfishos.org
>
>
> --
> Sent from Whiteout Mail - https://whiteout.io
>
> My PGP key: https://keys.whiteout.io/tai...@gmail.com
>
> ___
> SailfishOS.org Devel mailing list
> To unsubscribe, please send a mail to
> devel-unsubscr...@lists.sailfishos.org
>
___
SailfishOS.org Devel mailing list
To unsubscribe, please send a mail to devel-unsubscr...@lists.sailfishos.org

Re: [SailfishDevel] Keeping background process running in Sailfish OS

2015-05-03 Thread MARTIN GRIMME


Am 3. Mai 2015, um 16:39, schrieb "E.S. Rosenberg" 
:

>
>
>Well for one thing you have the extremely RAM hungry Android environment which 
>they didn't have...

On the other hand, the N900 and N9 could have become pretty unresponsive while 
swapping, up to the point that you were not able to answer the ringing phone in 
time.
So the way Maemo and Harmattan did it with a crazy amount of swapping was 
certainly not better.


Martin


>
>2015-05-03 17:16 GMT+03:00 Taixzo :
>I wonder why Sailfish OS does this while Harmattan and Maemo did not? They 
>certainly didn't have more RAM to work with.
>
>Sunday, May 3, 2015 7:56 AM E.S. Rosenberg wrote:
>> Also note that if you skew it too much in favor of yourself the system may
>> end up killing genuinely important system processes instead of your daemon,
>> no user will be happy about that
>>
>> 2015-05-03 14:43 GMT+03:00 Martin Grimme :
>>
>>> Hi,
>>>
>>> 2015-05-03 13:09 GMT+02:00, Andrey Kozhevnikov :
 afaik it only closing propcesses with windows, no?
>>>
>>> No, it is the Linux OOM handler, which does not care or know about
>>> what a Wayland window is.
>>> If your daemon is invoked as a systemd service, you can adjust the
>>> OOMScore in the system .service file of the daemon, like this:
>>>
>>>   [Service]
>>>   ExecStart=/usr/sbin/mydaemon
>>>   OOMScoreAdjust=-250
>>>
>>> The lower the value the less likely the process will be selected by
>>> the OOM killer.
>>> However, if you want to remain harbour-compatible, you cannot run the
>>> daemon as a systemd service. In that case maybe you can write the
>>> score directly at runtime to
>>>
>>>   /proc//oom_score_adj
>>>
>>> but I did not test that solution.
>>>
>>>
>>> Martin
>>> ___
>>> SailfishOS.org Devel mailing list
>>> To unsubscribe, please send a mail to
>>> devel-unsubscr...@lists.sailfishos.org
>>>
>> ___
>> SailfishOS.org Devel mailing list
>> To unsubscribe, please send a mail to devel-unsubscr...@lists.sailfishos.org
>
>--
>Sent from Whiteout Mail - https://whiteout.io
>My PGP key: https://keys.whiteout.io/tai...@gmail.com
>
>___
>SailfishOS.org Devel mailing list
>To unsubscribe, please send a mail to devel-unsubscr...@lists.sailfishos.org
>
___
SailfishOS.org Devel mailing list
To unsubscribe, please send a mail to devel-unsubscr...@lists.sailfishos.org

Re: [SailfishDevel] Keeping background process running in Sailfish OS

2015-05-04 Thread Tomasz Sterna
Dnia 2015-05-03, nie o godzinie 05:08 +, Taixzo pisze:
> Is there a way to make an app launch a daemon process that does not get 
> killed by this?

It is very easy to launch a user-systemd lever service.
Just create .service descriptor file and "systemctl --user start ..."
it.

If it becomes RAM hungry and OOM Killers slaps it, systemd will just
restart it. If you code your daemon to behave on sudden death, no harm
should be done.

It is also very easy to control your service programatically with
systemd D-Bus API. See my pebble[1] app for reference.


[1] https://github.com/smokku/pebble/blob/master/app/pebbledinterface.cpp#L123

-- 
 /o__ Q: What do agnostic, insomniac dyslexics do at night?
(_<^' A: Stay awake and wonder if there's a dog.

___
SailfishOS.org Devel mailing list
To unsubscribe, please send a mail to devel-unsubscr...@lists.sailfishos.org