From 2e47a68ada378c787462668f41160b4b889c51c8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ivan=20Milinovi=C4=87?= <44698587+imilinovic@users.noreply.github.com> Date: Mon, 15 Jan 2024 16:57:58 +0100 Subject: [PATCH] Fix community detection always crashing (#436) --- .github/workflows/test_no_ml.yml | 2 +- Dockerfile.no_ML | 3 ++- cpp/community_detection_module/algorithm/louvain.cpp | 4 ++-- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/.github/workflows/test_no_ml.yml b/.github/workflows/test_no_ml.yml index 3b282cc00..66f83ff95 100644 --- a/.github/workflows/test_no_ml.yml +++ b/.github/workflows/test_no_ml.yml @@ -16,7 +16,7 @@ jobs: runs-on: ubuntu-latest continue-on-error: True env: - MEMGRAPH_VERSION: 2.12.0 + MEMGRAPH_VERSION: 2.13.0 strategy: matrix: architecture: ["amd64", "arm64"] diff --git a/Dockerfile.no_ML b/Dockerfile.no_ML index 96269770c..344767542 100644 --- a/Dockerfile.no_ML +++ b/Dockerfile.no_ML @@ -30,7 +30,8 @@ RUN apt-get update && apt-get install -y \ COPY memgraph-${TARGETARCH}.deb . -RUN dpkg -i memgraph-${TARGETARCH}.deb && rm memgraph-${TARGETARCH}.deb +RUN dpkg -i memgraph-${TARGETARCH}.deb && rm memgraph-${TARGETARCH}.deb && rm /usr/lib/memgraph/query_modules/schema.so \ +&& rm /usr/lib/memgraph/query_modules/example_cpp.so ENV LD_LIBRARY_PATH /usr/lib/memgraph/query_modules diff --git a/cpp/community_detection_module/algorithm/louvain.cpp b/cpp/community_detection_module/algorithm/louvain.cpp index 597e86f6d..4b31452e8 100644 --- a/cpp/community_detection_module/algorithm/louvain.cpp +++ b/cpp/community_detection_module/algorithm/louvain.cpp @@ -68,12 +68,12 @@ void LoadUndirectedEdges(const mg_graph::GraphView<> &memgraph_graph, GrappoloGr edge_index++; } - auto edge_list_ptrs = new long[number_of_vertices + 1]; + auto edge_list_ptrs = static_cast(malloc((number_of_vertices + 1) * sizeof(long))); if (edge_list_ptrs == nullptr) { throw mg_exception::NotEnoughMemoryException(); } - auto edge_list = new edge[number_of_edges * 2]; // Every edge stored twice + auto edge_list = static_cast(malloc(number_of_edges * 2 * sizeof(edge))); // Every edge stored twice if (edge_list == nullptr) { throw mg_exception::NotEnoughMemoryException(); }