Trouble reloading a custom .so module in Memgraph Platform

51 Views Asked by At

I have a custom C++ module traMap.so that is loaded and works fine in my Memgraph Platform setup. After making some changes to it, rebuilding it, and trying to reload it using mg.load("traMap"), I find that despite the reloading process indicating success, the function calls still run the old code and not the updated one.

It seems like the module isn't really reloaded. I have placed the .so file in /usr/lib/memgraph/query_modules as I believe that's where it should be according to the --query-modules-directory setting which I haven't changed. Is there any step I'm missing to ensure the updated module is loaded?

1

There are 1 best solutions below

0
On BEST ANSWER

The issue you're facing can be related to how Linux handles file references by running processes. The running Memgraph process still references the old file. New processes that openes the file will get the new content.

Try this two options:

  1. Delete the old .so file, then copy over the new file before calling mg.load. The old file reference will be removed, and the new file is loaded as expected when mg.load is called.

  2. Use the install command to place the new file. The install command is a basic Linux command used to copy files and set attributes. Here's how you might use the install command to copy over your updated .so file:

    install -m 0755 /path/to/your/updated/traMap.so /usr/lib/memgraph/query_modules
    

EDIT: I've done some more digging. This is maybe also a bug according to this GitHub issue https://github.com/memgraph/mage/issues/381.