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

Qute extension conflict Redis-cache extension cause Deployment build time failed #35680

Closed
leotu opened this issue Sep 1, 2023 · 18 comments
Closed
Labels
area/cache area/qute The template engine area/redis kind/bug Something isn't working

Comments

@leotu
Copy link

leotu commented Sep 1, 2023

Describe the bug

Mailer extension include Qute extension library that raise Build step failed

Unable to determine the value type for 'qute-cache' Redis cache. An appropriate configuration value for 'quarkus.cache.redis.qute-cache.value-type' needs to be set

pom.xml

<dependency>
	<groupId>io.quarkus</groupId>
	<artifactId>quarkus-mailer</artifactId>
</dependency>

<dependency>
	<groupId>io.quarkus</groupId>
	<artifactId>quarkus-redis-cache</artifactId>
</dependency>
  • Error StackTrace
2023-09-01 17:28:47,798 ERROR [io.qua.dep.dev.IsolatedDevModeMain] (main) Failed to start quarkus: java.lang.RuntimeException: io.quarkus.builder.BuildException: Build failure: Build failed due to errors
	[error]: Build step io.quarkus.cache.redis.deployment.RedisCacheProcessor#determineValueTypes threw an exception: jakarta.enterprise.inject.spi.DeploymentException: Unable to determine the value type for 'qute-cache' Redis cache. An appropriate configuration value for 'quarkus.cache.redis.qute-cache.value-type' needs to be set
	at io.quarkus.cache.redis.deployment.RedisCacheProcessor.determineValueTypes(RedisCacheProcessor.java:97)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:568)
	at io.quarkus.deployment.ExtensionLoader$3.execute(ExtensionLoader.java:864)
	at io.quarkus.builder.BuildContext.run(BuildContext.java:282)
	at org.jboss.threads.ContextHandler$1.runWith(ContextHandler.java:18)
	at org.jboss.threads.EnhancedQueueExecutor$Task.run(EnhancedQueueExecutor.java:2513)
	at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1538)
	at java.base/java.lang.Thread.run(Thread.java:833)
	at org.jboss.threads.JBossThread.run(JBossThread.java:501)

	at io.quarkus.runner.bootstrap.AugmentActionImpl.runAugment(AugmentActionImpl.java:336)
	at io.quarkus.runner.bootstrap.AugmentActionImpl.createInitialRuntimeApplication(AugmentActionImpl.java:253)
	at io.quarkus.runner.bootstrap.AugmentActionImpl.createInitialRuntimeApplication(AugmentActionImpl.java:60)
	at io.quarkus.deployment.dev.IsolatedDevModeMain.firstStart(IsolatedDevModeMain.java:82)
	at io.quarkus.deployment.dev.IsolatedDevModeMain.accept(IsolatedDevModeMain.java:423)
	at io.quarkus.deployment.dev.IsolatedDevModeMain.accept(IsolatedDevModeMain.java:55)
	at io.quarkus.bootstrap.app.CuratedApplication.runInCl(CuratedApplication.java:138)
	at io.quarkus.bootstrap.app.CuratedApplication.runInAugmentClassLoader(CuratedApplication.java:93)
	at io.quarkus.deployment.dev.DevModeMain.start(DevModeMain.java:131)
	at io.quarkus.deployment.dev.DevModeMain.main(DevModeMain.java:62)
Caused by: io.quarkus.builder.BuildException: Build failure: Build failed due to errors
	[error]: Build step io.quarkus.cache.redis.deployment.RedisCacheProcessor#determineValueTypes threw an exception: jakarta.enterprise.inject.spi.DeploymentException: Unable to determine the value type for 'qute-cache' Redis cache. An appropriate configuration value for 'quarkus.cache.redis.qute-cache.value-type' needs to be set
	at io.quarkus.cache.redis.deployment.RedisCacheProcessor.determineValueTypes(RedisCacheProcessor.java:97)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:568)
	at io.quarkus.deployment.ExtensionLoader$3.execute(ExtensionLoader.java:864)
	at io.quarkus.builder.BuildContext.run(BuildContext.java:282)
	at org.jboss.threads.ContextHandler$1.runWith(ContextHandler.java:18)
	at org.jboss.threads.EnhancedQueueExecutor$Task.run(EnhancedQueueExecutor.java:2513)
	at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1538)
	at java.base/java.lang.Thread.run(Thread.java:833)
	at org.jboss.threads.JBossThread.run(JBossThread.java:501)

	at io.quarkus.builder.Execution.run(Execution.java:123)
	at io.quarkus.builder.BuildExecutionBuilder.execute(BuildExecutionBuilder.java:79)
	at io.quarkus.deployment.QuarkusAugmentor.run(QuarkusAugmentor.java:160)
	at io.quarkus.runner.bootstrap.AugmentActionImpl.runAugment(AugmentActionImpl.java:332)
	... 9 more
Caused by: jakarta.enterprise.inject.spi.DeploymentException: Unable to determine the value type for 'qute-cache' Redis cache. An appropriate configuration value for 'quarkus.cache.redis.qute-cache.value-type' needs to be set
	at io.quarkus.cache.redis.deployment.RedisCacheProcessor.determineValueTypes(RedisCacheProcessor.java:97)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:568)
	at io.quarkus.deployment.ExtensionLoader$3.execute(ExtensionLoader.java:864)
	at io.quarkus.builder.BuildContext.run(BuildContext.java:282)
	at org.jboss.threads.ContextHandler$1.runWith(ContextHandler.java:18)
	at org.jboss.threads.EnhancedQueueExecutor$Task.run(EnhancedQueueExecutor.java:2513)
	at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1538)
	at java.base/java.lang.Thread.run(Thread.java:833)
	at org.jboss.threads.JBossThread.run(JBossThread.java:501)

Expected behavior

How set set the value or RedisCacheProcessor automatically skip it ?

'quarkus.cache.redis.qute-cache.value-type'

quarkus:
  cache:
    #caffeine:
    # qute-cache:
    #    value-type: xxx

    redis:
      qute-cache:
        value-type: ???

Actual behavior

https://quarkus.io/guides/qute-reference#cached-section

howt to resolve it ?

  1. specify cache Implementation ?
  2. disable template cache ?
  3. mailer execlude qute ?
  4. or ...

How to Reproduce?

No response

Output of uname -a or ver

No response

Output of java -version

JDK 17.0.4.1

GraalVM version (if different from Java)

No response

Quarkus version or git rev

3.2.4.Final

Build tool (ie. output of mvnw --version or gradlew --version)

No response

Additional information

"qute-cache" from io.quarkus.qute.cache.QuteCache.java

package io.quarkus.qute.cache;

public final class QuteCache {

    /**
     * The name of the cache used to cache parts of templates
     */
    public static final String NAME = "qute-cache";

}
@leotu leotu added the kind/bug Something isn't working label Sep 1, 2023
@quarkus-bot
Copy link

quarkus-bot bot commented Sep 1, 2023

/cc @cescoffier (redis), @gsmet (redis), @gwenneg (cache), @machi1990 (redis), @mkouba (qute)

@leotu
Copy link
Author

leotu commented Sep 1, 2023

Exclusion can't solve

<dependency>
   <groupId>io.quarkus</groupId>
   <artifactId>quarkus-mailer</artifactId>
       <exclusions>
	  <exclusion>
	    <groupId>io.quarkus</groupId>
	    <artifactId>quarkus-qute</artifactId>
	  </exclusion>
      </exclusions>
</dependency>
2023-09-01 18:12:23,728 ERROR [io.qua.dep.dev.IsolatedDevModeMain] (main) Failed to start quarkus: java.lang.NoClassDefFoundError: io/quarkus/qute/i18n/MessageBundle
	at io.quarkus.qute.deployment.Names.<clinit>(Names.java:31)
	at io.quarkus.qute.deployment.QuteProcessor.<clinit>(QuteProcessor.java:155)
	at java.base/java.lang.Class.forName0(Native Method)
	at java.base/java.lang.Class.forName(Class.java:467)
	at io.quarkus.deployment.util.ServiceUtil.classesNamedIn(ServiceUtil.java:29)
	at io.quarkus.deployment.ExtensionLoader.loadStepsFrom(ExtensionLoader.java:170)
	at io.quarkus.deployment.QuarkusAugmentor.run(QuarkusAugmentor.java:107)
	at io.quarkus.runner.bootstrap.AugmentActionImpl.runAugment(AugmentActionImpl.java:332)
	at io.quarkus.runner.bootstrap.AugmentActionImpl.createInitialRuntimeApplication(AugmentActionImpl.java:253)
	at io.quarkus.runner.bootstrap.AugmentActionImpl.createInitialRuntimeApplication(AugmentActionImpl.java:60)
	at io.quarkus.deployment.dev.IsolatedDevModeMain.firstStart(IsolatedDevModeMain.java:82)
	at io.quarkus.deployment.dev.IsolatedDevModeMain.accept(IsolatedDevModeMain.java:423)
	at io.quarkus.deployment.dev.IsolatedDevModeMain.accept(IsolatedDevModeMain.java:55)
	at io.quarkus.bootstrap.app.CuratedApplication.runInCl(CuratedApplication.java:138)
	at io.quarkus.bootstrap.app.CuratedApplication.runInAugmentClassLoader(CuratedApplication.java:93)
	at io.quarkus.deployment.dev.DevModeMain.start(DevModeMain.java:131)
	at io.quarkus.deployment.dev.DevModeMain.main(DevModeMain.java:62)
Caused by: java.lang.ClassNotFoundException: io.quarkus.qute.i18n.MessageBundle
	at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:641)
	at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:188)
	at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:520)
	at io.quarkus.bootstrap.classloading.QuarkusClassLoader.loadClass(QuarkusClassLoader.java:516)
	at io.quarkus.bootstrap.classloading.QuarkusClassLoader.loadClass(QuarkusClassLoader.java:466)
	... 17 more

@mkouba
Copy link
Contributor

mkouba commented Sep 1, 2023

Just a wild guess (I have zero knowledge of the redis extension) - you can try to specify the default value type for the qute-cache with the quarkus.cache.redis."qute-cache".value-type config property as a workaround; the value should be io.quarkus.qute.ResultNode.

@geoand
Copy link
Contributor

geoand commented Sep 1, 2023

If that is indeed the solution, we should probably set it automatically when qute and redis-cache are used.

But we might also want to not use the cache in Qute in this case...

@mkouba
Copy link
Contributor

mkouba commented Sep 1, 2023

If that is indeed the solution, we should probably set it automatically when qute and redis-cache are used.

Well, in general any extension can produce an AdditionalCacheNameBuildItem so it's IMO not a qute-specific problem.

But we might also want to not use the cache in Qute in this case...

I'd like to know the details about this redis requirement - the cache SPI does not seem to define any... Maybe we should enhance the SPI instead?

@geoand
Copy link
Contributor

geoand commented Sep 1, 2023

It's true that it's not a Qute specific problem, and we should indeed augment the SPI.

Essentially what this does is enable the Redis cache extension to know the type of data that is going to be exchanged with the server which in turn is used in order to marshall and unmarshall the data over the wire.

@mkouba
Copy link
Contributor

mkouba commented Sep 1, 2023

Essentially what this does is enable the Redis cache extension to know the type of data that is going to be exchanged with the server which in turn is used in order to marshall and unmarshall the data over the wire.

How does it handle serialization?

@mkouba
Copy link
Contributor

mkouba commented Sep 1, 2023

https://github.com/quarkusio/quarkus/blob/3.3.1/extensions/redis-client/runtime/src/main/java/io/quarkus/redis/runtime/datasource/Marshaller.java

Ah, so it wouldn't work anyway as there's probably no working codec for the ResultNode. In that case, we should make it possible to inspect the cache impl capabilities at build time so that we can only register the additional cache conditionally...?

@geoand
Copy link
Contributor

geoand commented Sep 1, 2023

Yeah, that's probably a good option.

@leotu
Copy link
Author

leotu commented Sep 1, 2023

Just a wild guess (I have zero knowledge of the redis extension) - you can try to specify the default value type for the qute-cache with the quarkus.cache.redis."qute-cache".value-type config property as a workaround; the value should be io.quarkus.qute.ResultNode.

It can be successfully compiled when setting value:

quarkus.cache.redis."qute-cache".value-type = io.quarkus.qute.ResultNode

But i am not sure Qute is working and it shouldn't choose redis cache if both caffeine and redis exist.

@mkouba
Copy link
Contributor

mkouba commented Sep 4, 2023

But i am not sure Qute is working...

I don't think it is.

...and it shouldn't choose redis cache if both caffeine and redis exist.

But only one cache implementation can be present, right? We need to enhance the SPI so that it's possible to detect the cache impl...

@geoand
Copy link
Contributor

geoand commented Sep 4, 2023

Right, only one impl is allowed

@geoand
Copy link
Contributor

geoand commented Sep 8, 2023

I'll have to think of this a little

@geoand
Copy link
Contributor

geoand commented Sep 8, 2023

For Qute specifically, is caching templates on a remote server a good thing or would it hurt performance?

@mkouba
Copy link
Contributor

mkouba commented Sep 8, 2023

For Qute specifically, is caching templates on a remote server a good thing or would it hurt performance?

I don't think it's a good idea. So the SPI should at least provide a way to detect the type of the cache (in-memory/remote).

@geoand
Copy link
Contributor

geoand commented Sep 8, 2023

That's what I thought, thanks!

@geoand
Copy link
Contributor

geoand commented Sep 8, 2023

#35817 should take care of it

@geoand geoand closed this as completed in 8ffe29d Sep 8, 2023
geoand added a commit that referenced this issue Sep 8, 2023
Improve Qute + Cache integration
gsmet pushed a commit to gsmet/quarkus that referenced this issue Sep 13, 2023
aloubyansky pushed a commit to aloubyansky/quarkus that referenced this issue Oct 31, 2023
jedla97 added a commit to jedla97/quarkus-test-suite that referenced this issue Nov 16, 2023
Most of the tests are reused from caffeine module anshould cover similar scenarios as spring che and caffeine cache.
jedla97 added a commit to jedla97/quarkus-test-suite that referenced this issue Nov 16, 2023
Most of the tests are reused from caffeine module anshould cover similar scenarios as spring che and caffeine cache.
jedla97 added a commit to jedla97/quarkus-test-suite that referenced this issue Nov 16, 2023
Most of the tests are reused from caffeine module anshould cover similar scenarios as spring che and caffeine cache.
jedla97 added a commit to jedla97/quarkus-test-suite that referenced this issue Nov 16, 2023
Most of the tests are reused from caffeine module anshould cover similar scenarios as spring che and caffeine cache.
jedla97 added a commit to jedla97/quarkus-test-suite that referenced this issue Nov 16, 2023
Most of the tests are reused from caffeine module anshould cover similar scenarios as spring che and caffeine cache.
jedla97 added a commit to jedla97/quarkus-test-suite that referenced this issue Nov 16, 2023
Most of the tests are reused from caffeine module anshould cover similar scenarios as spring che and caffeine cache.
jedla97 added a commit to jedla97/quarkus-test-suite that referenced this issue Nov 16, 2023
Most of the tests are reused from caffeine module anshould cover similar scenarios as spring che and caffeine cache.
jedla97 added a commit to jedla97/quarkus-test-suite that referenced this issue Nov 20, 2023
Most of the tests are reused from caffeine module anshould cover similar scenarios as spring che and caffeine cache.
jedla97 added a commit to jedla97/quarkus-test-suite that referenced this issue Nov 20, 2023
Most of the tests are reused from caffeine module anshould cover similar scenarios as spring che and caffeine cache.
jedla97 added a commit to jedla97/quarkus-test-suite that referenced this issue Nov 21, 2023
Most of the tests are reused from caffeine module anshould cover similar scenarios as spring che and caffeine cache.
michalvavrik pushed a commit to michalvavrik/quarkus-test-suite that referenced this issue Nov 21, 2023
Most of the tests are reused from caffeine module anshould cover similar scenarios as spring che and caffeine cache.
michalvavrik pushed a commit to michalvavrik/quarkus-test-suite that referenced this issue Nov 21, 2023
Most of the tests are reused from caffeine module anshould cover similar scenarios as spring che and caffeine cache.
michalvavrik pushed a commit to michalvavrik/quarkus-test-suite that referenced this issue Nov 21, 2023
Most of the tests are reused from caffeine module anshould cover similar scenarios as spring che and caffeine cache.
holly-cummins pushed a commit to holly-cummins/quarkus that referenced this issue Feb 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/cache area/qute The template engine area/redis kind/bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants