Project

General

Profile

Actions

Bug #3215

open

NFD crash with "open /dev/urandom operation failed" when reaching ulimit

Added by Alex Afanasyev over 8 years ago. Updated almost 8 years ago.

Status:
New
Priority:
Normal
Assignee:
-
Category:
Management
Target version:
-
Start date:
Due date:
% Done:

0%

Estimated time:
3.00 h

Description

Snippet to reproduce:

// g++ -o x -std=c++0x x.cpp $(pkg-config --cflags --libs libndn-cxx)
#include <boost/asio.hpp>
#include <ndn-cxx/face.hpp>
#include <ndn-cxx/security/key-chain.hpp>

using namespace ndn;

int main() {
  boost::asio::io_service io;
  KeyChain keyChain;
  std::vector<unique_ptr<Face>> faces;
  for (int i = 0; i < 1200; ++i) {
    faces.emplace_back(new Face(nullptr, io, keyChain));
    faces.back()->processEvents(time::milliseconds(100));
    std::cout << i << std::endl;
  }

  sleep(600);

  return 0;
}

Steps to reproduce:

  1. open a console with root privileges (sudo -i), execute ulimit -u 1024 followed by nfd (not nfd-start)
  2. open another console without root privileges, execute ulimit -u and confirm the output is greater than 10000, then execute the compiled snippet

Expected: NFD does not crash; the snippet may crash

Actual: NFD crashes with FATAL: [NFD] OS_Rng: open /dev/urandom operation failed with error 24, and snippet stops after printing "995"

Actions

Also available in: Atom PDF