Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix wrong behaviour in case of allocation failure. #4665

Merged
merged 2 commits into from
Mar 13, 2019

Conversation

alexey-milovidov
Copy link
Member

For changelog. Remove if this is non-significant change.

Category (leave one):

  • Bug Fix

Short description (up to few sentences):
Avoid std::terminate in case of memory allocation failure. Now std::bad_alloc exception is thrown as expected.

@alexey-milovidov
Copy link
Member Author

A test:

milovidov@example-perftest03j:~/ClickHouse/build_gcc8$ sudo -u clickhouse bash -c "ulimit -v 1000000; dbms/programs/clickhouse server -C /etc/clickhouse-server/config.xml"
Include not found: clickhouse_compression
Logging trace to /var/log/clickhouse-server/clickhouse-server.log
Logging errors to /var/log/clickhouse-server/clickhouse-server.err.log
Logging trace to console
2019.03.12 22:32:18.833310 [ 1 ] {} <Information> : Starting ClickHouse 19.5.1.1 with revision 54417
2019.03.12 22:32:18.833417 [ 1 ] {} <Information> Application: starting up
2019.03.12 22:32:18.836795 [ 1 ] {} <Debug> Application: rlimit on number of file descriptors is 262144
2019.03.12 22:32:18.836823 [ 1 ] {} <Debug> Application: Initializing DateLUT.
2019.03.12 22:32:18.836836 [ 1 ] {} <Trace> Application: Initialized DateLUT with time zone `W-SU'.
2019.03.12 22:32:18.837582 [ 1 ] {} <Debug> Application: Configuration parameter 'interserver_http_host' doesn't exist or exists and empty. Will use 'example-perftest03j.yandex.ru' as replica host.
2019.03.12 22:32:18.839050 [ 1 ] {} <Debug> ConfigReloader: Loading config `/etc/clickhouse-server/users.xml'
Include not found: networks
Include not found: networks
2019.03.12 22:32:18.844354 [ 1 ] {} <Information> Application: Loading metadata from /opt/clickhouse/
2019.03.12 22:32:18.844550 [ 1 ] {} <Information> DatabaseOrdinary (system): Total 14 tables.
2019.03.12 22:32:18.845255 [ 1 ] {} <Information> BackgroundProcessingPool: Create BackgroundProcessingPool with 16 threads
2019.03.12 22:32:18.846463 [ 1 ] {} <Debug> system.part_log (Data): Loading data parts
2019.03.12 22:32:18.846564 [ 1 ] {} <Debug> system.part_log (Data): Loaded data parts (0 items)
2019.03.12 22:32:18.847124 [ 1 ] {} <Debug> system.part_log_0 (Data): Loading data parts
2019.03.12 22:32:18.848549 [ 1 ] {} <Debug> system.part_log_0 (Data): Loaded data parts (5 items)
2019.03.12 22:32:18.849047 [ 1 ] {} <Debug> system.part_log_1 (Data): Loading data parts
2019.03.12 22:32:18.849102 [ 1 ] {} <Debug> system.part_log_1 (Data): Loaded data parts (0 items)
2019.03.12 22:32:18.849566 [ 1 ] {} <Debug> system.part_log_2 (Data): Loading data parts
2019.03.12 22:32:18.849624 [ 1 ] {} <Debug> system.part_log_2 (Data): Loaded data parts (0 items)
2019.03.12 22:32:18.850091 [ 1 ] {} <Debug> system.part_log_3 (Data): Loading data parts
2019.03.12 22:32:18.850140 [ 1 ] {} <Debug> system.part_log_3 (Data): Loaded data parts (0 items)
2019.03.12 22:32:18.850610 [ 1 ] {} <Debug> system.part_log_4 (Data): Loading data parts
2019.03.12 22:32:18.850658 [ 1 ] {} <Debug> system.part_log_4 (Data): Loaded data parts (0 items)
2019.03.12 22:32:18.851107 [ 1 ] {} <Debug> system.part_log_5 (Data): Loading data parts
2019.03.12 22:32:18.851436 [ 1 ] {} <Debug> system.part_log_5 (Data): Loaded data parts (1 items)
2019.03.12 22:32:18.852038 [ 1 ] {} <Debug> system.query_log (Data): Loading data parts
2019.03.12 22:32:18.852583 [ 1 ] {} <Debug> system.query_log (Data): Loaded data parts (1 items)
2019.03.12 22:32:18.853134 [ 1 ] {} <Debug> system.query_log_0 (Data): Loading data parts
2019.03.12 22:32:18.853541 [ 1 ] {} <Debug> system.query_log_0 (Data): Loaded data parts (1 items)
2019.03.12 22:32:18.854163 [ 1 ] {} <Debug> system.query_log_1 (Data): Loading data parts
2019.03.12 22:32:18.856004 [ 1 ] {} <Debug> system.query_log_1 (Data): Loaded data parts (4 items)
2019.03.12 22:32:18.856610 [ 1 ] {} <Debug> system.query_log_2 (Data): Loading data parts
2019.03.12 22:32:18.857035 [ 1 ] {} <Debug> system.query_log_2 (Data): Loaded data parts (1 items)
2019.03.12 22:32:18.857698 [ 1 ] {} <Debug> system.query_log_3 (Data): Loading data parts
2019.03.12 22:32:18.861543 [ 1 ] {} <Debug> system.query_log_3 (Data): Loaded data parts (9 items)
2019.03.12 22:32:18.862125 [ 1 ] {} <Debug> system.query_log_4 (Data): Loading data parts
2019.03.12 22:32:18.862863 [ 1 ] {} <Debug> system.query_log_4 (Data): Loaded data parts (2 items)
2019.03.12 22:32:18.863485 [ 1 ] {} <Debug> system.query_thread_log (Data): Loading data parts
2019.03.12 22:32:18.870512 [ 1 ] {} <Debug> system.query_thread_log (Data): Loaded data parts (18 items)
2019.03.12 22:32:18.870590 [ 1 ] {} <Information> DatabaseOrdinary (system): Starting up tables.
2019.03.12 22:32:18.871112 [ 1 ] {} <Error> Application: Caught exception while loading metadata: std::exception. Code: 1001, type: std::bad_alloc, e.what() = std::bad_alloc
2019.03.12 22:32:18.871159 [ 1 ] {} <Information> Application: Shutting down storages.
2019.03.12 22:32:19.677239 [ 1 ] {} <Debug> Application: Shutted down storages.
2019.03.12 22:32:19.678344 [ 1 ] {} <Debug> Application: Destroyed global context.
2019.03.12 22:32:19.721646 [ 1 ] {} <Error> Application: std::bad_alloc
2019.03.12 22:32:19.721669 [ 1 ] {} <Information> Application: shutting down
2019.03.12 22:32:19.721689 [ 1 ] {} <Debug> Application: Uninitializing subsystem: Logging Subsystem
2019.03.12 22:32:19.721851 [ 18 ] {} <Information> BaseDaemon: Stop SignalListener thread

