Don't clean up LLVM state when exiting in a bad way

Поиск
Список
Период
Сортировка
От Jelte Fennema
Тема Don't clean up LLVM state when exiting in a bad way
Дата
Msg-id AM5PR83MB0178C52CCA0A8DEA0207DC14F7FF9@AM5PR83MB0178.EURPRD83.prod.outlook.com
обсуждение исходный текст
Ответы Re: Don't clean up LLVM state when exiting in a bad way  (Zhihong Yu <zyu@yugabyte.com>)
Re: Don't clean up LLVM state when exiting in a bad way  (Justin Pryzby <pryzby@telsasoft.com>)
Re: Don't clean up LLVM state when exiting in a bad way  (Andres Freund <andres@anarazel.de>)
Список pgsql-hackers
Hi,

I ran into some segfaults when using Postgres that was compiled with LLVM 7. According to the backtraces these crashes happened during the call to llvm_shutdown, during cleanup after another out of memory condition. It seems that calls to LLVMOrcDisposeInstance, can crash (at least on LLVM 7) when LLVM is left in bad state. I attached the relevant part of the stacktrace to this email.

With the attached patch these segfaults went away. The patch turns llvm_shutdown into a no-op whenever the backend is exiting with an error. Based on my understanding of the code this should be totally fine. No memory should be leaked, since all memory will be cleaned up anyway once the backend exits shortly after. The only reason this cleanup code even seems to exist at all is to get useful LLVM profiling data. To me it seems be acceptable if the profiling data is incorrect/missing when the backend exits with an error.  

Jelte
Вложения

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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: NAMEDATALEN increase because of non-latin languages
Следующее
От: Zhihong Yu
Дата:
Сообщение: Re: Don't clean up LLVM state when exiting in a bad way