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

Programing exercise: Student does not see the results from the latest submission in the overview #9086

Open
BaumiCoder opened this issue Jul 18, 2024 · 7 comments

Comments

@BaumiCoder
Copy link
Contributor

BaumiCoder commented Jul 18, 2024

Describe the bug

The overview of a Programming exercise sometimes does not show the results from the latest submission. Instead it shows the result of a previous submission.

To Reproduce

  1. Create a Programming exercise
  2. Make some submissions with different results (e.g. with / without warning or different percentage of passed tests)
  3. Go to the list of exercises of your course
  4. The results on the overview is not from the latest submission (This does not appear always, see Additional context)

Expected behavior

The overview on the left-hand side always shows the results for the latest submission.

Screenshots

The overview on the left-hand side shows here a warning symbol, but the latest submission has no warning. But as you can see all previous submissions have a warning. It looks like the
Status screenshot

Which version of Artemis are you seeing the problem on?

7.4.3 (and also older version)

What browsers are you seeing the problem on?

Other (specify in "Additional context")

Additional context

The visual impact of the bug, which the screenshot shows, appears on our productive Artemis server and was noticed by one student. The reproduction in a test environment was not successful yet, but an error in the log seems to indicate what is the problem behind it.
An Query did not return a unique result error occurs which indicates that there is not deterministic which result is selected here. The problem appears with PostgreSQL, maybe this problem is also related to some difference between MySQL and PostgreSQL.

Relevant log output

full log entry with stracktrace
2024-07-13T18:47:38.557+02:00 ERROR 34844 --- [Artemis] [taskScheduler-3] .w.a.s.s.ParticipantScoreScheduleService : Exception while processing participant score for exercise 7 and participant 3 for participant scores:

org.springframework.dao.IncorrectResultSizeDataAccessException: Query did not return a unique result: 2 results were returned
	at org.springframework.orm.jpa.vendor.HibernateJpaDialect.convertHibernateAccessException(HibernateJpaDialect.java:301)
	at org.springframework.orm.jpa.vendor.HibernateJpaDialect.translateExceptionIfPossible(HibernateJpaDialect.java:244)
	at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.translateExceptionIfPossible(AbstractEntityManagerFactoryBean.java:550)
	at org.springframework.dao.support.ChainedPersistenceExceptionTranslator.translateExceptionIfPossible(ChainedPersistenceExceptionTranslator.java:61)
	at org.springframework.dao.support.DataAccessUtils.translateIfNecessary(DataAccessUtils.java:335)
	at org.springframework.dao.support.PersistenceExceptionTranslationInterceptor.invoke(PersistenceExceptionTranslationInterceptor.java:160)
	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:184)
	at org.springframework.data.jpa.repository.support.CrudMethodMetadataPostProcessor$CrudMethodMetadataPopulatingMethodInterceptor.invoke(CrudMethodMetadataPostProcessor.java:136)
	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:184)
	at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:97)
	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:184)
	at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:223)
	at jdk.proxy2/jdk.proxy2.$Proxy305.findByExercise_IdAndUser_Id(Unknown Source)
	at de.tum.in.www1.artemis.service.scheduled.ParticipantScoreScheduleService.executeTask(ParticipantScoreScheduleService.java:283)
	at de.tum.in.www1.artemis.service.scheduled.ParticipantScoreScheduleService.lambda$scheduleTask$5(ParticipantScoreScheduleService.java:234)
	at org.springframework.scheduling.support.DelegatingErrorHandlingRunnable.run(DelegatingErrorHandlingRunnable.java:54)
	at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:572)
	at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:317)
	at java.base/java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:304)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642)
	at java.base/java.lang.Thread.run(Thread.java:1583)
Caused by: org.hibernate.NonUniqueResultException: Query did not return a unique result: 2 results were returned
	at org.hibernate.query.spi.AbstractSelectionQuery.uniqueElement(AbstractSelectionQuery.java:586)
	at org.hibernate.query.spi.AbstractSelectionQuery.getSingleResult(AbstractSelectionQuery.java:570)
	at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103)
	at java.base/java.lang.reflect.Method.invoke(Method.java:580)
	at org.springframework.orm.jpa.SharedEntityManagerCreator$DeferredQueryInvocationHandler.invoke(SharedEntityManagerCreator.java:418)
	at jdk.proxy2/jdk.proxy2.$Proxy466.getSingleResult(Unknown Source)
	at org.springframework.data.jpa.repository.query.JpaQueryExecution$SingleEntityExecution.doExecute(JpaQueryExecution.java:223)
	at org.springframework.data.jpa.repository.query.JpaQueryExecution.execute(JpaQueryExecution.java:92)
	at org.springframework.data.jpa.repository.query.AbstractJpaQuery.doExecute(AbstractJpaQuery.java:152)
	at org.springframework.data.jpa.repository.query.AbstractJpaQuery.execute(AbstractJpaQuery.java:140)
	at org.springframework.data.repository.core.support.RepositoryMethodInvoker.doInvoke(RepositoryMethodInvoker.java:170)
	at org.springframework.data.repository.core.support.RepositoryMethodInvoker.invoke(RepositoryMethodInvoker.java:158)
	at org.springframework.data.repository.core.support.QueryExecutorMethodInterceptor.doInvoke(QueryExecutorMethodInterceptor.java:164)
	at org.springframework.data.repository.core.support.QueryExecutorMethodInterceptor.invoke(QueryExecutorMethodInterceptor.java:143)
	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:184)
	at org.springframework.data.projection.DefaultMethodInvokingMethodInterceptor.invoke(DefaultMethodInvokingMethodInterceptor.java:70)
	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:184)
	at org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:123)
	at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:392)
	at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:119)
	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:184)
	at org.springframework.dao.support.PersistenceExceptionTranslationInterceptor.invoke(PersistenceExceptionTranslationInterceptor.java:138)
	... 16 common frames omitted

@BaumiCoder
Copy link
Contributor Author

The changes from #8741 may have fixed the issue. I cannot reproduce the error message in the log. We will keep it open and check if the problem occurs in the next semester again.

@dfuchss
Copy link
Contributor

dfuchss commented Nov 7, 2024

Hi @BaumiCoder, it appears that one of our courses encounters the issue as well. So it may not be fully fixed. We are currently using Artemis 7.6.5

@b-fein
Copy link
Contributor

b-fein commented Nov 7, 2024

Emphasis on the additional context:

The problem appears with PostgreSQL, maybe this problem is also related to some difference between MySQL and PostgreSQL.

We use PostgreSQL, @dfuchss what DB are you using?

To make it potentially easier to reproduce and determine if the problem only occurs with PostgreSQL. The likely cause in any case is that some query does not ensure the correct order but uses them as-is as received from the database.


Log output probably from an unrelated problem that occurred at a similar time. Getting the latest result and the ScoreScheduleService should be independent.

@dfuchss
Copy link
Contributor

dfuchss commented Nov 8, 2024

We are using MySQL 🤔

@dfuchss
Copy link
Contributor

dfuchss commented Nov 8, 2024

But I think for us it's related to the locking of an exercise.

@b-fein
Copy link
Contributor

b-fein commented Nov 11, 2024

Reproduction steps:

  1. Programming exercise with manual submission. After the due date, but before the assessment release date.
  2. State 1: The manual assessment has not yet been started.
    • $\Rightarrow$ The last result is shown as intended.
  3. State 2: Submit an assessment as instructor.
    • $\Rightarrow$ The sidebar now shows the second-to-last result.

@b-fein
Copy link
Contributor

b-fein commented Nov 11, 2024

I think I can trace it back to the CourseStorageService that already contains only the wrong result instead of the last one.

This is filled by the courses/{courseId}/for-dashboard REST call. Checking the response sent over the network, I can verify that already the wrong result/submission is sent to the client.


On the server side, it is likely that the problem originates somewhere in ExerciseService.filterForCourseDashboard or Exercise.findLatestSubmissionWithRatedResultWithCompletionDate, though this is only by code inspection rather than debugging, so might not be accurate.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants