progval / Limnoria

A robust, full-featured, and user/programmer-friendly Python IRC bot, with many existing plugins.
https://docs.limnoria.net/
Other
616 stars 171 forks source link

SedRegex doesn't work anymore for me in Windows 11 because of error spawning processes #1567

Open inhahe opened 9 months ago

inhahe commented 9 months ago

SedRegex randomly stopped working for me on Windows 11. I had to switch the bot to running on WSL, now it works. I tried rebooting, I tried installing the latest Python and installing the latest Limnoria on it, didn't help. Here's the traceback:

Traceback (most recent call last):
  File "C:\venv\dumb_bot\Lib\site-packages\supybot\plugins\SedRegex\plugin.py", line 180, in replacer
    message = process(self._replacer_process, irc, msg,
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\venv\dumb_bot\Lib\site-packages\supybot\commands.py", line 141, in process
    p.start()
  File "C:\Python3.11.2\Lib\multiprocessing\process.py", line 121, in start
    self._popen = self._Popen(self)
                  ^^^^^^^^^^^^^^^^^
  File "C:\Python3.11.2\Lib\multiprocessing\context.py", line 224, in _Popen
    return _default_context.get_context().Process._Popen(process_obj)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Python3.11.2\Lib\multiprocessing\context.py", line 336, in _Popen
    return Popen(process_obj)
           ^^^^^^^^^^^^^^^^^^
  File "C:\Python3.11.2\Lib\multiprocessing\popen_spawn_win32.py", line 94, in __init__
    reduction.dump(process_obj, to_child)
  File "C:\Python3.11.2\Lib\multiprocessing\reduction.py", line 60, in dump
    ForkingPickler(file, protocol).dump(obj)
_pickle.PicklingError: args[0] from __newobj__ args has the wrong class
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "C:\Python3.11.2\Lib\multiprocessing\spawn.py", line 111, in spawn_main
    new_handle = reduction.duplicate(pipe_handle,
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Python3.11.2\Lib\multiprocessing\reduction.py", line 79, in duplicate
    return _winapi.DuplicateHandle(
           ^^^^^^^^^^^^^^^^^^^^^^^^
OSError: [WinError 6] The handle is invalid
Advertisement
progval commented 9 months ago

Could you add debug logs? (To get them, set supybot.log.level or supybot.log.stdout.level to DEBUG, trigger the crash, then set it back to INFO)

inhahe commented 9 months ago
DEBUG 2023-12-15T02:42:22 Incoming message (Undernet): :inhahe`!~inhahe@inhahe.users.undernet.org PRIVMSG #music&love :45this is a test
DEBUG 2023-12-15T02:42:29 Incoming message (Undernet): :inhahe`!~inhahe@inhahe.users.undernet.org PRIVMSG #music&love :s/test/testing/
DEBUG 2023-12-15T02:42:29 SedRegex: running on Undernet/#music&love for <re.Match object; span=(0, 15), match='s/test/testing/'>
DEBUG 2023-12-15T02:42:29 Spawning process Process #1 (for SedRegex.replacer) (args: (<bound method SedRegex._replacer_process of <SedRegex SedRegex <SedRegex.plugin.SedRegex object at 0x000002866EB53C90>>>, <multiprocessing.queues.Queue object at 0x000002866ED373D0>, <supybot.callbacks.ReplyIrcProxy object at 0x000002866ED6FF90>, IrcMsg(server_tags={}, prefix="inhahe`!~inhahe@inhahe.users.undernet.org", command="PRIVMSG", args=('#music&love', 's/test/testing/')), None, re.compile('test'), 'testing', 1, <reversed object at 0x000002866EB44460>))
DEBUG 2023-12-15T02:42:29 Spawning process "Process #1 (for SedRegex.replacer)".
WARNING 2023-12-15T02:42:29 SedRegex replacer error: args[0] from __newobj__ args has the wrong class
Traceback (most recent call last):
  File "C:\venv\dumb_bot\Lib\site-packages\supybot\plugins\SedRegex\plugin.py", line 180, in replacer
    message = process(self._replacer_process, irc, msg,
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\venv\dumb_bot\Lib\site-packages\supybot\commands.py", line 141, in process
    p.start()
  File "C:\Python3.11.2\Lib\multiprocessing\process.py", line 121, in start
    self._popen = self._Popen(self)
                  ^^^^^^^^^^^^^^^^^
  File "C:\Python3.11.2\Lib\multiprocessing\context.py", line 224, in _Popen
    return _default_context.get_context().Process._Popen(process_obj)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Python3.11.2\Lib\multiprocessing\context.py", line 336, in _Popen
    return Popen(process_obj)
           ^^^^^^^^^^^^^^^^^^
  File "C:\Python3.11.2\Lib\multiprocessing\popen_spawn_win32.py", line 94, in __init__
    reduction.dump(process_obj, to_child)
  File "C:\Python3.11.2\Lib\multiprocessing\reduction.py", line 60, in dump
    ForkingPickler(file, protocol).dump(obj)
_pickle.PicklingError: args[0] from __newobj__ args has the wrong class
DEBUG 2023-12-15T02:42:29 Incoming message (Undernet): PRIVMSG #music&love :inhahe`: Error: _pickle.PicklingError: args[0] from __newobj__ args has the wrong class
DEBUG 2023-12-15T02:42:29 Outgoing message (Undernet): PRIVMSG #music&love :inhahe`: Error: _pickle.PicklingError: args[0] from __newobj__ args has the wrong class
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "C:\Python3.11.2\Lib\multiprocessing\spawn.py", line 111, in spawn_main
    new_handle = reduction.duplicate(pipe_handle,
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Python3.11.2\Lib\multiprocessing\reduction.py", line 79, in duplicate
    return _winapi.DuplicateHandle(
           ^^^^^^^^^^^^^^^^^^^^^^^^
OSError: [WinError 6] The handle is invalid