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

TypeError: cannot pickle '_thread.lock' object #1

Open
ruevaughn opened this issue May 22, 2022 · 3 comments
Open

TypeError: cannot pickle '_thread.lock' object #1

ruevaughn opened this issue May 22, 2022 · 3 comments

Comments

@ruevaughn
Copy link

Hi, i'm getting this error when I try to run with the following command: python main.py -c ../config -i -s 505

Traceback (most recent call last):
  File "/Users/cjensen/projects/T-Reqs-HTTP-Fuzzer/code/main.py", line 165, in <module>
    fuzzer.blackbox_fuzz_individual(fuzzer.seedfile, [fuzzer.seed])
  File "/Users/cjensen/projects/T-Reqs-HTTP-Fuzzer/code/main.py", line 117, in blackbox_fuzz_individual
    proc.start()
  File "/Users/cjensen/.pyenv/versions/3.9.11/lib/python3.9/multiprocessing/process.py", line 121, in start
    self._popen = self._Popen(self)
  File "/Users/cjensen/.pyenv/versions/3.9.11/lib/python3.9/multiprocessing/context.py", line 224, in _Popen
    return _default_context.get_context().Process._Popen(process_obj)
  File "/Users/cjensen/.pyenv/versions/3.9.11/lib/python3.9/multiprocessing/context.py", line 284, in _Popen
    return Popen(process_obj)
  File "/Users/cjensen/.pyenv/versions/3.9.11/lib/python3.9/multiprocessing/popen_spawn_posix.py", line 32, in __init__
    super().__init__(process_obj)
  File "/Users/cjensen/.pyenv/versions/3.9.11/lib/python3.9/multiprocessing/popen_fork.py", line 19, in __init__
    self._launch(process_obj)
  File "/Users/cjensen/.pyenv/versions/3.9.11/lib/python3.9/multiprocessing/popen_spawn_posix.py", line 47, in _launch
    reduction.dump(process_obj, fp)
  File "/Users/cjensen/.pyenv/versions/3.9.11/lib/python3.9/multiprocessing/reduction.py", line 60, in dump
    ForkingPickler(file, protocol).dump(obj)
TypeError: cannot pickle '_thread.lock' object

Any idea what I can do?

@bahruzjabiyev
Copy link
Owner

I am not sure, it might be because of the python version you use. I know that t-reqs works with 3.6. If you find an easy solution to this problem, please let us know; we might just add that to the code.

@ertygiq
Copy link

ertygiq commented Dec 1, 2023

This is due to self.lock = threading.Lock() instance variable.
Move the lock out of the class (e.g., to global variable) and the code will work with the latest python version.

@An-Bin
Copy link

An-Bin commented Jul 25, 2024

这是由于self.lock = threading.Lock()实例变量造成的。 将锁移出类(例如移至全局变量),代码将适用于最新的 Python 版本。

你好,在Python3.7中也遇到了类似的问题,应该怎么操作呢?能具体的说一下步骤吗,谢谢!
Namespace(config='../config', individual_mode=False, no_sending=False, outfilename=None, seed=None, seedfile=None, verbose=False)
Traceback (most recent call last):
File "main.py", line 186, in
fuzzer.blackbox_fuzz_parallel_batch()
File "main.py", line 105, in blackbox_fuzz_parallel_batch
proc.start()
File "D:\SoftWare\Python37\lib\multiprocessing\process.py", line 112, in start
self._popen = self._Popen(self)
File "D:\SoftWare\Python37\lib\multiprocessing\context.py", line 223, in _Popen
return _default_context.get_context().Process._Popen(process_obj)
File "D:\SoftWare\Python37\lib\multiprocessing\context.py", line 322, in _Popen
return Popen(process_obj)
File "D:\SoftWare\Python37\lib\multiprocessing\popen_spawn_win32.py", line 89, in init
reduction.dump(process_obj, to_child)
File "D:\SoftWare\Python37\lib\multiprocessing\reduction.py", line 60, in dump
ForkingPickler(file, protocol).dump(obj)
TypeError: can't pickle _thread.lock objects

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants