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

Redis GET with byte[] as type leads to unmarshaling exception #28029

Closed
jendib opened this issue Sep 17, 2022 · 4 comments · Fixed by #28036
Closed

Redis GET with byte[] as type leads to unmarshaling exception #28029

jendib opened this issue Sep 17, 2022 · 4 comments · Fixed by #28036
Assignees
Labels
area/redis kind/bug Something isn't working
Milestone

Comments

@jendib
Copy link

jendib commented Sep 17, 2022

Describe the bug

I'm using this example https://quarkus.io/guides/redis-reference#storing-binary-data to get a value storing byte data and I'm getting this exception:

io.vertx.core.json.DecodeException: Failed to decode:Illegal character ((CTRL-CHAR, code 5)): only regular white space (\r, \n, \t) is allowed between tokens
 at [Source: (io.netty.buffer.ByteBufInputStream); line: 1, column: 2]
	at io.quarkus.vertx.runtime.jackson.QuarkusJacksonJsonCodec.fromParser(QuarkusJacksonJsonCodec.java:128)
	at io.quarkus.vertx.runtime.jackson.QuarkusJacksonJsonCodec.fromBuffer(QuarkusJacksonJsonCodec.java:100)
	at io.vertx.core.json.Json.decodeValue(Json.java:119)
	at io.quarkus.redis.datasource.codecs.Codecs$JsonCodec.decode(Codecs.java:44)
	at io.quarkus.redis.runtime.datasource.Marshaller.decode(Marshaller.java:92)
	at io.quarkus.redis.runtime.datasource.Marshaller.decode(Marshaller.java:83)
	at io.quarkus.redis.runtime.datasource.AbstractStringCommands.decodeV(AbstractStringCommands.java:59)
	at io.smallrye.context.impl.wrappers.SlowContextualFunction.apply(SlowContextualFunction.java:21)
	at io.smallrye.mutiny.operators.uni.UniOnItemTransform$UniOnItemTransformProcessor.onItem(UniOnItemTransform.java:36)
	at io.smallrye.mutiny.vertx.AsyncResultUni.lambda$subscribe$1(AsyncResultUni.java:35)

It seems that even if I'm using a byte[] type it tries to unmarshall the value as JSON.

In io.quarkus.redis.datasource.codecs.Codecs.getDefaultCodecFor it defaults to JsonCodec, maybe we need a new codec doing nothing for byte[]?

Expected behavior

No response

Actual behavior

No response

How to Reproduce?

No response

Output of uname -a or ver

No response

Output of java -version

Java 17

GraalVM version (if different from Java)

No response

Quarkus version or git rev

2.12.2

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

No response

Additional information

No response

@jendib jendib added the kind/bug Something isn't working label Sep 17, 2022
@quarkus-bot
Copy link

quarkus-bot bot commented Sep 17, 2022

/cc @cescoffier, @gsmet, @machi1990

@cescoffier cescoffier self-assigned this Sep 17, 2022
cescoffier added a commit to cescoffier/quarkus that referenced this issue Sep 17, 2022
Initially, it relied on the JSON codec (encoding the byte arrays using base 64). This was breaking the compatibility with other libraries.

Fix quarkusio#28029.
@cescoffier
Copy link
Member

You are right. Can you try the PR I just opened? (#28036)

@jendib
Copy link
Author

jendib commented Sep 18, 2022

@cescoffier Is there an easy way to try it?

@cescoffier
Copy link
Member

You would need to check out the main branch and build it. See https://github.com/quarkusio/quarkus/blob/main/CONTRIBUTING.md#checking-an-issue-is-fixed-in-main.

Alternatively, you can try the snapshots, but it's not very reliable.

@quarkus-bot quarkus-bot bot added this to the 2.14 - main milestone Sep 19, 2022
@gsmet gsmet modified the milestones: 2.14 - main, 2.12.3.Final Sep 19, 2022
gsmet pushed a commit to gsmet/quarkus that referenced this issue Sep 19, 2022
Initially, it relied on the JSON codec (encoding the byte arrays using base 64). This was breaking the compatibility with other libraries.

Fix quarkusio#28029.

(cherry picked from commit 4a2546e)
gsmet pushed a commit to gsmet/quarkus that referenced this issue Sep 20, 2022
Initially, it relied on the JSON codec (encoding the byte arrays using base 64). This was breaking the compatibility with other libraries.

Fix quarkusio#28029.

(cherry picked from commit 4a2546e)
igorregis pushed a commit to igorregis/quarkus that referenced this issue Oct 16, 2022
Initially, it relied on the JSON codec (encoding the byte arrays using base 64). This was breaking the compatibility with other libraries.

Fix quarkusio#28029.
igorregis pushed a commit to igorregis/quarkus that referenced this issue Oct 16, 2022
Initially, it relied on the JSON codec (encoding the byte arrays using base 64). This was breaking the compatibility with other libraries.

Fix quarkusio#28029.
igorregis pushed a commit to igorregis/quarkus that referenced this issue Oct 16, 2022
Initially, it relied on the JSON codec (encoding the byte arrays using base 64). This was breaking the compatibility with other libraries.

Fix quarkusio#28029.
igorregis pushed a commit to igorregis/quarkus that referenced this issue Oct 17, 2022
Initially, it relied on the JSON codec (encoding the byte arrays using base 64). This was breaking the compatibility with other libraries.

Fix quarkusio#28029.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/redis kind/bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants