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

Clamav error for scanning large files #7

Open
ilchebedelovski opened this issue Apr 4, 2024 · 0 comments
Open

Clamav error for scanning large files #7

ilchebedelovski opened this issue Apr 4, 2024 · 0 comments

Comments

@ilchebedelovski
Copy link

ilchebedelovski commented Apr 4, 2024

Hi,

I have a ClamAV service running on a k8s cluster where my CKAN is deployed. This clamav extension is installed on the CKAN environment and it is working fine for viruses scanning.

I am getting this error for files larger than 10MB, it is happening randomly.

clamd.ResponseError
clamd.ResponseError: COMMAND READ TIMED OUT
Traceback (most recent call last)
* File "/usr/local/lib/python3.8/dist-packages/clamd/__init__.py", line 268, in _parse_response


 return scan_response.match(msg).group("path", "virus", "status")



* During handling of the above exception, another exception occurred:

* File "/usr/local/lib/python3.8/dist-packages/flask/app.py", line 2449, in wsgi_app


 response = self.handle_exception(e)



* File "/usr/local/lib/python3.8/dist-packages/flask/app.py", line 1866, in handle_exception


 reraise(exc_type, exc_value, tb)



* File "/usr/local/lib/python3.8/dist-packages/flask/_compat.py", line 39, in reraise


 raise value



* File "/usr/local/lib/python3.8/dist-packages/flask/app.py", line 2446, in wsgi_app


 response = self.full_dispatch_request()



* File "/usr/local/lib/python3.8/dist-packages/flask/app.py", line 1951, in full_dispatch_request


 rv = self.handle_user_exception(e)



* File "/usr/local/lib/python3.8/dist-packages/flask/app.py", line 1820, in handle_user_exception


 reraise(exc_type, exc_value, tb)



* File "/usr/local/lib/python3.8/dist-packages/flask/_compat.py", line 39, in reraise


 raise value



* File "/usr/local/lib/python3.8/dist-packages/flask/app.py", line 1949, in full_dispatch_request


 rv = self.dispatch_request()



* File "/usr/local/lib/python3.8/dist-packages/flask_debugtoolbar/__init__.py", line 125, in dispatch_request


 return view_func(**req.view_args)



* File "/usr/local/lib/python3.8/dist-packages/flask/views.py", line 89, in view


 return self.dispatch_request(*args, **kwargs)



* File "/usr/local/lib/python3.8/dist-packages/flask/views.py", line 163, in dispatch_request


 return meth(*args, **kwargs)


* File "/usr/local/lib/python3.8/dist-packages/ckanext/relation/views.py", line 243, in post


 tk.get_action("resource_create")(context, data)



* File "/srv/app/src/ckan/ckan/logic/__init__.py", line 504, in wrapped


 result = _action(context, data_dict, **kw)



* File "/srv/app/src/ckan/ckan/logic/action/create.py", line 305, in resource_create


 upload = uploader.get_resource_uploader(data_dict)



* File "/srv/app/src/ckan/ckan/lib/uploader.py", line 69, in get_resource_uploader


 upload = plugin.get_resource_uploader(data_dict)



* File "/usr/local/lib/python3.8/dist-packages/ckanext/clamav/plugin.py", line 24, in get_resource_uploader


 scan_file_for_viruses(data_dict)


* File "/usr/local/lib/python3.8/dist-packages/ckanext/clamav/utils.py", line 43, in scan_file_for_viruses


 status, signature = _scan_filestream(file)



* File "/usr/local/lib/python3.8/dist-packages/ckanext/clamav/utils.py", line 104, in _scan_filestream


 scan_result: dict[str, tuple[str, Optional[str]]] = cd.instream(file.stream)



* File "/usr/local/lib/python3.8/dist-packages/clamd/__init__.py", line 201, in instream


 filename, reason, status = self._parse_response(result)



* File "/usr/local/lib/python3.8/dist-packages/clamd/__init__.py", line 270, in _parse_response


 raise ResponseError(msg.rsplit("ERROR", 1)[0])



clamd.ResponseError: COMMAND READ TIMED OUT
This is the Copy/Paste friendly version of the traceback. You can also paste this traceback into a gist:
Traceback (most recent call last): File "/usr/local/lib/python3.8/dist-packages/clamd/__init__.py", line 268, in _parse_response return scan_response.match(msg).group("path", "virus", "status") AttributeError: 'NoneType' object has no attribute 'group' During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/usr/local/lib/python3.8/dist-packages/flask/app.py", line 2449, in wsgi_app response = self.handle_exception(e) File "/usr/local/lib/python3.8/dist-packages/flask/app.py", line 1866, in handle_exception reraise(exc_type, exc_value, tb) File "/usr/local/lib/python3.8/dist-packages/flask/_compat.py", line 39, in reraise raise value File "/usr/local/lib/python3.8/dist-packages/flask/app.py", line 2446, in wsgi_app response = self.full_dispatch_request() File "/usr/local/lib/python3.8/dist-packages/flask/app.py", line 1951, in full_dispatch_request rv = self.handle_user_exception(e) File "/usr/local/lib/python3.8/dist-packages/flask/app.py", line 1820, in handle_user_exception reraise(exc_type, exc_value, tb) File "/usr/local/lib/python3.8/dist-packages/flask/_compat.py", line 39, in reraise raise value File "/usr/local/lib/python3.8/dist-packages/flask/app.py", line 1949, in full_dispatch_request rv = self.dispatch_request() File "/usr/local/lib/python3.8/dist-packages/flask_debugtoolbar/__init__.py", line 125, in dispatch_request return view_func(**req.view_args) File "/usr/local/lib/python3.8/dist-packages/flask/views.py", line 89, in view return self.dispatch_request(*args, **kwargs) File "/usr/local/lib/python3.8/dist-packages/flask/views.py", line 163, in dispatch_request return meth(*args, **kwargs) File "/usr/local/lib/python3.8/dist-packages/ckanext/relation/views.py", line 243, in post tk.get_action("resource_create")(context, data) File "/srv/app/src/ckan/ckan/logic/__init__.py", line 504, in wrapped result = _action(context, data_dict, **kw) File "/srv/app/src/ckan/ckan/logic/action/create.py", line 305, in resource_create upload = uploader.get_resource_uploader(data_dict) File "/srv/app/src/ckan/ckan/lib/uploader.py", line 69, in get_resource_uploader upload = plugin.get_resource_uploader(data_dict) File "/usr/local/lib/python3.8/dist-packages/ckanext/clamav/plugin.py", line 24, in get_resource_uploader scan_file_for_viruses(data_dict) File "/usr/local/lib/python3.8/dist-packages/ckanext/clamav/utils.py", line 43, in scan_file_for_viruses status, signature = _scan_filestream(file) File "/usr/local/lib/python3.8/dist-packages/ckanext/clamav/utils.py", line 104, in _scan_filestream scan_result: dict[str, tuple[str, Optional[str]]] = cd.instream(file.stream) File "/usr/local/lib/python3.8/dist-packages/clamd/__init__.py", line 201, in instream filename, reason, status = self._parse_response(result) File "/usr/local/lib/python3.8/dist-packages/clamd/__init__.py", line 270, in _parse_response raise ResponseError(msg.rsplit("ERROR", 1)[0]) clamd.ResponseError: COMMAND READ TIMED OUT
The debugger caught an exception in your WSGI application. You can now look at the traceback which led to the error. If you enable JavaScript you can also use additional features such as code execution (if the evalex feature is enabled), automatic pasting of the exceptions and much more.
Brought to you by DON'T PANIC, your friendly Werkzeug powered traceback interpreter.

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

1 participant