Zsh Mailing List Archive
Messages sorted by:
Re: A serious bug in execution – where to debug?
- X-seq: zsh-workers 44603
- From: Roman Perepelitsa <roman.perepelitsa@xxxxxxxxx>
- To: Sebastian Gniazdowski <sgniazdowski@xxxxxxxxx>
- Subject: Re: A serious bug in execution – where to debug?
- Date: Tue, 30 Jul 2019 21:23:53 +0200
- Cc: Zsh hackers list <zsh-workers@xxxxxxx>
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=KI/1+aBdHE4qd9DBCsQ2FiBzGckSJkwUkfguyjsqmlk=; b=BL3QcE9JrTC0/fRs19+G/ysBX0NN88gjBfAu4VesL+R8oVNS9h9M27AQawzUzNZ2R7 umAfhPnZSuvTG6P5UVpIP7JSpeWem/6aGWv+HEu6LhLstEnylkv8xP+EegMY/+YCPE/l N//Tt+e/lAknDTTvOOsAyuuIxJSgeHdtxozKFrEfTyUGAS+kSZ+vprkHa0xu4bHXXU+F uDpuN/DSeLJ+lzqYPru/PIdFxWbw3QgX9qkNKzv5NOJhqFcaQ7oLrdWw8Rxofz4YoEew ov8z93OnYmmcUbwOertdsQypyKq4SwJrwaQbM4pLPZ7t1H4P9i77rjIFyRQNB3wrPfTl 30BQ==
- In-reply-to: <CAKc7PVBeVzKHeeq_kFfbMhx7iF-nBnk2O4dSJVtXCoZW=517pQ@mail.gmail.com>
- List-help: <mailto:firstname.lastname@example.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:email@example.com>
- List-unsubscribe: <mailto:firstname.lastname@example.org>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
- References: <CAKc7PVCKrg_PnZ6jKLoAwR8XQnswT-Bs2TJA7oefhd_gRtHKUQ@mail.gmail.com> <CAN=4vMpWFR=_TPZ2hcQC_FvKSiPFW2_isn_BYxYaoUKLqu-4Gw@mail.gmail.com> <CAKc7PVCn0PNzu5PxCW=nwZ6unt5CtTarPOo387yvg0+bekuSyQ@mail.gmail.com> <CAN=4vMqtA5k_rDfyn_Pk0Q6isxcJVN1mE+8-k+O=21qYDS+HCg@mail.gmail.com> <CAKc7PVB0piw70MfggmkWpGdkOxZNJrb2tZ+2LAao9N9QZ00bPA@mail.gmail.com> <CAN=4vMqYCXz79kVoUN6dN7psOdcGmF-i2XGtccXZgd+Ti1fkEg@mail.gmail.com> <CAKc7PVBeVzKHeeq_kFfbMhx7iF-nBnk2O4dSJVtXCoZW=517pQ@mail.gmail.com>
On Tue, Jul 30, 2019 at 8:53 PM Sebastian Gniazdowski
> On Tue, 30 Jul 2019 at 20:22, Roman Perepelitsa
> <roman.perepelitsa@xxxxxxxxx> wrote:
> > Do you think it's possible to implement clean shutdown and reentrant
> > initialization for a piece of code as blackbox?
> What do you mean exactly? As a blackbox - as a regular, repeatable method?
In order to implement clean shutdown for a piece of code with
non-trivial capabilities you have to rely on its implementation
details. You cannot implement generic clean shutdown that will work
with any code.
Here's an example. Suppose a plugin you are monitoring spawns a
process. Should you kill it when you unload the plugin? It depends. If
this plugin spawns a process every time it is loaded and kills it
every time you call its public `shutdown` function, then you should
probably kill it to avoid leaking processes. You don't want to have a
horde of stray processes if the plugin is loaded and unloaded multiple
times. On the other hand, if this plugin spawns a one-per-user daemon
(could also be one-per-machine), then another shell might already be
using it, and if you kill the daemon when the plugin is unloaded in
one shell, you can break that same plugin in another shell. Plugins
don't expect that their internal processes will be randomly killed,
files randomly deleted and internal variables randomly unset, so if
you start doing it, things will break. To implement clean shutdown in
this case, you need to check whether this plugin is the last instance
for this user/machine and only then kill the daemon. In other words,
in both cases you need to implement the same logic the plugin already
implements in its shutdown routine. Once you implement it, you have to
keep it in sync with internal implementation changes of the plugin.
Messages sorted by: