public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Dominik Csapak <d.csapak@proxmox.com>
To: Thomas Lamprecht <t.lamprecht@proxmox.com>,
	Proxmox VE development discussion <pve-devel@lists.proxmox.com>,
	Friedrich Weber <f.weber@proxmox.com>
Subject: Re: [pve-devel] [PATCH widget-toolkit] fix #4421: ui: guard setProxy against races of slow vs fast requests
Date: Wed, 8 Mar 2023 07:34:08 +0100	[thread overview]
Message-ID: <8c8e6645-50a2-4d1a-87aa-32da027ab16a@proxmox.com> (raw)
In-Reply-To: <9e245a3d-98ea-8ea0-e953-d1dbc0496393@proxmox.com>

On 3/7/23 19:49, Thomas Lamprecht wrote:
> Am 06/03/2023 um 15:03 schrieb Friedrich Weber:
>> Some UI components use `Ext.data.Store.setProxy` to change their
>> associated API endpoint URL in reaction to user input. One example is
>> `BackupView`, which calls `setProxy` when the user switches from
>> listing backups on storage A to listing backups on storage B. However,
>> if A is slow, the UI may receive the response for A *after* the
>> response for B. It will then display the contents of A as if they were
>> the contents of B, resulting in a UI inconsistency.
>>
>> The reason is that `Ext.data.Store` still processes the slow response
>> for A, even though it is obsolete. This patch overrides the
>> responsible callback of `Ext.data.Store` to only process responses
>> belonging to the currently active proxy object. This should rule out
>> similar race conditions in all components that use the `setProxy` API.
>> In the above example, the patch results in the response for A being
>> ignored.
>>
>> Ignored responses are logged to the browser console.
>>
>> Note that this patch only concerns components that use `setProxy` for
>> changing API endpoints. Other components (e.g. those using
>> `proxy.setURL` for the same purpose) may be open to similar race
>> conditions.
>>
>> Signed-off-by: Friedrich Weber <f.weber@proxmox.com>
>> ---
>>   The original report only concerns the backup view [1], where the race
>>   condition is easy to trigger. While ruling out this particular race is
>>   simple, I thought it would be worthwhile to rule out race condition of
>>   this category for all components. Hence this patch. However, most of the
>>   other races are much harder to trigger, so it may be questionable
>>   whether a general fix is needed. So if wanted, I can alternatively
>>   submit a patch that only fixes the backup view.
> 
> IMO a general fix/future proofing can be OK, so besides a small nit inline:
> LGTM, but did not checked/tested this too closely - @Dominik, what do you
> think on this?
> 

This change is non-intrusive enough that it's OK, since it
fixes the reported issue and potentially some more.

When we're only fixing the one reported place, i guess
sooner or later someone else reports another instance of this,
and by then we probably forgot that we fixed it already once ;)

Really fixing all points where something like that can happen is
not easy since most of them are using Proxmox.Utils.API2Request
instead of a store, or as Friedrich already wrote, setting
the URL of the proxy manually, so this seems to be good
middle ground for now.




  reply	other threads:[~2023-03-08  6:34 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-06 14:03 Friedrich Weber
2023-03-07 18:49 ` Thomas Lamprecht
2023-03-08  6:34   ` Dominik Csapak [this message]
2023-03-08  6:42 ` [pve-devel] applied: " Thomas Lamprecht

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=8c8e6645-50a2-4d1a-87aa-32da027ab16a@proxmox.com \
    --to=d.csapak@proxmox.com \
    --cc=f.weber@proxmox.com \
    --cc=pve-devel@lists.proxmox.com \
    --cc=t.lamprecht@proxmox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal