Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Possible memory leak on VenturaOS #48

Open
LaansDole opened this issue Jul 24, 2023 · 3 comments
Open

Possible memory leak on VenturaOS #48

LaansDole opened this issue Jul 24, 2023 · 3 comments
Assignees
Labels
bug Something isn't working in progress Work is being done on this

Comments

@LaansDole
Copy link
Collaborator

23-7-2023_imdupes_run_VenturaOS.txt

Here is the result from my Test run

@miketvo miketvo self-assigned this Jul 27, 2023
@miketvo miketvo added bug Something isn't working in progress Work is being done on this labels Jul 27, 2023
@github-project-automation github-project-automation bot moved this to Todo in Imdupes Jul 27, 2023
@miketvo miketvo moved this from Todo to In Progress in Imdupes Jul 27, 2023
@miketvo miketvo moved this from In Progress to Todo in Imdupes Jul 27, 2023
@miketvo
Copy link
Owner

miketvo commented Jul 30, 2023

From ChatGPT Prompt:

Everything works well on Linux. However, on macOS, when I try `brew install imdupes` I get the following warning:

Error: Failed changing dylib ID of /usr/local/Cellar/imdupes/0.2.5/libexec/venv/lib/python3.11/site-packages/PIL/.dylibs/libwebp.7.dylib
  from /DLC/PIL/.dylibs/libwebp.7.dylib
    to /usr/local/opt/imdupes/libexec/venv/lib/python3.11/site-packages/PIL/.dylibs/libwebp.7.dylib
Error: Failed to fix install linkage
The formula built, but you may encounter issues using it or linking other
formulae against it.

The program is still built and is working though. Can you explain what that warning is about and how I can deal with it?

Answer:

The warning you are seeing during the brew install imdupes process is related to the dynamic library (dylib) file libwebp.7.dylib. The warning is indicating that there was an issue changing the dylib ID of this file during the installation process.

A dynamic library is a shared library that is linked at runtime by other programs and libraries. The dylib ID is an identifier embedded in the dylib file that specifies its path. In this case, the formula is trying to change the dylib ID of libwebp.7.dylib to a new path within the Homebrew Cellar for imdupes (/usr/local/Cellar/imdupes/0.2.5/libexec/venv/lib/python3.11/site-packages/PIL/.dylibs/libwebp.7.dylib).

The warning is likely happening because of how the dynamic library is being linked in your project. It's possible that the library has a fixed dylib ID that is conflicting with the Homebrew installation process, leading to this warning. The program still builds and works because the dylib file is successfully installed, but the warning is indicating that there may be potential issues with the library's linkage.

To address this warning, you can try the following steps:

  1. Make sure your Python project and its dependencies are correctly configured to work with Homebrew. Double-check the build.py script, the PyInstaller configuration, and any other settings related to library paths.

  2. Check the dylib ID of libwebp.7.dylib in your Python project. You can use the otool command in the terminal to do this:

    otool -D /path/to/your/project/libs/libwebp.7.dylib

    If the dylib ID is fixed and not pointing to a relative or variable path, you might need to adjust the linkage to make it compatible with Homebrew's installation paths.

  3. Consider using relative paths or variable paths for the dylib ID in your Python project. This can help avoid conflicts with Homebrew's installation paths.

  4. If the warning persists and the program works fine, you can consider ignoring the warning for now. Keep in mind that it may lead to issues in the future if other formulae or libraries are linked against imdupes or if you update Homebrew or your Python environment.

  5. To suppress the warning, you can use the HOMEBREW_NO_ENV_FILTERING environment variable when installing the formula:

    HOMEBREW_NO_ENV_FILTERING=1 brew install imdupes

    However, it's essential to understand that this will only hide the warning and not address the root cause.

  6. If you cannot resolve the warning, you might want to consider reaching out to the Homebrew community or the maintainers of the Python dependencies you are using to seek further assistance and insights into the issue.

As always, when working with dynamic libraries and build environments, it's crucial to ensure that your project is correctly configured and tested to avoid potential issues down the line.

If you have any further questions or need additional help, please let me know!

@miketvo
Copy link
Owner

miketvo commented Jul 30, 2023

From ChatGPT Prompt:

On the same macOS (Ventura), when I run imdupes, I get the following warning after my program exits:

multiprocessing/resource_tracker.py:104: UserWarning: resource_tracker: process died unexpectedly, relaunching.  Some resources might leak.

What is it and how do I deal with it?

Answer:

The warning you are seeing:

multiprocessing/resource_tracker.py:104: UserWarning: resource_tracker: process died unexpectedly, relaunching. Some resources might leak.

is related to the multiprocessing module in Python. The multiprocessing module is used to create and manage processes, and the resource tracker is responsible for managing shared resources used by these processes. The warning is indicating that one of the processes managed by the resource tracker has died unexpectedly, and as a result, the resource tracker is relaunching the process.

This warning typically occurs when a process spawned by the multiprocessing module crashes or exits abruptly without cleaning up properly. When this happens, the resource tracker tries to relaunch the process to prevent resource leaks, but there might be some lingering resources that are not properly released.

To deal with this warning, you can follow these steps:

  1. Check for Any Unhandled Exceptions: The warning could be caused by unhandled exceptions in your code or in the code of any Python libraries you are using. Make sure to catch and handle exceptions properly in your code to avoid unexpected process terminations.

  2. Properly Terminate Child Processes: If you are spawning multiple processes using the multiprocessing module, ensure that you are terminating them correctly when they are no longer needed. Use process.terminate() or process.join() to ensure clean process termination.

  3. Use a try-except Block: When working with the multiprocessing module, wrap the code in a try-except block to catch any exceptions that might occur and take appropriate action, such as terminating the process gracefully.

  4. Properly Manage Shared Resources: If your processes are using shared resources (e.g., shared memory, queues, or locks), make sure to release these resources properly when they are no longer needed. Failing to release shared resources can cause issues with the resource tracker.

  5. Update Python and Libraries: Ensure that you are using the latest versions of Python and any relevant libraries, as newer versions may include bug fixes related to the resource tracker.

  6. Debug the Issue: If the warning persists and you cannot identify the root cause, you may need to use debugging techniques to track down the source of the unexpected process termination.

It's important to note that the warning is a sign that something unexpected is happening with the multiprocessing module in your code. While the resource tracker attempts to relaunch the process, it's still best to investigate and address the underlying issue to ensure that your program is running correctly and efficiently.

If you need further assistance in debugging or addressing this warning, feel free to share more details about your code and how you are using the multiprocessing module.

@miketvo
Copy link
Owner

miketvo commented Jul 30, 2023

@LaansDole This doesn't look like a critical bug, however I have a feeling this will be very hard to debug. If you have time, please let me know if you want to debug this for me, since I don't own a Mac.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working in progress Work is being done on this
Projects
Status: Todo
Development

No branches or pull requests

2 participants