diff options
author | Martijn Otto <git@martijnotto.nl> | 2019-09-25 16:37:06 +0200 |
---|---|---|
committer | Martijn Otto <git@martijnotto.nl> | 2019-09-25 16:37:06 +0200 |
commit | f3b65c66f8f95a299ef0746f60ccf3fb250e128a (patch) | |
tree | d272b91197660c77b872812784ab34fee178e0a4 /src | |
parent | Merge pull request #5820 (diff) | |
download | monero-f3b65c66f8f95a299ef0746f60ccf3fb250e128a.tar.xz |
Request a thread stack size that is large enough for unbound
Unbound uses a 64 kb large character array on the stack, which
leads to a stack overflow for some libc implementations. musl
only gives 80 kb in total. This PR changes the stack size for
these threads to 1mb, which solves the segmentation fault.
Diffstat (limited to 'src')
-rw-r--r-- | src/p2p/net_node.inl | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/p2p/net_node.inl b/src/p2p/net_node.inl index 8c0cff7e2..5cdbc2ce6 100644 --- a/src/p2p/net_node.inl +++ b/src/p2p/net_node.inl @@ -645,11 +645,18 @@ namespace nodetool std::vector<std::vector<std::string>> dns_results; dns_results.resize(m_seed_nodes_list.size()); + // some libc implementation provide only a very small stack + // for threads, e.g. musl only gives +- 80kb, which is not + // enough to do a resolve with unbound. we request a stack + // of 1 mb, which should be plenty + boost::thread::attributes thread_attributes; + thread_attributes.set_stack_size(1024*1024); + std::list<boost::thread> dns_threads; uint64_t result_index = 0; for (const std::string& addr_str : m_seed_nodes_list) { - boost::thread th = boost::thread([=, &dns_results, &addr_str] + boost::thread th = boost::thread(thread_attributes, [=, &dns_results, &addr_str] { MDEBUG("dns_threads[" << result_index << "] created for: " << addr_str); // TODO: care about dnssec avail/valid |