errbotio / errbot

Errbot is a chatbot, a daemon that connects to your favorite chat service and bring your tools and some fun into the conversation.
http://errbot.io
GNU General Public License v3.0
3.12k stars 612 forks source link

The bot ThreadPool is closed while processing a command #1558

Closed Atlas974 closed 7 months ago

Atlas974 commented 2 years ago

Describe the bug The bot ThreadPool is closed while processing a command.

To Reproduce Not identified.

Expected behavior The bot ThreadPool should be running?

Environment (please complete the following information):

Additional context

2022-02-18 14:21:15,141 DEBUG    urllib3.connectionpool    Starting new HTTPS connection (1): mattermost.<mydomain>:443
2022-02-18 14:21:15,188 DEBUG    urllib3.connectionpool    https://mattermost.<mydomain>:443 "GET /api/v4/users/<myuserid> HTTP/1.1" 200 398
2022-02-18 14:21:15,189 DEBUG    errbot.core               *** frm = ~town-square/<myuser>
2022-02-18 14:21:15,190 DEBUG    errbot.core               *** username = @<myuser>
2022-02-18 14:21:15,190 DEBUG    errbot.core               *** text = <botname> help
2022-02-18 14:21:15,190 DEBUG    errbot.core               Called with alternate prefix "<botname>"
2022-02-18 14:21:15,190 DEBUG    errbot.plugins.ACLs       Check help for ACLs.
2022-02-18 14:21:15,191 INFO     errbot.plugins.ACLs       Matching ACL {'allowusers': ('*',)} against username @<myuser> for command Help:help.
2022-02-18 14:21:15,191 DEBUG    errbot.plugins.ACLs       Check if help is admin only command.
2022-02-18 14:21:15,191 INFO     errbot.core               Processing command "help" with parameters "" from ~town-square/<myuser>
2022-02-18 14:21:15,191 ERROR    errbot.backends.mattermost posted event handler raised an exception
Traceback (most recent call last):
  File "<>/backends/mattermost/mattermost.py", line 123, in mattermost_event_handler
    event_handler(payload)
  File "<>/backends/mattermost/mattermost.py", line 246, in _message_event_handler
    self.callback_message(msg)
  File "<>/conda/envs/<envname>/lib/python3.8/site-packages/errbot/core.py", line 701, in callback_message
    if self.process_message(msg):
  File "<>/conda/envs/<envname>/lib/python3.8/site-packages/errbot/core.py", line 397, in process_message
    self._process_command(msg, cmd, args, match=None)
  File "<>/conda/envs/<envname>/lib/python3.8/site-packages/errbot/core.py", line 475, in _process_command
    result = self.thread_pool.apply_async(
  File "<>/conda/envs/<envname>/lib/python3.8/multiprocessing/pool.py", line 455, in apply_async
    self._check_running()
  File "<>/conda/envs/<envname>/lib/python3.8/multiprocessing/pool.py", line 350, in _check_running
    raise ValueError("Pool not running")
ValueError: Pool not running
nzlosh commented 2 years ago

What are BOT_ASYNC and BOT_ASYNC_POOLSIZE set to in the configuration?

Atlas974 commented 2 years ago

What are BOT_ASYNC and BOT_ASYNC_POOLSIZE set to in the configuration?

I'm using the default values:

nzlosh commented 2 years ago

I'm unable to reproduce this problem running errbot in a virtualenv

I tried BOT_ASYNC as true and false, BOT_ASYNC_POOLSIZE set 1, 5, 10 and 20.

errbot -v
Errbot version 6.1.8

lsb_release -a
LSB Version:    :core-4.1-amd64:core-4.1-noarch:cxx-4.1-amd64:cxx-4.1-noarch:desktop-4.1-amd64:desktop-4.1-noarch:languages-4.1-amd64:languages-4.1-noarch:printing-4.1-amd64:printing-4.1-noarch
Distributor ID: CentOS
Description:    CentOS Linux release 8.5.2111
Release:        8.5.2111
Codename:       n/a

python --version
Python 3.8.8

pip freeze | grep matter
mattermostdriver==7.3.2

mattermost backend commit 38dd066e5a95495698eb51f5969d73ad3c554b78

bin/mattermost version
Version: 6.5.0
Build Number: 6.5.0
Build Date: Tue Mar 15 15:36:47 UTC 2022
Build Hash: 7fff157bcf85b54d595e22262a66d7f28d4b5a68
Build Enterprise Ready: true
nzlosh commented 2 years ago

OK, I misread CentOS7 as CentOS8, I'll test using 7.

nzlosh commented 2 years ago

CentOS7 doesn't come with Python3.8 packaging, so I compiled from source and setup a virtualenv.

lsb_release -a
LSB Version:    :core-4.1-amd64:core-4.1-noarch:cxx-4.1-amd64:cxx-4.1-noarch:desktop-4.1-amd64:desktop-4.1-noarch:languages-4.1-amd64:languages-4.
1-noarch:printing-4.1-amd64:printing-4.1-noarch
Distributor ID: CentOS
Description:    CentOS Linux release 7.9.2009 (Core)
Release:        7.9.2009
Codename:       Core

errbot -v
Errbot version 6.1.8

python --version
Python 3.8.13

pip freeze | grep mattermost
mattermostdriver==7.3.2

I'm still unable to reproduce the errors you're seeing.

sijis commented 2 years ago

@Atlas974 This should be fixed in master. Could you try running from the master branch?

sijis commented 7 months ago

We've had several releases and no responses. closing.