Re: BUG #16696: Backend crash in llvmjit

Поиск
Список
Период
Сортировка
От Andres Freund
Тема Re: BUG #16696: Backend crash in llvmjit
Дата
Msg-id 20201110054802.bjmjkfv4gzj3nkbe@alap3.anarazel.de
обсуждение исходный текст
Ответ на Re: BUG #16696: Backend crash in llvmjit  (Dmitry Marakasov <amdmi3@amdmi3.ru>)
Ответы Re: BUG #16696: Backend crash in llvmjit  (Dmitry Marakasov <amdmi3@amdmi3.ru>)
Список pgsql-bugs
Hi,

On 2020-11-05 00:20:15 +0300, Dmitry Marakasov wrote:
> The problem happens when boolin() function is inlined by LLVM.
> The named function calls isspace() internally, which on FreeBSD is
> locale-specific and involves caching some locale parameters in
> thread-local variable defined as
> 
> extern _Thread_local const _RuneLocale *_ThreadRuneLocale;
> 
> The execution crashes on trying to access the named thread-local varible,
> probably because something related to TLS is not set up properly in/for
> LLVM.
> 
> I've confirmed this hypothesis by disabling isspace() calls in boolin()
> which has also fixed the problem.

Nice digging. I suspect your approach of disabling inlining for TLS
might be the most reasonable one for now.

Any chance you're interested in extending your patch with a testcase
that crashes reliably without it? Best on multiple platforms, including
linux? Easiest way would probably be to add a function referencing a
thread local variable in regress.c and set jit_above_cost = 0,
jit_inline_above_cost=0 for a query using that function.

Greetings,

Andres Freund



В списке pgsql-bugs по дате отправления:

Предыдущее
От: Andres Freund
Дата:
Сообщение: Re: BUG #16707: Memory leak
Следующее
От: Kurt Roeckx
Дата:
Сообщение: Re: BUG #16707: Memory leak