Application is shutdown when I enabled lwjglx-debugger

Started by Evgeny, December 27, 2020, 12:46:13

Previous topic - Next topic

Evgeny

Hey. I use lwjgl 3.2.3, java 8 in my spring boot application. My application has some problem with framebuffer and I wanted to know what is happened. I added lwjglx debugger for it but after that when I added -javaagent my application is crashed.
Also additional inforamation I use spring cloud and when my appication is running then it connects to consul for getting of config. It is failed because of:

java.lang.IllegalStateException: calling flip() on a buffer with position = 0. Check if you called a method that actually modifies the buffer position.
	at org.apache.http.client.utils.URLEncodedUtils.urlDecode(URLEncodedUtils.java:682) ~[httpclient-4.5.13.jar:4.5.13]
	at org.apache.http.client.utils.URLEncodedUtils.parsePathSegments(URLEncodedUtils.java:364) ~[httpclient-4.5.13.jar:4.5.13]
	at org.apache.http.client.utils.URIBuilder.parsePath(URIBuilder.java:137) ~[httpclient-4.5.13.jar:4.5.13]
	at org.apache.http.client.utils.URIBuilder.digestURI(URIBuilder.java:216) ~[httpclient-4.5.13.jar:4.5.13]
	at org.apache.http.client.utils.URIBuilder.<init>(URIBuilder.java:110) ~[httpclient-4.5.13.jar:4.5.13]
	at org.apache.http.client.utils.URIBuilder.<init>(URIBuilder.java:90) ~[httpclient-4.5.13.jar:4.5.13]
	at org.apache.http.client.utils.URIUtils.rewriteURI(URIUtils.java:206) ~[httpclient-4.5.13.jar:4.5.13]
	at org.apache.http.client.utils.URIUtils.rewriteURIForRoute(URIUtils.java:319) ~[httpclient-4.5.13.jar:4.5.13]
	at org.apache.http.impl.execchain.ProtocolExec.rewriteRequestURI(ProtocolExec.java:96) ~[httpclient-4.5.13.jar:4.5.13]
	at org.apache.http.impl.execchain.ProtocolExec.execute(ProtocolExec.java:133) ~[httpclient-4.5.13.jar:4.5.13]
	at org.apache.http.impl.execchain.RetryExec.execute(RetryExec.java:89) ~[httpclient-4.5.13.jar:4.5.13]
	at org.apache.http.impl.execchain.RedirectExec.execute(RedirectExec.java:110) ~[httpclient-4.5.13.jar:4.5.13]
	at org.apache.http.impl.client.InternalHttpClient.doExecute(InternalHttpClient.java:185) ~[httpclient-4.5.13.jar:4.5.13]
	at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:72) ~[httpclient-4.5.13.jar:4.5.13]
	at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:221) ~[httpclient-4.5.13.jar:4.5.13]
	at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:165) ~[httpclient-4.5.13.jar:4.5.13]
	at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:140) ~[httpclient-4.5.13.jar:4.5.13]
	at com.ecwid.consul.transport.AbstractHttpTransport.executeRequest(AbstractHttpTransport.java:70) ~[consul-api-1.4.5.jar:na]
	at com.ecwid.consul.transport.AbstractHttpTransport.makeGetRequest(AbstractHttpTransport.java:36) ~[consul-api-1.4.5.jar:na]
	at com.ecwid.consul.v1.ConsulRawClient.makeGetRequest(ConsulRawClient.java:139) ~[consul-api-1.4.5.jar:na]
	at com.ecwid.consul.v1.ConsulRawClient.makeGetRequest(ConsulRawClient.java:128) ~[consul-api-1.4.5.jar:na]
	at com.ecwid.consul.v1.kv.KeyValueConsulClient.getKVValues(KeyValueConsulClient.java:147) ~[consul-api-1.4.5.jar:na]
	at com.ecwid.consul.v1.ConsulClient.getKVValues(ConsulClient.java:644) ~[consul-api-1.4.5.jar:na]
	at org.springframework.cloud.consul.config.ConsulPropertySource.init(ConsulPropertySource.java:68) ~[spring-cloud-consul-config-2.2.5.RELEASE.jar:2.2.5.RELEASE]
	at org.springframework.cloud.consul.config.ConsulPropertySourceLocator.create(ConsulPropertySourceLocator.java:186) ~[spring-cloud-consul-config-2.2.5.RELEASE.jar:2.2.5.RELEASE]
	at org.springframework.cloud.consul.config.ConsulPropertySourceLocator.locate(ConsulPropertySourceLocator.java:146) ~[spring-cloud-consul-config-2.2.5.RELEASE.jar:2.2.5.RELEASE]
	at org.springframework.cloud.bootstrap.config.PropertySourceLocator.locateCollection(PropertySourceLocator.java:52) ~[spring-cloud-context-2.2.6.RELEASE.jar:2.2.6.RELEASE]
	at org.springframework.cloud.consul.config.ConsulPropertySourceLocator.locateCollection(ConsulPropertySourceLocator.java:79) ~[spring-cloud-consul-config-2.2.5.RELEASE.jar:2.2.5.RELEASE]
	at org.springframework.cloud.consul.config.ConsulPropertySourceLocator$$FastClassBySpringCGLIB$$b35ebf8.invoke(<generated>) ~[spring-cloud-consul-config-2.2.5.RELEASE.jar:2.2.5.RELEASE]
	at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:218) ~[spring-core-5.2.11.RELEASE.jar:5.2.11.RELEASE]
	at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:771) ~[spring-aop-5.2.11.RELEASE.jar:5.2.11.RELEASE]
	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:163) ~[spring-aop-5.2.11.RELEASE.jar:5.2.11.RELEASE]
	at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.proceed(CglibAopProxy.java:749) ~[spring-aop-5.2.11.RELEASE.jar:5.2.11.RELEASE]
	at org.springframework.retry.interceptor.RetryOperationsInterceptor$1.doWithRetry(RetryOperationsInterceptor.java:91) ~[spring-retry-1.2.5.RELEASE.jar:na]
	at org.springframework.retry.support.RetryTemplate.doExecute(RetryTemplate.java:287) ~[spring-retry-1.2.5.RELEASE.jar:na]
	at org.springframework.retry.support.RetryTemplate.execute(RetryTemplate.java:164) ~[spring-retry-1.2.5.RELEASE.jar:na]
	at org.springframework.retry.interceptor.RetryOperationsInterceptor.invoke(RetryOperationsInterceptor.java:118) ~[spring-retry-1.2.5.RELEASE.jar:na]
	at org.springframework.retry.annotation.AnnotationAwareRetryOperationsInterceptor.invoke(AnnotationAwareRetryOperationsInterceptor.java:153) ~[spring-retry-1.2.5.RELEASE.jar:na]
	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186) ~[spring-aop-5.2.11.RELEASE.jar:5.2.11.RELEASE]
	at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.proceed(CglibAopProxy.java:749) ~[spring-aop-5.2.11.RELEASE.jar:5.2.11.RELEASE]
	at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:691) ~[spring-aop-5.2.11.RELEASE.jar:5.2.11.RELEASE]
	at org.springframework.cloud.consul.config.ConsulPropertySourceLocator$$EnhancerBySpringCGLIB$$dd4ce407.locateCollection(<generated>) ~[spring-cloud-consul-config-2.2.5.RELEASE.jar:2.2.5.RELEASE]
	at org.springframework.cloud.bootstrap.config.PropertySourceBootstrapConfiguration.initialize(PropertySourceBootstrapConfiguration.java:98) ~[spring-cloud-context-2.2.6.RELEASE.jar:2.2.6.RELEASE]
	at org.springframework.boot.SpringApplication.applyInitializers(SpringApplication.java:626) ~[spring-boot-2.3.6.RELEASE.jar:2.3.6.RELEASE]
	at org.springframework.boot.SpringApplication.prepareContext(SpringApplication.java:370) ~[spring-boot-2.3.6.RELEASE.jar:2.3.6.RELEASE]
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:314) ~[spring-boot-2.3.6.RELEASE.jar:2.3.6.RELEASE]
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:1237) ~[spring-boot-2.3.6.RELEASE.jar:2.3.6.RELEASE]
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:1226) ~[spring-boot-2.3.6.RELEASE.jar:2.3.6.RELEASE]


What should I do to fix this problem ?

command to run:
java -XX:+UseG1GC -Dspring.cloud.consul.host=${CONSUL_HOST} -XX:MinRAMPercentage=50.0 -XX:MaxRAMPercentage=50.0 -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=/app/dumps -javaagent:/app/lwjglx-debug-1.0.0.jar -cp /app/resources:/app/classes:/app/libs/* myMainFile

KaiHH

Please re-download LWJGLX/debug off https://www.lwjgl.org/browse/addons/lwjglx-debug

The reason for LWJGLX/debug emitting this "warning" is to hint to a "possibly" wrong usage of a NIO buffer which can especially be found when using JOML by flipping a buffer whose position has not been modified/incremented.
So it's more of a "you possibly did something wrong"-kind of warning, which nevertheless currently results in an exception being thrown at the callsite.
Also: LWJGLX/debug wasn't really designed to cope with all the different use-cases of Java APIs when using it in a Spring/JavaEE/JakartaEE/Servlet/or-otherwise application environment.
Currently, there is a list of excluded packages that should not be analyzed and transformed by the LWJGLX/debug agent, and org/apache/..., which apparently does flip() a buffer with zero length (which is fine, of course), wasn't part of it.
It's now been added, so please re-download LWJGLX/debug from above mentioned link.

Maybe, the list of analyzed and transformed packages should be an "include" list not an "exclude" list in the future.

Evgeny

It is working now, but I am getting the following problem:
[LWJGL] Loading JNI library: lwjgl_opengl
[LWJGL] 	Module: org.lwjgl.opengl
[LWJGL] 	Using SharedLibraryLoader...
[LWJGL]     Extracting: file:/app/libs/lwjgl-opengl-3.2.3-natives-linux.jar!/linux/x64/org/lwjgl/opengl/liblwjgl_opengl.so
[LWJGL] 	Loaded from org.lwjgl.librarypath: /tmp/lwjglroot/3.2.3-build-13/liblwjgl_opengl.so
[LWJGL] Loading library: libGL.so.1
[LWJGL] 	Module: org.lwjgl.opengl
[LWJGL] 	libGL.so.1 not found in org.lwjgl.librarypath=/tmp/lwjglroot/3.2.3-build-13
[LWJGL] 	Loaded from system paths: /usr/lib/x86_64-linux-gnu/libGL.so.1
[LWJGL] Warning: Failed to instantiate memory allocator: org.lwjgl.system.jemalloc.JEmallocAllocator. Using the system default.
[LWJGL] MemoryUtil allocator: DebugAllocator
[LWJGL] [GL] Using KHR_debug for error logging.
[LWJGL] [GL] Warning: A non-debug context may not produce any debug output.

java.lang.NullPointerException: null
	at org.lwjglx.debug.opengl.GL.createCapabilities(GL.java:39) ~[lwjglx-debug-1.0.0.jar:na]
	at org.lwjglx.debug.$Proxy$5284.createCapabilities10(Unknown Source) ~[na:na]
	at ai.tra.robofacturing.renderer.engine.graphics.RendererConfigurator.configureInternally(RendererConfigurator.kt:55) ~[classes/:na]
	at ai.tra.robofacturing.renderer.engine.graphics.RendererConfigurator.access$configureInternally(RendererConfigurator.kt:9) ~[classes/:na]
	at ai.tra.robofacturing.renderer.engine.graphics.RendererConfigurator$SimpleConfig.configure(RendererConfigurator.kt:32) ~[classes/:na]
	at ai.tra.robofacturing.renderer.service.ScreenshotMakerService.createScreenshot(ScreenshotMakerService.kt:33) ~[classes/:na]
	at ai.tra.robofacturing.renderer.service.strategy.RenderStrategy.render(RenderStrategy.kt:165) ~[classes/:na]
	at ai.tra.robofacturing.renderer.service.strategy.RenderStrategy$render$2.invokeSuspend(RenderStrategy.kt:66) [classes/:na]
	at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33) [kotlin-stdlib-1.4.21.jar:1.4.21-release-351 (1.4.21)]
	at kotlinx.coroutines.internal.ScopeCoroutine.afterResume(Scopes.kt:32) [kotlinx-coroutines-core-jvm-1.4.2.jar:na]
	at kotlinx.coroutines.AbstractCoroutine.resumeWith(AbstractCoroutine.kt:113) [kotlinx-coroutines-core-jvm-1.4.2.jar:na]
	at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:46) [kotlin-stdlib-1.4.21.jar:1.4.21-release-351 (1.4.21)]
	at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106) [kotlinx-coroutines-core-jvm-1.4.2.jar:na]
	at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:571) [kotlinx-coroutines-core-jvm-1.4.2.jar:na]
	at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:750) [kotlinx-coroutines-core-jvm-1.4.2.jar:na]
	at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:678) [kotlinx-coroutines-core-jvm-1.4.2.jar:na]
	at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:665) [kotlinx-coroutines-core-jvm-1.4.2.jar:na]


It is happened when I bound egl context and trying to bind opengl context

KaiHH

The LWJGLX/debug agent only works with GLFW currently. It hooks into glfwMakeContextCurrent() to know when an OpenGL context is current in a calling thread.
But supporting EGL will definitely be a nice addition.

Evgeny