cessda / cessda.cvs.two

Apache License 2.0
0 stars 2 forks source link

Generate JSON files for published CVs doesn't work at https://vocabularies-dev.cessda.eu #840

Closed pakoselo closed 5 months ago

pakoselo commented 5 months ago

There is an error in generating vocabulary JSON files. @john-shepherdson or @matthew-morris-cessda can you please check it on the production? It looks to me, like there is a problem with var keyword in this class https://github.com/cessda/cessda.cvs.two/blob/main/src/main/java/eu/cessda/cvs/service/impl/VocabularyServiceImpl.java. Especialy these 2 lines: https://github.com/cessda/cessda.cvs.two/blob/349349ba78ebcbf8299367416dde5040a24c8939/src/main/java/eu/cessda/cvs/service/impl/VocabularyServiceImpl.java#L1591 and https://github.com/cessda/cessda.cvs.two/blob/349349ba78ebcbf8299367416dde5040a24c8939/src/main/java/eu/cessda/cvs/service/impl/VocabularyServiceImpl.java#L1592.

matthew-morris-cessda commented 5 months ago

I find it unlikely that var is the cause, as var simply means the compiler derives the type and a compiler error would be expected if var was used incorrectly. The first var is a Path, the second var is an OutputStream.

What's the exact steps to replicate this issue?

pakoselo commented 5 months ago

Hi Matthew

Try to generate the json files in Admin->Maintenance-Generate JSON files. Actually in my local deployment it fails on these two lines. I know that it should work, but it doesn't. So I am wondering if this is not the same issue. Another thing is, why to use var keyword, if we can use Path and OutputStream keywords.

Martin

On Fri, Feb 2, 2024 at 11:04 AM Matthew Morris @.***> wrote:

I find it unlikely that var is the cause, as var simply means the compiler derives the type and a compiler error would be expected if var was used incorrectly. The first var is a Path, the second var is an OutputStream.

What's the exact steps to replicate this issue?

— Reply to this email directly, view it on GitHub https://github.com/cessda/cessda.cvs.two/issues/840#issuecomment-1923475517, or unsubscribe https://github.com/notifications/unsubscribe-auth/AB23PTXDBORGP2OKMXFYVODYRS23TAVCNFSM6AAAAABCWIVYK6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSMRTGQ3TKNJRG4 . You are receiving this because you authored the thread.Message ID: @.***>

matthew-morris-cessda commented 5 months ago

Thanks. I can't reproduce this issue on production. Whilst the output reads "Error", this is as a result of the reverse proxy timing out the connection.

Regarding the use of var, it helps make the code more readable in cases where the type is explicit (i.e. when new is used) or when the type has a long name (e.g. var exception = new VocabularyFileGenerationFailedException() is much more readable than VocabularyFileGenerationFailedException exception = new VocabularyFileGenerationFailedException()).

matthew-morris-cessda commented 5 months ago

If you have a stacktrace, please attach it to this issue

pakoselo commented 5 months ago

I didn't have it, but the java doesn't recognize the var keyword. This should be a vscode specific problem. But it's strange, that it doesn't work on dev too.

On Fri, Feb 2, 2024 at 11:28 AM Matthew Morris @.***> wrote:

If you have a stacktrace, please attach it to this issue

— Reply to this email directly, view it on GitHub https://github.com/cessda/cessda.cvs.two/issues/840#issuecomment-1923517332, or unsubscribe https://github.com/notifications/unsubscribe-auth/AB23PTUP4BN55TVBRNVX4DDYRS5T3AVCNFSM6AAAAABCWIVYK6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSMRTGUYTOMZTGI . You are receiving this because you authored the thread.Message ID: @.***>

matthew-morris-cessda commented 5 months ago

The var keyword is only supported on JDK 10 and greater. VSCode may need to be configured to recognise JDK 11 syntax. See https://code.visualstudio.com/docs/java/java-faq#_how-can-i-use-visual-studio-code-with-new-java-versions for guidance.

pakoselo commented 5 months ago

It should, but in fact it doesn't :-(. I was just wondering what the error is on the dev.

On Fri, Feb 2, 2024 at 2:51 PM Matthew Morris @.***> wrote:

The var keyword is only supported on JDK 10 and greater. VSCode may need to be configured to recognise JDK 11 syntax. See https://code.visualstudio.com/docs/java/java-faq#_how-can-i-use-visual-studio-code-with-new-java-versions for guidance.

— Reply to this email directly, view it on GitHub https://github.com/cessda/cessda.cvs.two/issues/840#issuecomment-1923853158, or unsubscribe https://github.com/notifications/unsubscribe-auth/AB23PTSFTUOFXSH5IINJTI3YRTVPJAVCNFSM6AAAAABCWIVYK6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSMRTHA2TGMJVHA . You are receiving this because you authored the thread.Message ID: @.***>

matthew-morris-cessda commented 5 months ago

It appears to be the same error as on production, with the reverse proxy timing out (and returning 504) before CVS returns a response. I've attached the error reported from CVS when the connection was reset.

{
  "insertId": "56rn3tto9oomcllp",
  "jsonPayload": {
    "timestamp": "2024-02-02T08:10:00.377Z",
    "app_name": "cvs",
    "thread_name": "http-nio-8080-exec-10",
    "stack_trace": "java.io.IOException: Connection reset by peer\n\tat sun.nio.ch.FileDispatcherImpl.write0(Unknown Source)\n\tat sun.nio.ch.SocketDispatcher.write(Unknown Source)\n\tat sun.nio.ch.IOUtil.writeFromNativeBuffer(Unknown Source)\n\tat sun.nio.ch.IOUtil.write(Unknown Source)\n\tat sun.nio.ch.IOUtil.write(Unknown Source)\n\tat sun.nio.ch.SocketChannelImpl.write(Unknown Source)\n\tat org.apache.tomcat.util.net.NioChannel.write(NioChannel.java:138)\n\tat org.apache.tomcat.util.net.NioBlockingSelector.write(NioBlockingSelector.java:101)\n\tat org.apache.tomcat.util.net.NioSelectorPool.write(NioSelectorPool.java:152)\n\tat org.apache.tomcat.util.net.NioEndpoint$NioSocketWrapper.doWrite(NioEndpoint.java:1253)\n\tat org.apache.tomcat.util.net.SocketWrapperBase.doWrite(SocketWrapperBase.java:764)\n\tat org.apache.tomcat.util.net.SocketWrapperBase.flushBlocking(SocketWrapperBase.java:717)\n\tat org.apache.tomcat.util.net.SocketWrapperBase.flush(SocketWrapperBase.java:707)\n\tat org.apache.coyote.http11.Http11OutputBuffer$SocketOutputBuffer.flush(Http11OutputBuffer.java:572)\n\tat org.apache.coyote.http11.filters.ChunkedOutputFilter.flush(ChunkedOutputFilter.java:157)\n\tat org.apache.coyote.http11.filters.GzipOutputFilter.flush(GzipOutputFilter.java:105)\n\tat org.apache.coyote.http11.Http11OutputBuffer.flush(Http11OutputBuffer.java:220)\n\tat org.apache.coyote.http11.Http11Processor.flush(Http11Processor.java:1195)\n\tat org.apache.coyote.AbstractProcessor.action(AbstractProcessor.java:402)\n\tat org.apache.coyote.Response.action(Response.java:209)\n\tat org.apache.catalina.connector.OutputBuffer.doFlush(OutputBuffer.java:305)\n\t... 96 common frames omitted\nWrapped by: org.apache.catalina.connector.ClientAbortException: java.io.IOException: Connection reset by peer\n\tat org.apache.catalina.connector.OutputBuffer.doFlush(OutputBuffer.java:309)\n\tat org.apache.catalina.connector.OutputBuffer.flush(OutputBuffer.java:272)\n\tat org.apache.catalina.connector.CoyoteOutputStream.flush(CoyoteOutputStream.java:118)\n\tat org.springframework.security.web.util.OnCommittedResponseWrapper$SaveContextServletOutputStream.flush(OnCommittedResponseWrapper.java:520)\n\tat java.io.FilterOutputStream.flush(Unknown Source)\n\tat com.fasterxml.jackson.core.json.UTF8JsonGenerator.flush(UTF8JsonGenerator.java:1153)\n\tat com.fasterxml.jackson.databind.ObjectWriter.writeValue(ObjectWriter.java:923)\n\tat org.springframework.http.converter.json.AbstractJackson2HttpMessageConverter.writeInternal(AbstractJackson2HttpMessageConverter.java:346)\n\tat org.springframework.http.converter.AbstractGenericHttpMessageConverter.write(AbstractGenericHttpMessageConverter.java:104)\n\tat org.springframework.web.servlet.mvc.method.annotation.AbstractMessageConverterMethodProcessor.writeWithMessageConverters(AbstractMessageConverterMethodProcessor.java:277)\n\tat org.springframework.web.servlet.mvc.method.annotation.HttpEntityMethodProcessor.handleReturnValue(HttpEntityMethodProcessor.java:219)\n\tat org.springframework.web.method.support.HandlerMethodReturnValueHandlerComposite.handleReturnValue(HandlerMethodReturnValueHandlerComposite.java:82)\n\tat org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:123)\n\tat org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:878)\n\tat org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:792)\n\tat org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:87)\n\tat org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:1040)\n\tat org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:943)\n\tat org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:1006)\n\tat org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:909)\n\tat javax.servlet.http.HttpServlet.service(HttpServlet.java:652)\n\tat org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:883)\n\tat javax.servlet.http.HttpServlet.service(HttpServlet.java:733)\n\tat org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231)\n\tat org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)\n\tat org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:113)\n\tat org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)\n\tat org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)\n\tat org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:320)\n\tat org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:126)\n\tat org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:90)\n\tat org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334)\n\tat org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:118)\n\tat org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334)\n\tat org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:137)\n\tat org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334)\n\tat org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:111)\n\tat org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334)\n\tat org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:158)\n\tat org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334)\n\tat org.springframework.security.web.savedrequest.RequestCacheAwareFilter.doFilter(RequestCacheAwareFilter.java:63)\n\tat org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334)\n\tat eu.cessda.cvs.security.jwt.JWTFilter.doFilter(JWTFilter.java:62)\n\tat org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334)\n\tat org.springframework.web.filter.CorsFilter.doFilterInternal(CorsFilter.java:92)\n\tat org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119)\n\tat org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334)\n\tat org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:116)\n\tat org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334)\n\tat org.springframework.security.web.header.HeaderWriterFilter.doHeadersAfter(HeaderWriterFilter.java:92)\n\tat org.springframework.security.web.header.HeaderWriterFilter.doFilterInternal(HeaderWriterFilter.java:77)\n\tat org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119)\n\tat org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334)\n\tat org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:105)\n\tat org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334)\n\tat org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter.doFilterInternal(WebAsyncManagerIntegrationFilter.java:56)\n\tat org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119)\n\tat org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334)\n\tat org.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:215)\n\tat org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:178)\n\tat org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:358)\n\tat org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:271)\n\tat org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)\n\tat org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)\n\tat org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:100)\n\tat org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119)\n\tat org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)\n\tat org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)\n\tat org.springframework.web.filter.FormContentFilter.doFilterInternal(FormContentFilter.java:93)\n\tat org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119)\n\tat org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)\n\tat org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)\n\tat org.springframework.boot.actuate.metrics.web.servlet.WebMvcMetricsFilter.doFilterInternal(WebMvcMetricsFilter.java:109)\n\tat org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119)\n\tat org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)\n\tat org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)\n\tat org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:201)\n\tat org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119)\n\tat org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)\n\tat org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)\n\tat org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:202)\n\tat org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:97)\n\tat org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:542)\n\tat org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:143)\n\tat org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92)\n\tat org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:78)\n\tat org.apache.catalina.valves.RemoteIpValve.invoke(RemoteIpValve.java:764)\n\tat org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:343)\n\tat org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:374)\n\tat org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:65)\n\tat org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:888)\n\tat org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1597)\n\tat org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)\n\tat java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)\n\tat java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)\n\tat org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)\n\tat java.lang.Thread.run(Unknown Source)\n",
    "message": "Internal Server Error",
    "logger_name": "o.z.p.s.c.AdviceTraits",
    "app_port": "8080",
    "level": "ERROR"
  },
  "resource": {
    "type": "k8s_container",
    "labels": {
      "location": "europe-west1-b",
      "namespace_name": "cvs-v2",
      "project_id": "cessda-dev",
      "container_name": "frontend",
      "pod_name": "cvs-v2-frontend-0",
      "cluster_name": "development-cluster"
    }
  },
  "timestamp": "2024-02-02T08:10:00.403321390Z",
  "severity": "ERROR",
  "labels": {
    "k8s-pod/statefulset_kubernetes_io/pod-name": "cvs-v2-frontend-0",
    "k8s-pod/app_kubernetes_io/instance": "cvs-v2",
    "k8s-pod/app_kubernetes_io/name": "frontend",
    "k8s-pod/app": "cvs",
    "compute.googleapis.com/resource_name": "gke-development-cluster-default-pool-cfbaedc0-asj2",
    "k8s-pod/controller-revision-hash": "cvs-v2-frontend-7758886df4"
  },
  "logName": "projects/cessda-dev/logs/stdout",
  "receiveTimestamp": "2024-02-02T08:10:03.542576839Z",
  "errorGroups": [
    {
      "id": "CJjcluCik7322AE"
    }
  ]
}