-
Notifications
You must be signed in to change notification settings - Fork 94
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
@Document objects sometimes not reading the @Reference associations, Which leads to JsonSyntaxException #403
Comments
@abilash-sethu happy to assist... First we need to recreate the conditions to be able to recreate the issue. Could you put a bare-bones Redis OM Spring App with a toy model that resembles the one in production and perhaps a few of the operations causing trouble. If such an example can be assembled I can start working towards a solution. Cheers! |
@bsbodden Thanks for the response, Will try to prepare something and get back to you |
@bsbodden Sorry for the delay, We were doing a lot of tests to see whether the same issue is coming, And yes it is coming very often now, In many places. It was a challenge to create a POC that regenerates the same issue. I've managed to set up a small project which replicates the same cache structure as we have. There is a scheduler in the controller which runs frequently and fetches the data, In the startup I can see the issue is throwing.
IMPORTANT: The issue only occurs on the startup in this demo, But in our real project we get these issues in runtime Another additional piece of info is we run the Redis on docker container using the below command
Here is the version details: |
@abilash-sethu we'll start looking into it. Thanks for the report! |
I also faced this issue... I hope the issue get resolved soon. |
@abilash-sethu I haven't been able to trigger the exception on my system yet. Until I can get a demonstrable error to fix I just wanted to drop a few observations...
I will try to write a different test to try to recreate the condition, my guess is that something in GSon can handle the rapid fire, so a try/catch, retry or protected code block to handle the deserialization might be the cure |
@abilash-sethu @Salman83 Could either of you or both test your code against this PR #431 - I believe the changes in it might solve all of your @reference problems. |
@bsbodden Thanks for the report, Will test them and get back to you |
The potential fix is included in the latest release. Please test with the Release v0.9.1 - Thanks |
@abilash-sethu @Salman83 Please let us know if this fixed your issues. Thanks! |
@bsbodden Sorry for the delay, I did some tests, But unfortunately, I still face the issue, I'll put the full server logs here, Might be helpful for you to understand more See the updated POM |
@abilash-sethu since I haven't been able to reproduce this, here's what my ask is, can we do a uber-minimal example, 1 model, no web interface, just a |
@bsbodden I'll give it a try and get back to you |
@bsbodden Sorry for the delay, With minimal data/indexes/reads, it looks like not reproducing |
We've been working on a project where we use @reference with @document models a lot, In some of the documents even have more than 10+ @reference associations.
Sometimes when we use RedisDocumentRepository/EntitiyStream to read such documents from redis, We get the following error
com.google.gson.JsonSyntaxException: java.lang.IllegalStateException: Expected BEGIN_OBJECT but was STRING at line 1 column 424 path $.vehicleMake at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$Adapter.read(ReflectiveTypeAdapterFactory.java:397) at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$1.readIntoField(ReflectiveTypeAdapterFactory.java:212) at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$FieldReflectionAdapter.readField(ReflectiveTypeAdapterFactory.java:433) at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$Adapter.read(ReflectiveTypeAdapterFactory.java:393) at com.google.gson.Gson.fromJson(Gson.java:1227) at com.google.gson.Gson.fromJson(Gson.java:1137) at com.google.gson.Gson.fromJson(Gson.java:1047) at com.google.gson.Gson.fromJson(Gson.java:982) at com.redis.om.spring.repository.query.RediSearchQuery.executeQuery(RediSearchQuery.java:462) at com.redis.om.spring.repository.query.RediSearchQuery.execute(RediSearchQuery.java:360) at org.springframework.data.repository.core.support.RepositoryMethodInvoker.doInvoke(RepositoryMethodInvoker.java:136) at org.springframework.data.repository.core.support.RepositoryMethodInvoker.invoke(RepositoryMethodInvoker.java:120) at org.springframework.data.repository.core.support.QueryExecutorMethodInterceptor.doInvoke(QueryExecutorMethodInterceptor.java:164) at org.springframework.data.repository.core.support.QueryExecutorMethodInterceptor.invoke(QueryExecutorMethodInterceptor.java:143) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:184) at org.springframework.data.projection.DefaultMethodInvokingMethodInterceptor.invoke(DefaultMethodInvokingMethodInterceptor.java:72) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:184) at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:97) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:184) at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:244) at jdk.proxy2/jdk.proxy2.$Proxy235.findByEnterpriseIdAndSurId(Unknown Source) at jdk.internal.reflect.GeneratedMethodAccessor88.invoke(Unknown Source) at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.base/java.lang.reflect.Method.invoke(Method.java:568) at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:343)
The document is Vehicle document has 10+ associations, vehicle make is one of them. When we debug this on Google GSON library, We saw that the above vehicleMake association is coming as null in all fields. At the same time, some @reference associations are fetching correctly, We verified the reference ids in the other hand of the cache, Everything seems ok
The weird thing is it is not happening all the time, So we are very confused, We assumed this could be due to network/server issues, We added more server resources and restarted the services, Still often we are getting this issue in many places not only with vehicle document.
Versions Used
Spring boot: 3.1.3
Redis Om Spring: 0.8.7
RediSearch : 2.8.9
RedisJSON : 2.6.7
@bsbodden Any help would be greatly appreciated
The text was updated successfully, but these errors were encountered: