TU-Wien-dataLAB / Grader-Service

Grader Service offers lecturers and students a well integrated teaching environment for data science, machine learning and programming classes.
https://grader-service.readthedocs.io/en/latest/
BSD 3-Clause "New" or "Revised" License
27 stars 2 forks source link

Submissions log with NUL (0x00) char stop autograde workflow completion #165

Closed florian-jaeger closed 6 months ago

florian-jaeger commented 7 months ago

Describe the bug After autograding we save the grading logs to the database. These grading logs can contain unprocessable characters, which result in an error and stop the completion of the autograding workflow and leaves the submission in the pending state and without a set score, even though the autograding of the notebook was sucessfully finished.

Logs

ERROR    2023-11-23 10:04:13,299 grader_executor | An exception (PendingRollbackError)                         was raised when executing task start!
    Traceback (most recent call last):
      File "/usr/local/lib/python3.8/dist-packages/grader_service/autograding/local_grader.py", line 122, in start
        self._set_db_state()
      File "/usr/local/lib/python3.8/dist-packages/grader_service/autograding/local_grader.py", line 416, in _set_db_state
        self.session.commit()
      File "/usr/local/lib/python3.8/dist-packages/sqlalchemy/orm/session.py", line 1451, in commit
        self._transaction.commit(_to_root=self.future)
      File "/usr/local/lib/python3.8/dist-packages/sqlalchemy/orm/session.py", line 829, in commit
        self._prepare_impl()
      File "/usr/local/lib/python3.8/dist-packages/sqlalchemy/orm/session.py", line 808, in _prepare_impl
        self.session.flush()
      File "/usr/local/lib/python3.8/dist-packages/sqlalchemy/orm/session.py", line 3444, in flush
        self._flush(objects)
      File "/usr/local/lib/python3.8/dist-packages/sqlalchemy/orm/session.py", line 3584, in _flush
        transaction.rollback(_capture_exception=True)
      File "/usr/local/lib/python3.8/dist-packages/sqlalchemy/util/langhelpers.py", line 70, in __exit__
        compat.raise_(
      File "/usr/local/lib/python3.8/dist-packages/sqlalchemy/util/compat.py", line 211, in raise_
        raise exception
      File "/usr/local/lib/python3.8/dist-packages/sqlalchemy/orm/session.py", line 3544, in _flush
        flush_context.execute()
      File "/usr/local/lib/python3.8/dist-packages/sqlalchemy/orm/unitofwork.py", line 456, in execute
        rec.execute(self)
      File "/usr/local/lib/python3.8/dist-packages/sqlalchemy/orm/unitofwork.py", line 630, in execute
        util.preloaded.orm_persistence.save_obj(
      File "/usr/local/lib/python3.8/dist-packages/sqlalchemy/orm/persistence.py", line 245, in save_obj
        _emit_insert_statements(
      File "/usr/local/lib/python3.8/dist-packages/sqlalchemy/orm/persistence.py", line 1097, in _emit_insert_statements
        c = connection._execute_20(
      File "/usr/local/lib/python3.8/dist-packages/sqlalchemy/engine/base.py", line 1705, in _execute_20
        return meth(self, args_10style, kwargs_10style, execution_options)
      File "/usr/local/lib/python3.8/dist-packages/sqlalchemy/sql/elements.py", line 334, in _execute_on_connection
        return connection._execute_clauseelement(
      File "/usr/local/lib/python3.8/dist-packages/sqlalchemy/engine/base.py", line 1572, in _execute_clauseelement
        ret = self._execute_context(
      File "/usr/local/lib/python3.8/dist-packages/sqlalchemy/engine/base.py", line 1943, in _execute_context
        self._handle_dbapi_exception(
      File "/usr/local/lib/python3.8/dist-packages/sqlalchemy/engine/base.py", line 2128, in _handle_dbapi_exception
        util.raise_(exc_info[1], with_traceback=exc_info[2])
      File "/usr/local/lib/python3.8/dist-packages/sqlalchemy/util/compat.py", line 211, in raise_
        raise exception
      File "/usr/local/lib/python3.8/dist-packages/sqlalchemy/engine/base.py", line 1900, in _execute_context
        self.dialect.do_execute(
      File "/usr/local/lib/python3.8/dist-packages/sqlalchemy/engine/default.py", line 736, in do_execute
        cursor.execute(statement, parameters)
    ValueError: A string literal cannot contain NUL (0x00) characters.

Additional context One student in the course "120.109 Topographische Modelle" is affected.