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

在M1芯片的Mac操作系统中会出现如下问题 #81

Closed
boothua-cloud opened this issue Sep 6, 2023 · 3 comments
Closed

在M1芯片的Mac操作系统中会出现如下问题 #81

boothua-cloud opened this issue Sep 6, 2023 · 3 comments

Comments

@boothua-cloud
Copy link

错误信息:
(192.168.100.224,MacBook-Pro.local)-[p24702_t6128758784] 2023-09-06 17:14:55 - RabbitmqConsumerAmqpStorm--test - "base_consumer.py:501" - ___keep_circulating - ERROR - _shedual_task 运行出错
Traceback (most recent call last):
File "/opt/anaconda3/envs/MpcAgentBackend/lib/python3.9/asyncio/selector_events.py", line 256, in _add_reader
key = self._selector.get_key(fd)
File "/opt/anaconda3/envs/MpcAgentBackend/lib/python3.9/selectors.py", line 193, in get_key
raise KeyError("{!r} is not registered".format(fileobj)) from None
KeyError: '20 is not registered'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/opt/anaconda3/envs/MpcAgentBackend/lib/python3.9/site-packages/funboost/consumers/base_consumer.py", line 493, in ___keep_circulating
result = func(*args, **kwargs)
File "/opt/anaconda3/envs/MpcAgentBackend/lib/python3.9/site-packages/funboost/consumers/rabbitmq_amqpstorm_consumer.py", line 34, in _shedual_task
rp.channel.start_consuming(auto_decode=True)
File "/opt/anaconda3/envs/MpcAgentBackend/lib/python3.9/site-packages/amqpstorm/channel.py", line 358, in start_consuming
self.process_data_events(
File "/opt/anaconda3/envs/MpcAgentBackend/lib/python3.9/site-packages/amqpstorm/channel.py", line 329, in process_data_events
self._consumer_callbacksconsumer_tag
File "/opt/anaconda3/envs/MpcAgentBackend/lib/python3.9/site-packages/funboost/consumers/rabbitmq_amqpstorm_consumer.py", line 27, in callback
self._submit_task(kw)
File "/opt/anaconda3/envs/MpcAgentBackend/lib/python3.9/site-packages/funboost/consumers/base_consumer.py", line 637, in _submit_task
self.concurrent_pool.submit(self._run, kw)
File "/opt/anaconda3/envs/MpcAgentBackend/lib/python3.9/site-packages/funboost/utils/decorators.py", line 146, in lock_func
return func(*args, **kwargs)
File "/opt/anaconda3/envs/MpcAgentBackend/lib/python3.9/site-packages/funboost/consumers/base_consumer.py", line 469, in concurrent_pool
return self._concurrent_mode_dispatcher.build_pool()
File "/opt/anaconda3/envs/MpcAgentBackend/lib/python3.9/site-packages/funboost/consumers/base_consumer.py", line 1156, in build_pool
self.consumer._concurrent_pool = self.consumer._specify_concurrent_pool if self.consumer._specify_concurrent_pool is not None else pool_type(
File "/opt/anaconda3/envs/MpcAgentBackend/lib/python3.9/site-packages/funboost/concurrent_pool/flexible_thread_pool.py", line 35, in init
self.asyncio_loop = asyncio.new_event_loop()
TypeError: changelist must be an iterable of select.kevent objects

Traceback (most recent call last):
File "/opt/anaconda3/envs/MpcAgentBackend/lib/python3.9/asyncio/selector_events.py", line 256, in _add_reader
key = self._selector.get_key(fd)
File "/opt/anaconda3/envs/MpcAgentBackend/lib/python3.9/selectors.py", line 193, in get_key
raise KeyError("{!r} is not registered".format(fileobj)) from None
KeyError: '20 is not registered'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/opt/anaconda3/envs/MpcAgentBackend/lib/python3.9/site-packages/funboost/consumers/base_consumer.py", line 493, in ___keep_circulating
result = func(*args, **kwargs)
File "/opt/anaconda3/envs/MpcAgentBackend/lib/python3.9/site-packages/funboost/consumers/rabbitmq_amqpstorm_consumer.py", line 34, in _shedual_task
rp.channel.start_consuming(auto_decode=True)
File "/opt/anaconda3/envs/MpcAgentBackend/lib/python3.9/site-packages/amqpstorm/channel.py", line 358, in start_consuming
self.process_data_events(
File "/opt/anaconda3/envs/MpcAgentBackend/lib/python3.9/site-packages/amqpstorm/channel.py", line 329, in process_data_events
self._consumer_callbacksconsumer_tag
File "/opt/anaconda3/envs/MpcAgentBackend/lib/python3.9/site-packages/funboost/consumers/rabbitmq_amqpstorm_consumer.py", line 27, in callback
self._submit_task(kw)
File "/opt/anaconda3/envs/MpcAgentBackend/lib/python3.9/site-packages/funboost/consumers/base_consumer.py", line 637, in _submit_task
self.concurrent_pool.submit(self._run, kw)
File "/opt/anaconda3/envs/MpcAgentBackend/lib/python3.9/site-packages/funboost/utils/decorators.py", line 146, in lock_func
return func(*args, **kwargs)
File "/opt/anaconda3/envs/MpcAgentBackend/lib/python3.9/site-packages/funboost/consumers/base_consumer.py", line 469, in concurrent_pool
return self._concurrent_mode_dispatcher.build_pool()
File "/opt/anaconda3/envs/MpcAgentBackend/lib/python3.9/site-packages/funboost/consumers/base_consumer.py", line 1156, in build_pool
self.consumer._concurrent_pool = self.consumer._specify_concurrent_pool if self.consumer._specify_concurrent_pool is not None else pool_type(
File "/opt/anaconda3/envs/MpcAgentBackend/lib/python3.9/site-packages/funboost/concurrent_pool/flexible_thread_pool.py", line 35, in init
self.asyncio_loop = asyncio.new_event_loop()
File "/opt/anaconda3/envs/MpcAgentBackend/lib/python3.9/asyncio/events.py", line 761, in new_event_loop
return get_event_loop_policy().new_event_loop()
File "/opt/anaconda3/envs/MpcAgentBackend/lib/python3.9/asyncio/events.py", line 659, in new_event_loop
return self._loop_factory()
File "/opt/anaconda3/envs/MpcAgentBackend/lib/python3.9/asyncio/unix_events.py", line 54, in init
super().init(selector)
File "/opt/anaconda3/envs/MpcAgentBackend/lib/python3.9/asyncio/selector_events.py", line 56, in init
self._make_self_pipe()
File "/opt/anaconda3/envs/MpcAgentBackend/lib/python3.9/asyncio/selector_events.py", line 107, in _make_self_pipe
self._add_reader(self._ssock.fileno(), self._read_from_self)
File "/opt/anaconda3/envs/MpcAgentBackend/lib/python3.9/asyncio/selector_events.py", line 258, in _add_reader
self._selector.register(fd, selectors.EVENT_READ,
File "/opt/anaconda3/envs/MpcAgentBackend/lib/python3.9/selectors.py", line 523, in register
self._selector.control([kev], 0, 0)
TypeError: changelist must be an iterable of select.kevent objects
Exception ignored in: <function BaseEventLoop.del at 0x107687f70>
Traceback (most recent call last):
File "/opt/anaconda3/envs/MpcAgentBackend/lib/python3.9/asyncio/base_events.py", line 688, in del
self.close()
File "/opt/anaconda3/envs/MpcAgentBackend/lib/python3.9/asyncio/unix_events.py", line 60, in close
for sig in list(self._signal_handlers):
AttributeError: '_UnixSelectorEventLoop' object has no attribute '_signal_handlers'
代码:

def add(x, y):
    print(x + y)
    return x + y
if __name__ == '__main__':
    booster = get_or_create_booster(f'test', broker_kind=BrokerEnum.RABBITMQ_AMQPSTORM,
                                    consuming_function=add)
    booster.push(x=1, y=2)
    booster.start()

详细描述:

  • 当add为非async函数时,将并发模式设置为:concurrent_mode=ConcurrentModeEnum.SINGLE_THREAD可以正常运行;
  • 当add为async函数时,则会出现上面的错误,无论并发模式为哪种;
  • 在amd64芯片的ubuntu系统中测试,暂时未发现错误,arm64的linux操作系统暂时未测试
@ydf0509
Copy link
Owner

ydf0509 commented Sep 6, 2023

image
那把funboost/concurrent_pool/flexible_thread_pool.py 35行去掉吧,下个版本我去掉这行.没用的一行

@boothua-cloud
Copy link
Author

arm64 芯片上测试没问题,只有M1 Mac会出现这个问题

@ydf0509
Copy link
Owner

ydf0509 commented Sep 6, 2023

可以去掉这行,多余的一行废物代码,下次发版去掉35行

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

2 participants