Re: [PATCH] Add CHECK_FOR_INTERRUPTS in scram_SaltedPassword loop. - Mailing list pgsql-hackers

From Aleksander Alekseev
Subject Re: [PATCH] Add CHECK_FOR_INTERRUPTS in scram_SaltedPassword loop.
Date
Msg-id CAJ7c6TMdDdC5f1qmS=UVx22Bvjqz=PhY=aeefwoXxGc_bK+WKQ@mail.gmail.com
Whole thread Raw
In response to [PATCH] Add CHECK_FOR_INTERRUPTS in scram_SaltedPassword loop.  (Bowen Shi <zxwsbg12138@gmail.com>)
Responses Re: [PATCH] Add CHECK_FOR_INTERRUPTS in scram_SaltedPassword loop.
List pgsql-hackers
Hi,

> When the scram_iterations value is set too large, the backend would hang for
> a long time.  And we can't use Ctrl+C to cancel this query, cause the loop don't
> process signal interrupts.
>
> Add CHECK_FOR_INTERRUPTS within the loop of scram_SaltedPassword
> to handle any signals received during this period may be a good choice.
>
> I wrote a patch to solve this problem. What's your suggestions?

Thanks for the patch.

It sort of makes sense. I wonder though if we should limit the maximum
number of iterations instead. If somebody specified 1_000_000+
iteration this could also indicate a user error.

If we want to add CHECK_FOR_INTERRUPTS inside the loop I think a brief
comment would be appropriate.

-- 
Best regards,
Aleksander Alekseev



pgsql-hackers by date:

Previous
From: Amit Langote
Date:
Subject: Re: remaining sql/json patches
Next
From: Aleksander Alekseev
Date:
Subject: Re: How to accurately determine when a relation should use local buffers?