Before this PR it looked like:

2019.03.12 21:53:53.769467 [ 1 ] {} <Information> DatabaseOrdinary (system): Starting up tables.
LLVM ERROR: out of memory
2019.03.12 21:53:53.769866 [ 18 ] {} <Error> BaseDaemon: ########################################
2019.03.12 21:53:53.769929 [ 18 ] {} <Error> BaseDaemon: (from thread 1) Received signal Aborted (6).
2019.03.12 21:53:53.802975 [ 18 ] {} <Error> BaseDaemon: 0. /lib/x86_64-linux-gnu/libc.so.6(gsignal+0xc7) [0x7ffb65f4ae97]
2019.03.12 21:53:53.803004 [ 18 ] {} <Error> BaseDaemon: 1. /lib/x86_64-linux-gnu/libc.so.6(abort+0x141) [0x7ffb65f4c801]
2019.03.12 21:53:53.803049 [ 18 ] {} <Error> BaseDaemon: 2. dbms/programs/clickhouse(llvm::report_bad_alloc_error(char const*, bool)+0x17b) [0xb1b815b]
2019.03.12 21:53:53.803082 [ 18 ] {} <Error> BaseDaemon: 3. dbms/programs/clickhouse() [0x708d285]

@alexey-milovidov alexey-milovidov merged commit faa94c0 into master Mar 13, 2019
@abyss7 abyss7 added the pr-bugfix Pull request with bugfix, not backported by default label Apr 10, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pr-bugfix Pull request with bugfix, not backported by default
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants