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

Pinning in TODO app backend #109

Open
danielkec opened this issue Dec 16, 2024 · 1 comment
Open

Pinning in TODO app backend #109

danielkec opened this issue Dec 16, 2024 · 1 comment
Labels
4.x bug Something isn't working

Comments

@danielkec
Copy link
Contributor

danielkec commented Dec 16, 2024

DbService CDI bean has parking instruction in constructor, which is locked in synchronize block by Weld.

public DbService(Config config) {
Cluster.Builder clusterBuilder = Cluster.builder()
.withoutMetrics();
Config cConfig = config.get("cassandra");
cConfig.get("servers").asList(Config.class).stream()
.flatMap(Collection::stream)
.map(server -> server.get("host").asString().get())
.forEach(clusterBuilder::addContactPoints);
cConfig.get("port").asInt().ifPresent(clusterBuilder::withPort);
Cluster cluster = clusterBuilder.build();
session = cluster.connect("backend");
listStatement = session.prepare(LIST_QUERY);

-------------------------------------------------------------------------------
Test set: io.helidon.examples.todos.backend.BackendTests
-------------------------------------------------------------------------------
Tests run: 2, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 16.206 s <<< FAILURE! - in io.helidon.examples.todos.backend.BackendTests
io.helidon.examples.todos.backend.BackendTests  Time elapsed: 16.206 s  <<< FAILURE!
io.helidon.microprofile.testing.common.PinningException: 
Pinned virtual threads were detected:
jdk.VirtualThreadPinned {
  startTime = 14:35:26.404 (2024-12-16)
  duration = 22.0 ms
  eventThread = "[0x524f5994 0x51a37d60] WebServer socket" (javaThreadId = 68, virtual)
  stackTrace = [
    java.lang.VirtualThread.parkOnCarrierThread(boolean, long) line: 689
    java.lang.VirtualThread.park() line: 607
    java.lang.System$2.parkVirtualThread() line: 2643
    jdk.internal.misc.VirtualThreads.park() line: 54
    java.util.concurrent.locks.LockSupport.park(Object) line: 219
    ...
  ]
}


	at java.lang.VirtualThread.parkOnCarrierThread(java.lang.VirtualThread.java:689)
	at java.lang.VirtualThread.park(java.lang.VirtualThread.java:607)
	at java.lang.System$2.parkVirtualThread(java.lang.System$2.java:2643)
	at jdk.internal.misc.VirtualThreads.park(jdk.internal.misc.VirtualThreads.java:54)
	at java.util.concurrent.locks.LockSupport.park(java.util.concurrent.locks.LockSupport.java:219)
	at com.google.common.util.concurrent.AbstractFuture.get(com.google.common.util.concurrent.AbstractFuture.java:561)
	at com.google.common.util.concurrent.FluentFuture$TrustedFuture.get(com.google.common.util.concurrent.FluentFuture$TrustedFuture.java:91)
	at com.google.common.util.concurrent.Uninterruptibles.getUninterruptibly(com.google.common.util.concurrent.Uninterruptibles.java:247)
	at com.datastax.driver.core.AbstractSession.prepare(com.datastax.driver.core.AbstractSession.java:84)
	at io.helidon.examples.todos.backend.DbService.<init>(io.helidon.examples.todos.backend.DbService.java:82)
	at java.lang.invoke.DirectMethodHandle$Holder.newInvokeSpecial(java.lang.invoke.DirectMethodHandle$Holder.java)
	at java.lang.invoke.LambdaForm$MH+0x00007f7b7c014400.1347870667.invoke(java.lang.invoke.LambdaForm$MH+0x00007f7b7c014400.1347870667.java)
	at java.lang.invoke.Invokers$Holder.invokeExact_MT(java.lang.invoke.Invokers$Holder.java)
	at jdk.internal.reflect.DirectConstructorHandleAccessor.invokeImpl(jdk.internal.reflect.DirectConstructorHandleAccessor.java:87)
	at jdk.internal.reflect.DirectConstructorHandleAccessor.newInstance(jdk.internal.reflect.DirectConstructorHandleAccessor.java:62)
	at java.lang.reflect.Constructor.newInstanceWithCaller(java.lang.reflect.Constructor.java:502)
	at java.lang.reflect.Constructor.newInstance(java.lang.reflect.Constructor.java:486)
	at org.jboss.weld.injection.ConstructorInjectionPoint.newInstance(org.jboss.weld.injection.ConstructorInjectionPoint.java:119)
	at org.jboss.weld.injection.ConstructorInjectionPoint.invokeAroundConstructCallbacks(org.jboss.weld.injection.ConstructorInjectionPoint.java:92)
	at org.jboss.weld.injection.ConstructorInjectionPoint.newInstance(org.jboss.weld.injection.ConstructorInjectionPoint.java:78)
	at org.jboss.weld.injection.producer.AbstractInstantiator.newInstance(org.jboss.weld.injection.producer.AbstractInstantiator.java:28)
	at org.jboss.weld.injection.producer.BasicInjectionTarget.produce(org.jboss.weld.injection.producer.BasicInjectionTarget.java:112)
	at org.jboss.weld.injection.producer.BeanInjectionTarget.produce(org.jboss.weld.injection.producer.BeanInjectionTarget.java:186)
	at org.jboss.weld.bean.ManagedBean.create(org.jboss.weld.bean.ManagedBean.java:160)
	at org.jboss.weld.contexts.AbstractContext.get(org.jboss.weld.contexts.AbstractContext.java:96)
	at org.jboss.weld.bean.ContextualInstanceStrategy$DefaultContextualInstanceStrategy.get(org.jboss.weld.bean.ContextualInstanceStrategy$DefaultContextualInstanceStrategy.java:100)
	at org.jboss.weld.bean.ContextualInstanceStrategy$ApplicationScopedContextualInstanceStrategy.get(org.jboss.weld.bean.ContextualInstanceStrategy$ApplicationScopedContextualInstanceStrategy.java:140)
	at org.jboss.weld.bean.ContextualInstance.get(org.jboss.weld.bean.ContextualInstance.java:50)
	at org.jboss.weld.bean.proxy.ContextBeanInstance.getInstance(org.jboss.weld.bean.proxy.ContextBeanInstance.java:102)
	at org.jboss.weld.bean.proxy.ProxyMethodHandler.invoke(org.jboss.weld.bean.proxy.ProxyMethodHandler.java:105)
	at io.helidon.examples.todos.backend.DbService$Proxy$_$$_WeldClientProxy.insert(io.helidon.examples.todos.backend.DbService$Proxy$_$$_WeldClientProxy.java)
	at io.helidon.examples.todos.backend.JaxRsBackendResource.createIt(io.helidon.examples.todos.backend.JaxRsBackendResource.java:139)
	at io.helidon.examples.todos.backend.JaxRsBackendResource$Proxy$_$$_WeldSubclass.createIt(io.helidon.examples.todos.backend.JaxRsBackendResource$Proxy$_$$_WeldSubclass.java)
	at io.helidon.examples.todos.backend.JaxRsBackendResource$Proxy$_$$_WeldClientProxy.createIt(io.helidon.examples.todos.backend.JaxRsBackendResource$Proxy$_$$_WeldClientProxy.java)
	at java.lang.invoke.LambdaForm$DMH+0x00007f7b7c5b0400.854788294.invokeVirtual(java.lang.invoke.LambdaForm$DMH+0x00007f7b7c5b0400.854788294.java)
	at java.lang.invoke.LambdaForm$MH+0x00007f7b7c72c800.352664287.invoke(java.lang.invoke.LambdaForm$MH+0x00007f7b7c72c800.352664287.java)
	at java.lang.invoke.LambdaForm$MH+0x00007f7b7c2a9400.1891673045.invokeExact_MT(java.lang.invoke.LambdaForm$MH+0x00007f7b7c2a9400.1891673045.java)
	at jdk.internal.reflect.DirectMethodHandleAccessor.invokeImpl(jdk.internal.reflect.DirectMethodHandleAccessor.java:155)
	at jdk.internal.reflect.DirectMethodHandleAccessor.invoke(jdk.internal.reflect.DirectMethodHandleAccessor.java:103)
	at java.lang.reflect.Method.invoke(java.lang.reflect.Method.java:580)
	at org.glassfish.jersey.server.model.internal.ResourceMethodInvocationHandlerFactory.lambda$static$0(org.glassfish.jersey.server.model.internal.ResourceMethodInvocationHandlerFactory.java:52)
	at org.glassfish.jersey.server.model.internal.ResourceMethodInvocationHandlerFactory$$Lambda+0x00007f7b7c64e4d8.1428992213.invoke(org.glassfish.jersey.server.model.internal.ResourceMethodInvocationHandlerFactory$$Lambda+0x00007f7b7c64e4d8.1428992213.java)
	at org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher$1.run(org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher$1.java:146)
	at org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher.invoke(org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher.java:189)
	at org.glassfish.jersey.server.model.internal.JavaResourceMethodDispatcherProvider$ResponseOutInvoker.doDispatch(org.glassfish.jersey.server.model.internal.JavaResourceMethodDispatcherProvider$ResponseOutInvoker.java:176)
	at org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher.dispatch(org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher.java:93)
	at org.glassfish.jersey.server.model.ResourceMethodInvoker.invoke(org.glassfish.jersey.server.model.ResourceMethodInvoker.java:478)
	at org.glassfish.jersey.server.model.ResourceMethodInvoker.apply(org.glassfish.jersey.server.model.ResourceMethodInvoker.java:400)
	at org.glassfish.jersey.server.model.ResourceMethodInvoker.apply(org.glassfish.jersey.server.model.ResourceMethodInvoker.java:81)
	at org.glassfish.jersey.server.ServerRuntime$1.run(org.glassfish.jersey.server.ServerRuntime$1.java:274)
	at org.glassfish.jersey.internal.Errors$1.call(org.glassfish.jersey.internal.Errors$1.java:248)
	at org.glassfish.jersey.internal.Errors$1.call(org.glassfish.jersey.internal.Errors$1.java:244)
	at org.glassfish.jersey.internal.Errors.process(org.glassfish.jersey.internal.Errors.java:292)
	at org.glassfish.jersey.internal.Errors.process(org.glassfish.jersey.internal.Errors.java:274)
	at org.glassfish.jersey.internal.Errors.process(org.glassfish.jersey.internal.Errors.java:244)
	at org.glassfish.jersey.process.internal.RequestScope.runInScope(org.glassfish.jersey.process.internal.RequestScope.java:266)
	at org.glassfish.jersey.server.ServerRuntime.process(org.glassfish.jersey.server.ServerRuntime.java:253)
	at org.glassfish.jersey.server.ApplicationHandler.handle(org.glassfish.jersey.server.ApplicationHandler.java:696)
	at io.helidon.microprofile.server.JaxRsService.doHandle(io.helidon.microprofile.server.JaxRsService.java:228)
	at io.helidon.microprofile.server.JaxRsService.lambda$handle$2(io.helidon.microprofile.server.JaxRsService.java:185)
	at io.helidon.microprofile.server.JaxRsService$$Lambda+0x00007f7b7c712608.1578307408.run(io.helidon.microprofile.server.JaxRsService$$Lambda+0x00007f7b7c712608.1578307408.java)
	at io.helidon.common.context.Contexts.runInContext(io.helidon.common.context.Contexts.java:117)
	at io.helidon.microprofile.server.JaxRsService.handle(io.helidon.microprofile.server.JaxRsService.java:185)
	at io.helidon.microprofile.server.JaxRsService$$Lambda+0x00007f7b7c68f090.130326586.handle(io.helidon.microprofile.server.JaxRsService$$Lambda+0x00007f7b7c68f090.130326586.java)
@danielkec
Copy link
Contributor Author

org.jboss.weld.bean.ContextualInstanceStrategy.ApplicationScopedContextualInstanceStrategy#get

        T get(Bean<T> bean, BeanManagerImpl manager, CreationalContext<?> ctx) {
            T instance = this.value;
            if (instance != null) {
                return instance;
            } else {
                synchronized(this) {
                    if ((instance = this.value) == null) {
                        this.value = instance = (T)super.get(bean, manager, ctx);
                    }

                    return instance;
                }
            }
        }

@github-project-automation github-project-automation bot moved this to Triage in Backlog Dec 19, 2024
@m0mus m0mus added 4.x bug Something isn't working labels Dec 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
4.x bug Something isn't working
Projects
Status: Triage
Development

No branches or pull requests

2 participants