C++ API and segmentation fault

  • High: It blocks me to complete my task.

I am currently experiencing difficulty in getting the following example to work:

#include <ray/api.h>
#include <iostream>

int heavy_compute(int value) {
  return value;
}

// RAY_REMOTE(heavy_compute);

int main(int argc, char **argv) {
  // Initialize the Ray runtime
  ray::RayConfig config;
  // config.address = "http://127.0.0.1:8265";
  ray::Init();

  // Put a function in the Ray object store and call it
  //auto task = ray::Task(Hello).Remote();
  //std::string out = *(ray::Get(task));

  // Shutdown the Ray runtime
  ray::Shutdown();
  return 0;
}

Two problems:

  1. If I uncomment // RAY_REMOTE(heavy_compute); and run the resulting binary it will bring up the ray cluster and stop it successfully but then finish with a seg-fault. Inspecting the core dump all I see is that it died in:

0x0000799926071935 in ray::internal::FunctionManager::~FunctionManager() () from /home/matkin/.local/lib/python3.10/site-packages/ray/cpp/lib/libray_api.so

  1. More trivially. If I start a ray cluster via ray start --head, and then try and run the above binary it will fail claiming a cluster already exists rather than connecting to it. My understanding is that ray.init() should connect to an existing cluster if it finds one.

I’m sorry but I’m not getting what your issues are?

You paste a code but the code can be run without failure.

You mentioned two problems. Could you provide how to reproduce it with specific code instead of descriptions?

Could you also do a favor by creating an issue with above description on Issues · ray-project/ray · GitHub?