Skip to content

Segfault on deleting tuple with observation, action, reward in example/libecole/src/branching.cppΒ #373

@nkrit1

Description

@nkrit1

Describe the bug

There is a segfault when deleting tuple with observation, action, reward in example/libecole/src/branching.cpp.
I changed NodeBipatite observation function for StrongBranchingScores in branching.cpp:

#include <exception>
#include <iostream>
#include <tuple>
#include <utility>

#include "ecole/environment/branching.hpp"
#include "ecole/information/nothing.hpp"
#include "ecole/instance/set-cover.hpp"
#include "ecole/observation/node-bipartite.hpp"
#include "ecole/reward/n-nodes.hpp"
#include "ecole/observation/strong-branching-scores.hpp"

int main() {
	try {
		auto env = ecole::environment::
			Branching<ecole::observation::StrongBranchingScores, ecole::reward::NNodes, ecole::information::Nothing>{};
		std::size_t constexpr n_rows = 100;
		std::size_t constexpr n_cols = 200;
		auto gen = ecole::instance::SetCoverGenerator{{n_rows, n_cols}};

		static constexpr auto n_episodes = 3;
		for (std::size_t i = 0; i < n_episodes; ++i) {
			auto [obs, action_set, reward, done, info] = env.reset(gen.next());
			while (!done && action_set.has_value()) {
				std::tie(obs, action_set, reward, done, info) = env.step(action_set.value()[0]);
			}
		}
	} catch (std::exception const& e) {
		std::cerr << "Error: " << e.what() << '\n';
	}
}

Setting

  • OS: Ubuntu 18.04
  • Compiler: gcc 12.4.0
  • Python version: 3.11.9
  • Ecole version: 0.8.1 (last release)
  • SCIP: 8.0.0 (passed as CMAKEARGS to ecole)
  • CMake: 3.30.3
  • xsimd: 8.1.0
  • xtensor: 0.24.6
  • xtensor-python: 0.26.1

To Reproduce

  1. Change branching.cpp example in a way presented above.
  2. Run

Expected behavior

Expected behavior is to get strong branching scores in observation.

Additional context

I use gdb for debugging and the main tread is paused on exception(our segfault) and everything starts from std::tuple()::~tuple().

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions