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 = "";

  // 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
  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.