AuTA feedback is not shown
Summary
Feedback returned by AuTA is not shown to the student or TA. If a student submits a file that fails the script, the feedback is always "No feedback" even if AuTA generated feedback.
Steps to Reproduce
- Create an assignment with a linked AuTA assignment and some scripts. For example, set the language to Java and enable the File Count Analyzer with the "fail if no analyzable files" script.
- Submit something that causes the script to fail such as an empty archive
- Wait for AuTA to process the submission and Submit to retrieve the results
The feedback is "No feedback", while it should have been "No analyzable files found. Make sure all source files have correct extensions and, if you have submitted an archive, you have uploaded a proper .zip file."
Possible Fix
In ScriptService::saveAutaFeedback I moved the code that touches the database into a try-catch block. The resulting exception is included below.
The issue seems to stem from the database updates happening within an async context. I have no experience with this part of Spring so I do not know an actual fix.
Logs
2021-02-19 11:57:01.262 ERROR 16339 --- [ Async-1] nl.tudelft.submit.service.ScriptService : Failed to store feedback
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'scopedTarget.submissionCacheManager': Scope 'request' is not active for the current thread; consider defining a scoped proxy for this bean if you intend to refer to it from a singleton; nested exception is java.lang.IllegalStateException: No thread-bound request found: Are you referring to request attributes outside of an actual web request, or processing a request outside of the originally receiving thread? If you are actually operating within a web request and still receive this message, your code is probably running outside of DispatcherServlet: In this case, use RequestContextListener or RequestContextFilter to expose the current request.
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:365) ~[spring-beans-5.1.12.RELEASE.jar:5.1.12.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199) ~[spring-beans-5.1.12.RELEASE.jar:5.1.12.RELEASE]
at org.springframework.aop.target.SimpleBeanTargetSource.getTarget(SimpleBeanTargetSource.java:35) ~[spring-aop-5.1.12.RELEASE.jar:5.1.12.RELEASE]
at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:673) ~[spring-aop-5.1.12.RELEASE.jar:5.1.12.RELEASE]
at nl.tudelft.submit.cache.SubmissionCacheManager$$EnhancerBySpringCGLIB$$13b6a2f4.getOrThrow(<generated>) ~[main/:na]
at nl.tudelft.submit.service.GradeService.updateGradesAfterGradedSubmission(GradeService.java:529) ~[main/:na]
at nl.tudelft.submit.service.GradeService$$FastClassBySpringCGLIB$$8caf5cc7.invoke(<generated>) ~[main/:na]
at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:218) ~[spring-core-5.1.12.RELEASE.jar:5.1.12.RELEASE]
at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:750) ~[spring-aop-5.1.12.RELEASE.jar:5.1.12.RELEASE]
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:163) ~[spring-aop-5.1.12.RELEASE.jar:5.1.12.RELEASE]
at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:295) ~[spring-tx-5.1.12.RELEASE.jar:5.1.12.RELEASE]
at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:98) ~[spring-tx-5.1.12.RELEASE.jar:5.1.12.RELEASE]
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186) ~[spring-aop-5.1.12.RELEASE.jar:5.1.12.RELEASE]
at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:689) ~[spring-aop-5.1.12.RELEASE.jar:5.1.12.RELEASE]
at nl.tudelft.submit.service.GradeService$$EnhancerBySpringCGLIB$$3cc7afaa.updateGradesAfterGradedSubmission(<generated>) ~[main/:na]
at nl.tudelft.submit.service.ScriptService.saveAutaFeedback(ScriptService.java:230) ~[main/:na]
at nl.tudelft.submit.service.ScriptService.runAutaScriptAndSaveFeedback(ScriptService.java:275) ~[main/:na]
at nl.tudelft.submit.service.ScriptService$$FastClassBySpringCGLIB$$60fcf2a1.invoke(<generated>) ~[main/:na]
at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:218) ~[spring-core-5.1.12.RELEASE.jar:5.1.12.RELEASE]
at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:750) ~[spring-aop-5.1.12.RELEASE.jar:5.1.12.RELEASE]
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:163) ~[spring-aop-5.1.12.RELEASE.jar:5.1.12.RELEASE]
at org.springframework.aop.interceptor.AsyncExecutionInterceptor.lambda$invoke$0(AsyncExecutionInterceptor.java:115) ~[spring-aop-5.1.12.RELEASE.jar:5.1.12.RELEASE]
at org.springframework.aop.interceptor.AsyncExecutionAspectSupport.lambda$doSubmit$3(AsyncExecutionAspectSupport.java:276) ~[spring-aop-5.1.12.RELEASE.jar:5.1.12.RELEASE]
at java.base/java.util.concurrent.CompletableFuture$AsyncSupply.run(CompletableFuture.java:1700) ~[na:na]
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) ~[na:na]
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) ~[na:na]
at java.base/java.lang.Thread.run(Thread.java:834) ~[na:na]
Caused by: java.lang.IllegalStateException: No thread-bound request found: Are you referring to request attributes outside of an actual web request, or processing a request outside of the originally receiving thread? If you are actually operating within a web request and still receive this message, your code is probably running outside of DispatcherServlet: In this case, use RequestContextListener or RequestContextFilter to expose the current request.
at org.springframework.web.context.request.RequestContextHolder.currentRequestAttributes(RequestContextHolder.java:131) ~[spring-web-5.1.13.RELEASE.jar:5.1.13.RELEASE]
at org.springframework.web.context.request.AbstractRequestAttributesScope.get(AbstractRequestAttributesScope.java:42) ~[spring-web-5.1.13.RELEASE.jar:5.1.13.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:353) ~[spring-beans-5.1.12.RELEASE.jar:5.1.12.RELEASE]
... 26 common frames omitted
Edited by Luc Everse