ls1intum / Artemis

Artemis - Interactive Learning with Automated Feedback
https://docs.artemis.cit.tum.de
MIT License
456 stars 275 forks source link

`Exam`: Updating an exercise results in internal server error #5936

Open b-fein opened 1 year ago

b-fein commented 1 year ago

Describe the bug

Updating an exam exercise fails with an internal server error if a test run existed but has since been deleted.

Log: Artemis tries to update a student exam that no longer exists, in this case a test run.

To Reproduce

  1. Create an exam with a file upload exercise.
  2. Participate in a test run.
  3. Delete the test run.
  4. Try to update the exercise, e.g., by changing the allowed file types.

Expected behavior

Updating the exercise works.

Screenshots

No response

Which version of Artemis are you seeing the problem on?

5.12.6

What browsers are you seeing the problem on?

Firefox

Additional context

Possibly related to the removed @Transactional annotations?

Relevant log output

org.springframework.orm.jpa.JpaObjectRetrievalFailureException: Unable to find de.tum.in.www1.artemis.domain.participation.StudentParticipation with id 294; nested exception is javax.persistence.EntityNotFoundException: Unable to find de.tum.in.www1.artemis.domain.participation.StudentParticipation with id 294
        at org.springframework.orm.jpa.EntityManagerFactoryUtils.convertJpaAccessExceptionIfPossible(EntityManagerFactoryUtils.java:379)
        at org.springframework.orm.jpa.vendor.HibernateJpaDialect.translateExceptionIfPossible(HibernateJpaDialect.java:235)
        at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.translateExceptionIfPossible(AbstractEntityManagerFactoryBean.java:551)
        at org.springframework.dao.support.ChainedPersistenceExceptionTranslator.translateExceptionIfPossible(ChainedPersistenceExceptionTranslator.java:61)
        at org.springframework.dao.support.DataAccessUtils.translateIfNecessary(DataAccessUtils.java:242)
        at org.springframework.dao.support.PersistenceExceptionTranslationInterceptor.invoke(PersistenceExceptionTranslationInterceptor.java:152)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186)
        at org.springframework.data.jpa.repository.support.CrudMethodMetadataPostProcessor$CrudMethodMetadataPopulatingMethodInterceptor.invoke(CrudMethodMetadataPostProcessor.java:174)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186)
        at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:97)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186)
        at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:215)
        at jdk.proxy2/jdk.proxy2.$Proxy385.save(Unknown Source)
        at de.tum.in.www1.artemis.web.rest.FileUploadExerciseResource.updateFileUploadExercise(FileUploadExerciseResource.java:174)
krusche commented 1 year ago

Are you sure the student participation was actually correctly removed when deleting the test run?