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

Unable to add more than 16 ODBC dictionaries #750

Closed
nikitka opened this issue May 2, 2017 · 2 comments
Closed

Unable to add more than 16 ODBC dictionaries #750

nikitka opened this issue May 2, 2017 · 2 comments
Labels
comp-dictionary Dictionaries

Comments

@nikitka
Copy link

nikitka commented May 2, 2017

Hi There

I've tried to add 27 ODBC dictionaries and got an error message in log:

2017.05.02 12:36:38.544413 [ 11 ] <Error> ExternalDictionaries: Cannot create external dictionary 'grstat.app2.ua_device' from config path /etc/clickhouse-server/grstat_dictionary.xml: Poco::Exception. Code: 1000, e.code() = 0, e.displayText() = No thread available, e.what() = No thread available

gdb traceback:

Thread 24 "clickhouse-serv" hit Catchpoint 1 (exception thrown), 0x0000000002e60e2d in __cxa_throw ()
#0  0x0000000002e60e2d in __cxa_throw ()
#1  0x00007f2b91047402 in Poco::ThreadPool::getThread() () from /usr/lib/libPocoFoundation.so.46
#2  0x00007f2b910474b0 in Poco::ThreadPool::startWithPriority(Poco::Thread::Priority, Poco::Runnable&) () from /usr/lib/libPocoFoundation.so.46
#3  0x00007f2b910489fd in Poco::Timer::start(Poco::AbstractTimerCallback const&, Poco::Thread::Priority, Poco::ThreadPool&) () from /usr/lib/libPocoFoundation.so.46
#4  0x00007f2b91b64a01 in Poco::Data::SessionPool::SessionPool(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, int, int, int) () from /usr/lib/libPocoData.so.46
#5  0x0000000002b49247 in __gnu_cxx::new_allocator<Poco::Data::SessionPool>::construct<Poco::Data::SessionPool, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >(Poco::Data::SessionPool*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&&) (this=<optimized out>, __p=<optimized out>) at /usr/include/c++/6/ext/new_allocator.h:120
#6  std::allocator_traits<std::allocator<Poco::Data::SessionPool> >::construct<Poco::Data::SessionPool, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >(std::allocator<Poco::Data::SessionPool>&, Poco::Data::SessionPool*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&&) (__a=..., __p=<optimized out>) at /usr/include/c++/6/bits/alloc_traits.h:475
#7  std::_Sp_counted_ptr_inplace<Poco::Data::SessionPool, std::allocator<Poco::Data::SessionPool>, (__gnu_cxx::_Lock_policy)2>::_Sp_counted_ptr_inplace<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >(std::allocator<Poco::Data::SessionPool>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&&) (__a=..., this=0x900e3c0) at /usr/include/c++/6/bits/shared_ptr_base.h:520
#8  std::__shared_count<(__gnu_cxx::_Lock_policy)2>::__shared_count<Poco::Data::SessionPool, std::allocator<Poco::Data::SessionPool>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >(std::_Sp_make_shared_tag, Poco::Data::SessionPool*, std::allocator<Poco::Data::SessionPool> const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&&) (__a=..., this=0x93a0f60) at /usr/include/c++/6/bits/shared_ptr_base.h:615
#9  std::__shared_ptr<Poco::Data::SessionPool, (__gnu_cxx::_Lock_policy)2>::__shared_ptr<std::allocator<Poco::Data::SessionPool>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >(std::_Sp_make_shared_tag, std::allocator<Poco::Data::SessionPool> const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&&) (__a=..., __tag=..., this=0x93a0f58) at /usr/include/c++/6/bits/shared_ptr_base.h:1100
#10 std::shared_ptr<Poco::Data::SessionPool>::shared_ptr<std::allocator<Poco::Data::SessionPool>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >(std::_Sp_make_shared_tag, std::allocator<Poco::Data::SessionPool> const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&&) (__a=..., __tag=..., this=0x93a0f58) at /usr/include/c++/6/bits/shared_ptr.h:319
#11 std::allocate_shared<Poco::Data::SessionPool, std::allocator<Poco::Data::SessionPool>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >(std::allocator<Poco::Data::SessionPool> const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&&) (__a=...) at /usr/include/c++/6/bits/shared_ptr.h:620
#12 std::make_shared<Poco::Data::SessionPool, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&&) () at /usr/include/c++/6/bits/shared_ptr.h:636
#13 DB::ODBCDictionarySource::ODBCDictionarySource (this=0x93a0d80, dict_struct_=..., config=..., config_prefix="dictionary[16].source.odbc", sample_block=...) at /home/nmk/src/ClickHouse/dbms/src/Dictionaries/ODBCDictionarySource.cpp:28
#14 0x0000000002b21f46 in std::make_unique<DB::ODBCDictionarySource, DB::DictionaryStructure const&, Poco::Util::AbstractConfiguration&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, DB::Block&>(DB::DictionaryStructure const&, Poco::Util::AbstractConfiguration&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&&, DB::Block&) () at /usr/include/c++/6/bits/unique_ptr.h:791
#15 DB::DictionarySourceFactory::create (this=this@entry=0x53e4db8 <Singleton<DB::DictionarySourceFactory>::instance()::instance>, name="grstat.app2.ua_device", config=..., config_prefix="dictionary[16].source", dict_struct=..., context=...) at /home/nmk/src/ClickHouse/dbms/src/Dictionaries/DictionarySourceFactory.cpp:137
#16 0x0000000002a753c3 in DB::DictionaryFactory::create (this=this@entry=0x53e4588 <Singleton<DB::DictionaryFactory>::instance()::instance>, name="grstat.app2.ua_device", config=..., config_prefix="dictionary[16]", context=...) at /home/nmk/src/ClickHouse/dbms/src/Interpreters/DictionaryFactory.cpp:38
#17 0x000000000265f125 in DB::ExternalDictionaries::reloadFromFile (this=this@entry=0x8bd6010, config_path="/etc/clickhouse-server/grstat_dictionary.xml", throw_on_error=throw_on_error@entry=false) at /home/nmk/src/ClickHouse/dbms/src/Interpreters/ExternalDictionaries.cpp:251
#18 0x0000000002661725 in DB::ExternalDictionaries::reloadImpl (this=this@entry=0x8bd6010, throw_on_error=throw_on_error@entry=false) at /home/nmk/src/ClickHouse/dbms/src/Interpreters/ExternalDictionaries.cpp:63
#19 0x0000000002630cdd in DB::ExternalDictionaries::ExternalDictionaries (throw_on_error=false, context=..., this=0x8bd6010) at /home/nmk/src/ClickHouse/dbms/include/DB/Interpreters/ExternalDictionaries.h:112
#20 __gnu_cxx::new_allocator<DB::ExternalDictionaries>::construct<DB::ExternalDictionaries, DB::Context&, bool const&> (this=<optimized out>, __p=<optimized out>) at /usr/include/c++/6/ext/new_allocator.h:120
#21 std::allocator_traits<std::allocator<DB::ExternalDictionaries> >::construct<DB::ExternalDictionaries, DB::Context&, bool const&> (__a=..., __p=<optimized out>) at /usr/include/c++/6/bits/alloc_traits.h:475
#22 std::_Sp_counted_ptr_inplace<DB::ExternalDictionaries, std::allocator<DB::ExternalDictionaries>, (__gnu_cxx::_Lock_policy)2>::_Sp_counted_ptr_inplace<DB::Context&, bool const&> (__a=..., this=0x8bd6000) at /usr/include/c++/6/bits/shared_ptr_base.h:520
#23 std::__shared_count<(__gnu_cxx::_Lock_policy)2>::__shared_count<DB::ExternalDictionaries, std::allocator<DB::ExternalDictionaries>, DB::Context&, bool const&> (__a=..., this=<optimized out>) at /usr/include/c++/6/bits/shared_ptr_base.h:615
#24 std::__shared_ptr<DB::ExternalDictionaries, (__gnu_cxx::_Lock_policy)2>::__shared_ptr<std::allocator<DB::ExternalDictionaries>, DB::Context&, bool const&> (__a=..., __tag=..., this=<optimized out>) at /usr/include/c++/6/bits/shared_ptr_base.h:1100
#25 std::shared_ptr<DB::ExternalDictionaries>::shared_ptr<std::allocator<DB::ExternalDictionaries>, DB::Context&, bool const&> (__a=..., __tag=..., this=<optimized out>) at /usr/include/c++/6/bits/shared_ptr.h:319
#26 std::allocate_shared<DB::ExternalDictionaries, std::allocator<DB::ExternalDictionaries>, DB::Context&, bool const&> (__a=...) at /usr/include/c++/6/bits/shared_ptr.h:620
#27 std::make_shared<DB::ExternalDictionaries, DB::Context&, bool const&> () at /usr/include/c++/6/bits/shared_ptr.h:636
#28 DB::Context::getExternalDictionariesImpl (this=this@entry=0x8a33420, throw_on_error=throw_on_error@entry=false) at /home/nmk/src/ClickHouse/dbms/src/Interpreters/Context.cpp:837
#29 0x0000000002630ffc in DB::Context::getExternalDictionaries (this=this@entry=0x8a33420) at /home/nmk/src/ClickHouse/dbms/src/Interpreters/Context.cpp:814
#30 0x0000000000f729b7 in DB::StorageSystemDictionaries::read (this=this@entry=0x73d5ac0, column_names=std::vector of length 14, capacity 16 = {...}, query=std::shared_ptr (count 5, weak 0) 0x73ede50, context=..., settings=..., processed_stage=@0x7f2b8aa3588c: DB::QueryProcessingStage::FetchColumns, max_block_size=65536) at /home/nmk/src/ClickHouse/dbms/src/Storages/System/StorageSystemDictionaries.cpp:83
#31 0x00000000026812e9 in DB::InterpreterSelectQuery::executeFetchColumns (this=this@entry=0x8a33400) at /home/nmk/src/ClickHouse/dbms/src/Interpreters/InterpreterSelectQuery.cpp:841
#32 0x000000000267e303 in DB::InterpreterSelectQuery::executeSingleQuery (this=0x8a33400) at /home/nmk/src/ClickHouse/dbms/src/Interpreters/InterpreterSelectQuery.cpp:429
#33 0x000000000267fef5 in DB::InterpreterSelectQuery::executeWithoutUnion (this=this@entry=0x8a33400) at /home/nmk/src/ClickHouse/dbms/src/Interpreters/InterpreterSelectQuery.cpp:407
#34 0x000000000267ff42 in DB::InterpreterSelectQuery::execute (this=0x8a33400) at /home/nmk/src/ClickHouse/dbms/src/Interpreters/InterpreterSelectQuery.cpp:353
#35 0x00000000027006db in DB::executeQueryImpl (begin=<optimized out>, end=<optimized out>, context=..., internal=internal@entry=false, stage=DB::QueryProcessingStage::Complete) at /home/nmk/src/ClickHouse/dbms/src/Interpreters/executeQuery.cpp:193
#36 0x000000000270165e in DB::executeQuery (query="select * from system.dictionaries;", context=..., internal=internal@entry=false, stage=<optimized out>) at /home/nmk/src/ClickHouse/dbms/src/Interpreters/executeQuery.cpp:356
#37 0x0000000000edfa68 in DB::TCPHandler::runImpl (this=this@entry=0x8a9b000) at /home/nmk/src/ClickHouse/dbms/src/Server/TCPHandler.cpp:154
#38 0x0000000000ee074c in DB::TCPHandler::run (this=0x8a9b000) at /home/nmk/src/ClickHouse/dbms/src/Server/TCPHandler.cpp:725
#39 0x00007f2b9216a927 in Poco::Net::TCPServerConnection::start() () from /usr/lib/libPocoNet.so.46
#40 0x00007f2b92179d86 in Poco::Net::TCPServerDispatcher::run() () from /usr/lib/libPocoNet.so.46
#41 0x00007f2b91045487 in Poco::PooledThread::run() () from /usr/lib/libPocoFoundation.so.46
#42 0x00007f2b91040cf9 in Poco::ThreadImpl::runnableEntry(void*) () from /usr/lib/libPocoFoundation.so.46
#43 0x00007f2b90b0c424 in start_thread (arg=0x7f2b8aa3b700) at pthread_create.c:333
#44 0x00007f2b9054b9bf in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:105

the dictionary configuration:

<dictionary>
  <name>grstat.app2.ua_device</name>
  <source>
    <odbc>
      <table>app2.uniq_ua_device</table>
      <connection_string>DSN=grstat</connection_string>
    </odbc>
  </source>
  <lifetime>
    <min>300</min>
    <max>420</max>
  </lifetime>
  <layout>
    <flat/>
  </layout>
  <structure>
    <id>
      <name>id</name>
    </id>
    <attribute>
      <name>name</name>
      <type>String</type>
      <null_value></null_value>
    </attribute>
  </structure>
</dictionary>

I use v1.1.54198-testing on Debian Stretch.

@ludv1x
Copy link
Contributor

ludv1x commented May 3, 2017

Hi
ClickHouse uses external Poco library to interact with ODBC sources.

Unfortunately, Poco uses own default thread pool for the all needs and it has hardcoded limit for 16 threads:
https://github.com/yandex/ClickHouse/blob/master/contrib/libpoco/Foundation/src/ThreadPool.cpp#L503
https://github.com/yandex/ClickHouse/blob/master/contrib/libpoco/Foundation/include/Poco/ThreadPool.h#L65

You cold change these constants and recompile CH to quickly resolve your problem.

BTW the same issue in google groups.

@ludv1x
Copy link
Contributor

ludv1x commented May 3, 2017

We can add config parameter poco_default_thread_pool_max_size which will adjust default Poco thread pool size.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
comp-dictionary Dictionaries
Projects
None yet
Development

No branches or pull requests

3 participants