On Monday, May 8, 2023 at 6:36:13 AM UTC-7 Lisandro wrote:
Hey there! I recently updated to Web2py Version 2.24.1-stable+timestamp.2023.03.23.05.07.17 It uses python 3.9.14, running in production serving around 60 requests per second, using resources efficiently and running really smoothly :D Since the update, I'm seeing this error sporadically: *redis.exceptions.DataError: Invalid input of type: 'NoneType'. Convert to a bytes, string, int or float first.* This is the traceback: Traceback (most recent call last): File "applications/eldia/compiled/models.db.py", line 113, in <module> File "/var/www/medios/gluon/globals.py", line 979, in connect row = table(record_id, unique_key=unique_key) [...] File "/opt/virtualenvs/medios_py39/lib/python3.9/site-packages/redis/connection.py", line 318, in read_response raw = self._buffer.readline() File "/opt/virtualenvs/medios_py39/lib/python3.9/site-packages/redis/connection.py", line 249, in readline self._read_from_socket() File "/opt/virtualenvs/medios_py39/lib/python3.9/site-packages/redis/connection.py", line 195, in _read_from_socket raise ConnectionError(SERVER_CLOSED_CONNECTION_ERROR) redis.exceptions.ConnectionError: Connection closed by server. During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/var/www/medios/gluon/main.py", line 439, in wsgibase serve_controller(request, response, session) File "/var/www/medios/gluon/main.py", line 173, in serve_controller run_models_in(environment) File "/var/www/medios/gluon/compileapp.py", line 563, in run_models_in restricted(ccode, environment, layer=model) File "/var/www/medios/gluon/restricted.py", line 219, in restricted exec(ccode, environment) File "applications/eldia/compiled/models.db.py", line 116, in <module> File "applications/eldia/compiled/models.db.py", line 47, in raise_error gluon.http.HTTP: 500 INTERNAL SERVER ERROR tripped while already falling, methinks During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/var/www/medios/gluon/main.py", line 455, in wsgibase session._try_store_in_db(request, response) File "/var/www/medios/gluon/globals.py", line 1254, in _try_store_in_db record_id = table.insert(**dd) File "/var/www/medios/gluon/contrib/redis_session.py", line 167, in insert pipe.execute() File "/opt/virtualenvs/medios_py39/lib/python3.9/site-packages/redis/client.py", line 2078, in execute return conn.retry.call_with_retry( File "/opt/virtualenvs/medios_py39/lib/python3.9/site-packages/redis/retry.py", line 46, in call_with_retry return do() File "/opt/virtualenvs/medios_py39/lib/python3.9/site-packages/redis/client.py", line 2079, in <lambda> lambda: execute(conn, stack, raise_on_error), File "/opt/virtualenvs/medios_py39/lib/python3.9/site-packages/redis/client.py", line 1922, in _execute_transaction all_cmds = connection.pack_commands( File "/opt/virtualenvs/medios_py39/lib/python3.9/site-packages/redis/connection.py", line 895, in pack_commands for chunk in self.pack_command(*cmd): File "/opt/virtualenvs/medios_py39/lib/python3.9/site-packages/redis/connection.py", line 858, in pack_command for arg in map(self.encoder.encode, args): File "/opt/virtualenvs/medios_py39/lib/python3.9/site-packages/redis/connection.py", line 108, in encode raise DataError( redis.exceptions.DataError: Invalid input of type: 'NoneType'. Convert to a bytes, string, int or float first. This looks like it involves one of these being None: dd = dict(locked=0, client_ip=response.session_client, modified_datetime=request.now.isoformat(), session_data=session_pickled, unique_key=unique_key) but this seems to be in trying to clean up after the original issue. It's not clear to me where or how the error happens. From what I see, I understand that the problem is with redis session, but I can't figure out where. What I would investigate is the exception at the top of the list, which means finding out why the socket was closed. I run python 3.9.14 with virtualenv and Redis 4.3.5. Any point or suggestion will be much appreciated. Thanks! Sorry, I'm not a redis expert, but in compound fractures, er, exceptions, the first one to occur is where the problem started. Good luck! /dps -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/web2py/6f8e01b7-a461-42f6-824d-79a9128abfddn%40googlegroups.com.