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

AttributeError: 'c_int' object has no attribute '_wrapper' on macOS (Intel and ARM/Apple Silicon) #132

Closed
briandefiant opened this issue Nov 13, 2023 · 1 comment · Fixed by #145 or #150
Assignees
Labels
bug Something isn't working dev-complete Development work to resolve this issue is complete platform-specific A platform-specific issue or an inquiry about platform support qa-passed QA has tested and confirmed the fix for this issue
Milestone

Comments

@briandefiant
Copy link
Contributor

Full stacktrace is below. This can be reproduced on macOS by installing WF CLI via pip and running wordfence malware-scan ..

It appears to be related to macOS using the spawn start method for multiprocessing (instead of fork, the default on Linux). Forcing the start method to use fork works around the issue, though that probably isn't advisable.

Traceback (most recent call last):
  File "/opt/homebrew/bin/wordfence", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File "/opt/homebrew/lib/python3.11/site-packages/wordfence/cli/cli.py", line 181, in main
    exit_code = cli.invoke()
                ^^^^^^^^^^^^
  File "/opt/homebrew/lib/python3.11/site-packages/wordfence/cli/cli.py", line 175, in invoke
    return self.process_exception(exception)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/lib/python3.11/site-packages/wordfence/cli/cli.py", line 102, in process_exception
    raise exception
  File "/opt/homebrew/lib/python3.11/site-packages/wordfence/cli/cli.py", line 171, in invoke
    return self.subcommand.invoke()
           ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/lib/python3.11/site-packages/wordfence/cli/malwarescan/malwarescan.py", line 181, in invoke
    self.scanner.scan(
  File "/opt/homebrew/lib/python3.11/site-packages/wordfence/scanning/scanner.py", line 787, in scan
    with ScanWorkerPool(
  File "/opt/homebrew/lib/python3.11/site-packages/wordfence/scanning/scanner.py", line 597, in __enter__
    self.start()
  File "/opt/homebrew/lib/python3.11/site-packages/wordfence/scanning/scanner.py", line 654, in start
    worker.start()
  File "/opt/homebrew/Cellar/python@3.11/3.11.5/Frameworks/Python.framework/Versions/3.11/lib/python3.11/multiprocessing/process.py", line 121, in start
    self._popen = self._Popen(self)
                  ^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/python@3.11/3.11.5/Frameworks/Python.framework/Versions/3.11/lib/python3.11/multiprocessing/context.py", line 224, in _Popen
    return _default_context.get_context().Process._Popen(process_obj)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/python@3.11/3.11.5/Frameworks/Python.framework/Versions/3.11/lib/python3.11/multiprocessing/context.py", line 288, in _Popen
    return Popen(process_obj)
           ^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/python@3.11/3.11.5/Frameworks/Python.framework/Versions/3.11/lib/python3.11/multiprocessing/popen_spawn_posix.py", line 32, in __init__
    super().__init__(process_obj)
  File "/opt/homebrew/Cellar/python@3.11/3.11.5/Frameworks/Python.framework/Versions/3.11/lib/python3.11/multiprocessing/popen_fork.py", line 19, in __init__
    self._launch(process_obj)
  File "/opt/homebrew/Cellar/python@3.11/3.11.5/Frameworks/Python.framework/Versions/3.11/lib/python3.11/multiprocessing/popen_spawn_posix.py", line 47, in _launch
    reduction.dump(process_obj, fp)
  File "/opt/homebrew/Cellar/python@3.11/3.11.5/Frameworks/Python.framework/Versions/3.11/lib/python3.11/multiprocessing/reduction.py", line 60, in dump
    ForkingPickler(file, protocol).dump(obj)
  File "/opt/homebrew/Cellar/python@3.11/3.11.5/Frameworks/Python.framework/Versions/3.11/lib/python3.11/multiprocessing/sharedctypes.py", line 133, in reduce_ctype
    return rebuild_ctype, (type(obj), obj._wrapper, None)
                                      ^^^^^^^^^^^^
AttributeError: 'c_int' object has no attribute '_wrapper'
@briandefiant briandefiant added the bug Something isn't working label Nov 13, 2023
@akenion akenion added the platform-specific A platform-specific issue or an inquiry about platform support label Nov 13, 2023
@akenion akenion added this to the v2.1.0 milestone Nov 13, 2023
@akenion akenion self-assigned this Nov 16, 2023
@akenion akenion added the dev-complete Development work to resolve this issue is complete label Nov 16, 2023
@akenion akenion added the qa-ready Issue is ready for QA and included in the most recent release candidate label Nov 21, 2023
@ewodrich
Copy link

Verified the error is no longer occurring on Mac.

First, verified I received the error Error: 'c_int' object has no attribute '_wrapper' when running wordfence malware-scan . on Mac Ventura running CLI 2.0.3. Installed the latest test CLI version, 2.1.0 rc2, and retried the command wordfence malware-scan . which ran through the scan without error and produced expected results.

@ewodrich ewodrich added qa-passed QA has tested and confirmed the fix for this issue and removed qa-ready Issue is ready for QA and included in the most recent release candidate labels Nov 27, 2023
@akenion akenion assigned akenion and ewodrich and unassigned akenion and ewodrich Nov 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working dev-complete Development work to resolve this issue is complete platform-specific A platform-specific issue or an inquiry about platform support qa-passed QA has tested and confirmed the fix for this issue
Projects
None yet
3 participants