Commit
So we don't run out of file descriptors. See #265.
- Loading branch information
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -72,6 +72,8 @@ along with this program. If not, see <https://www.gnu.org/licenses/>. | |
| # include <unistd.h> | ||
| #endif | ||
|
|
||
| static constexpr const std::size_t max_extracts = 500; | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
joto
Author
Member
|
||
|
|
||
| static osmium::Box parse_bbox(const rapidjson::Value& value) { | ||
| if (value.IsArray()) { | ||
| if (value.Size() != 4) { | ||
|
|
@@ -622,6 +624,10 @@ bool CommandExtract::run() { | |
| throw config_error{"No extract specified in config file or on the command line."}; | ||
| } | ||
|
|
||
| if (m_extracts.size() > max_extracts) { | ||
| throw config_error{"Too many extracts specified in config file (Maximum: " + std::to_string(max_extracts) + ")."}; | ||
| } | ||
|
|
||
| show_extracts(); | ||
|
|
||
| m_strategy = make_strategy(m_strategy_name); | ||
|
|
||
This prevents users on systems that can open more than 500 file descriptors per process to use osmium as intended, as well as not handling the issue for users on systems with lower numbers. This would just work with environments where the limit is exactly 500.