Skip to content

Intermitent error mapping Record #2585

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

Closed
jeferson-cleancloud opened this issue Aug 27, 2022 · 21 comments
Closed

Intermitent error mapping Record #2585

jeferson-cleancloud opened this issue Aug 27, 2022 · 21 comments
Assignees
Labels
status: feedback-provided Feedback has been provided

Comments

@jeferson-cleancloud
Copy link

Hi guys, I am using the current configuration:

  • spring-data-neo4j version 6.2.5
  • spring-data-jpa version 2.6.2

And frequently I am facing an error which a record could not be mapped. The problem is that this error is intermitent, the same Node sometimes work and others do not. My best guess is some race condition or anything related to that.

Here is the stack using a simple JPA findByCode():

org.springframework.data.mapping.MappingException: Error mapping Record<{NODE_INFORMATION_HERE}}>
	at org.springframework.data.neo4j.core.mapping.DefaultNeo4jEntityConverter.read(DefaultNeo4jEntityConverter.java:118)
	at org.springframework.data.neo4j.core.mapping.DefaultNeo4jEntityConverter.read(DefaultNeo4jEntityConverter.java:70)
	at org.springframework.data.neo4j.core.mapping.Schema.lambda$getRequiredMappingFunctionFor$0(Schema.java:96)
	at org.springframework.data.neo4j.core.PreparedQuery$AggregatingMappingFunction.apply(PreparedQuery.java:246)
	at org.springframework.data.neo4j.core.PreparedQuery$AggregatingMappingFunction.apply(PreparedQuery.java:158)
	at org.springframework.data.neo4j.core.DelegatingMappingFunctionWithNullCheck.apply(DelegatingMappingFunctionWithNullCheck.java:45)
	at org.springframework.data.neo4j.core.DelegatingMappingFunctionWithNullCheck.apply(DelegatingMappingFunctionWithNullCheck.java:35)
	at org.springframework.data.neo4j.core.DefaultNeo4jClient$DefaultRecordFetchSpec.one(DefaultNeo4jClient.java:455)
	at java.base/java.util.Optional.flatMap(Optional.java:294)
	at org.springframework.data.neo4j.core.Neo4jTemplate$DefaultExecutableQuery.getSingleResult(Neo4jTemplate.java:987)
	at org.springframework.data.neo4j.repository.query.Neo4jQueryExecution$DefaultQueryExecution.execute(Neo4jQueryExecution.java:53)
	at org.springframework.data.neo4j.repository.query.AbstractNeo4jQuery.execute(AbstractNeo4jQuery.java:94)
	at org.springframework.data.repository.core.support.RepositoryMethodInvoker.doInvoke(RepositoryMethodInvoker.java:137)
	at org.springframework.data.repository.core.support.RepositoryMethodInvoker.invoke(RepositoryMethodInvoker.java:121)
	at org.springframework.data.repository.core.support.QueryExecutorMethodInterceptor.doInvoke(QueryExecutorMethodInterceptor.java:159)
	at org.springframework.data.repository.core.support.QueryExecutorMethodInterceptor.invoke(QueryExecutorMethodInterceptor.java:138)
	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186)
	at org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:123)
	at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:388)
	at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:119)
	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186)
	at org.springframework.dao.support.PersistenceExceptionTranslationInterceptor.invoke(PersistenceExceptionTranslationInterceptor.java:137)
	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186)
	at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:97)
	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186)
	at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:215)
	at com.sun.proxy.$Proxy88.findByCode(Unknown Source)
	at [MY_SERVICE].getEntityByCode()
    ...
	at org.springframework.data.neo4j.core.mapping.NodeDescriptionStore.lambda$new$0(NodeDescriptionStore.java:56)
	at org.springframework.data.neo4j.core.mapping.NodeDescriptionStore.deriveConcreteNodeDescription(NodeDescriptionStore.java:100)
	at org.springframework.data.neo4j.core.mapping.DefaultNeo4jEntityConverter.lambda$map$2(DefaultNeo4jEntityConverter.java:277)
	at org.springframework.data.neo4j.core.mapping.DefaultNeo4jEntityConverter.map(DefaultNeo4jEntityConverter.java:300)
	at org.springframework.data.neo4j.core.mapping.DefaultNeo4jEntityConverter.map(DefaultNeo4jEntityConverter.java:255)
	at org.springframework.data.neo4j.core.mapping.DefaultNeo4jEntityConverter.read(DefaultNeo4jEntityConverter.java:116)
	... 47 common frames omitted
@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Aug 27, 2022
@meistermeier meistermeier self-assigned this Aug 29, 2022
@meistermeier
Copy link
Collaborator

Hi and thanks for reporting this. Usually there is a root cause behind the ... that could help us to shift the focus on what is happening.
Could you provide the full stack trace please? Just for comparison something like the stack trace provided here: #2526

@meistermeier meistermeier added status: waiting-for-feedback We need additional information before we can continue and removed status: waiting-for-triage An issue we've not yet triaged labels Aug 29, 2022
@spring-projects-issues
Copy link

If you would like us to look at this issue, please provide the requested information. If the information is not provided within the next 7 days this issue will be closed.

@spring-projects-issues spring-projects-issues added the status: feedback-reminder We've sent a reminder that we need additional information before we can continue label Sep 5, 2022
@jeferson-cleancloud
Copy link
Author

Hi @meistermeier, sorry for the response delay.

Based on mapping:

@Node(labels = { "Cloud", "Env" })
public class Cloud extends Env<Cloud> {

    @Property("provider")
    @ConvertWith(converter = ProviderConverter.class)
    private Provider provider;

    @Relationship(type = "HasBilling")
    private Billing billing;

    @Property("disabled_time")
    @DateString
    private Date disabledTime;

    @Property("linked_time")
    @DateString
    private Date linkedTime;

    @Property("status")
    private Status status;

    @Property("revalidation_time")
    @DateString
    private Date revalidationTime;

    @Property("tag_refresh_time")
    @DateString
    private Date tagRefreshTime;
	
    private transient List<String> viewCodes;
	
}


public abstract class Env<T extends Env> extends Entity<T> {

    @Relationship(type = "OwnedBy")
    private Account account;

    @Property("root_code")
    private String rootCode;

    @Property("name")
    private String name;

    @DateString
    @Property("created_time")
    private Date createdTime;

    @DateString
    @Property("updated_time")
    private Date updatedTime;

    @Property("demonstration")
    private Boolean demonstration;
	
}

@Node("Account")
public class Account extends Entity<Account> {

    @Property("created_time")
    @DateString
    private Date createdTime;

    @Property("trial_end_time")
    @DateString
    private Date trialEndTime;

    @Property("activated_time")
    @DateString
    private Date activatedTime;

    @Property("deactivated_time")
    @DateString
    private Date deactivatedTime;

    @Property("active")
    private Boolean active;

    @Property("access_limits")
    @ConvertWith(converter = AccountAccessConverter.class)
    private AccountAccess access;

    @Property("free_of_charge")
    private boolean freeOfCharge;

    @Property("mfa_option")
    @ConvertWith(converter = MfaOptionConverter.class)
    private MfaOption mfaOption;

}

@Node("Billing")
public class Billing extends Entity<Billing> {

    @Property("activated_time")
    @DateString
    private Date activatedTime;

    @Property("revalidation_time")
    @DateString
    private Date revalidationTime;

    @Property("first_collect_date")
    @DateString
    private Date firstCollectDate;

    @Property("last_collect_date")
    @DateString
    private Date lastCollectDate;
	
}

And based on JPA repository:

@Repository
public interface CloudRepository extends PagingAndSortingRepository<Cloud, String> {

    Cloud findByCode(String code);

Here is the complete stack I have:

org.springframework.data.mapping.MappingException: Error mapping Record<{cloud: {tag_refresh_time: "2022-08-24T07:50:12.151Z", __internalNeo4jId__: 109559, created_time: "2022-07-25T12:50:22.735Z", updated_time: NULL, revalidation_time: "2022-08-24T20:06:01.571Z", code: "xxxxxx", Cloud_OwnedBy_Account: [{__internalNeo4jId__: 1, created_time: "2016-01-28T02:35:24.000Z", code: "yyyyyy", activated_time: "2016-01-28T02:37:37.000Z", active: TRUE, access_limits: "{}", trial_end_time: "2022-02-10T00:00:00.000Z", __nodeLabels__: ["Account"], deactivated_time: NULL, mfa_option: "{}", free_of_charge: TRUE}], disabled_time: NULL, __nodeLabels__: ["Cloud", "Env"], root_code: "aaaaaa", viewCodes: NULL, Cloud_HasBilling_Billing: [{__internalNeo4jId__: 108054, revalidation_time: "2022-08-25T07:10:09.664Z", code: "bbbbbb", activated_time: "2022-07-25T12:02:49.741Z", __nodeLabels__: ["Billing"], first_collect_date: "2022-07-25T12:13:35.884Z"}], provider: "{}", linked_time: "2022-07-25T12:50:22.735Z", name: "Name", demonstration: FALSE, status: "ACTIVATED"}}>
	at org.springframework.data.neo4j.core.mapping.DefaultNeo4jEntityConverter.read(DefaultNeo4jEntityConverter.java:118)
	at org.springframework.data.neo4j.core.mapping.DefaultNeo4jEntityConverter.read(DefaultNeo4jEntityConverter.java:70)
	at org.springframework.data.neo4j.core.mapping.Schema.lambda$getRequiredMappingFunctionFor$0(Schema.java:96)
	at org.springframework.data.neo4j.core.PreparedQuery$AggregatingMappingFunction.apply(PreparedQuery.java:246)
	at org.springframework.data.neo4j.core.PreparedQuery$AggregatingMappingFunction.apply(PreparedQuery.java:158)
	at org.springframework.data.neo4j.core.DelegatingMappingFunctionWithNullCheck.apply(DelegatingMappingFunctionWithNullCheck.java:45)
	at org.springframework.data.neo4j.core.DelegatingMappingFunctionWithNullCheck.apply(DelegatingMappingFunctionWithNullCheck.java:35)
	at org.springframework.data.neo4j.core.DefaultNeo4jClient$DefaultRecordFetchSpec.one(DefaultNeo4jClient.java:455)
	at java.base/java.util.Optional.flatMap(Optional.java:294)
	at org.springframework.data.neo4j.core.Neo4jTemplate$DefaultExecutableQuery.getSingleResult(Neo4jTemplate.java:987)
	at org.springframework.data.neo4j.repository.query.Neo4jQueryExecution$DefaultQueryExecution.execute(Neo4jQueryExecution.java:53)
	at org.springframework.data.neo4j.repository.query.AbstractNeo4jQuery.execute(AbstractNeo4jQuery.java:94)
	at org.springframework.data.repository.core.support.RepositoryMethodInvoker.doInvoke(RepositoryMethodInvoker.java:137)
	at org.springframework.data.repository.core.support.RepositoryMethodInvoker.invoke(RepositoryMethodInvoker.java:121)
	at org.springframework.data.repository.core.support.QueryExecutorMethodInterceptor.doInvoke(QueryExecutorMethodInterceptor.java:159)
	at org.springframework.data.repository.core.support.QueryExecutorMethodInterceptor.invoke(QueryExecutorMethodInterceptor.java:138)
	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186)
	at org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:123)
	at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:388)
	at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:119)
	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186)
	at org.springframework.dao.support.PersistenceExceptionTranslationInterceptor.invoke(PersistenceExceptionTranslationInterceptor.java:137)
	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186)
	at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:97)
	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186)
	at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:215)
	at com.sun.proxy.$Proxy90.findByCode(Unknown Source)
	at com.cloud.service.MyService.getCloud(MyService.java:89)
	at com.cloud.service.MyService$$FastClassBySpringCGLIB$$90eb4c1f.invoke(<generated>)
	at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:218)
	at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:783)
	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:163)
	at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.proceed(CglibAopProxy.java:753)
	at org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:123)
	at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:388)
	at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:119)
	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186)
	at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.proceed(CglibAopProxy.java:753)
	at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:698)
	at com.cloud.service.MyService$$EnhancerBySpringCGLIB$$37834d2c.getCloud(<generated>)
	at com.cloud.service.CollectService.collect(CollectService.java:95)
	at com.cloud.task.MyTask.handleMessage(MyTask.java:36)
	at com.cloud.task.MyTask.handleMessage(MyTask.java:12)
	at com.cloud.task.queue.TaskMessageHandler.handleMessage(TaskMessageHandler.java:157)
	at com.cloud.task.queue.TaskMessageHandler.lambda$initTaskConsumer$0(TaskMessageHandler.java:98)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
	at java.base/java.lang.Thread.run(Thread.java:829)
Caused by: java.lang.NullPointerException: null
	at org.springframework.data.neo4j.core.mapping.NodeDescriptionStore.lambda$new$0(NodeDescriptionStore.java:56)
	at org.springframework.data.neo4j.core.mapping.NodeDescriptionStore.deriveConcreteNodeDescription(NodeDescriptionStore.java:100)
	at org.springframework.data.neo4j.core.mapping.DefaultNeo4jEntityConverter.lambda$map$2(DefaultNeo4jEntityConverter.java:277)
	at org.springframework.data.neo4j.core.mapping.DefaultNeo4jEntityConverter.map(DefaultNeo4jEntityConverter.java:300)
	at org.springframework.data.neo4j.core.mapping.DefaultNeo4jEntityConverter.map(DefaultNeo4jEntityConverter.java:255)
	at org.springframework.data.neo4j.core.mapping.DefaultNeo4jEntityConverter.read(DefaultNeo4jEntityConverter.java:116)
	... 47 common frames omitted

@spring-projects-issues spring-projects-issues added status: feedback-provided Feedback has been provided and removed status: waiting-for-feedback We need additional information before we can continue status: feedback-reminder We've sent a reminder that we need additional information before we can continue labels Sep 5, 2022
@meistermeier
Copy link
Collaborator

meistermeier commented Sep 5, 2022

Thanks for the feedback. One more question: Does the error happen spontaneously during the lifetime of the application or between multiple runs?
Also I am wondering, if you are really using SDN 6.2.5 because the line

at org.springframework.data.neo4j.core.mapping.NodeDescriptionStore.lambda$new$0(NodeDescriptionStore.java:56)

is empty in https://github.com/spring-projects/spring-data-neo4j/blob/6.2.5/src/main/java/org/springframework/data/neo4j/core/mapping/NodeDescriptionStore.java#L56
I am focussing on this because there were a bug fix regarding entity detection in 6.2.5

@jeferson-cleancloud
Copy link
Author

jeferson-cleancloud commented Sep 12, 2022

Hi @meistermeier, sorry I am not receiving alerts on my e-mail about your responses :/

Yep, the error happens spontaneously during the lifetime of the application.

From my pom.xml here are the properties:

        <spring.data.neo4j.version>6.2.5</spring.data.neo4j.version>
        <spring.data.jpa.version>2.6.2</spring.data.jpa.version>

        <dependency>
            <groupId>org.springframework.data</groupId>
            <artifactId>spring-data-neo4j</artifactId>
            <version>${spring.data.neo4j.version}</version>
        </dependency>

        <dependency>
            <groupId>org.springframework.data</groupId>
            <artifactId>spring-data-jpa</artifactId>
            <version>${spring.data.jpa.version}</version>
        </dependency>

@jeferson-cleancloud
Copy link
Author

jeferson-cleancloud commented Sep 12, 2022

It worth noting that the problem is not related to the specific Node-Relationship, it is general and happens with any query :/ .

Also by analysing the code at https://github.com/spring-projects/spring-data-neo4j/blob/6.2.5/src/main/java/org/springframework/data/neo4j/core/mapping/NodeDescriptionStore.java#L57 I would guess it is probably related to a race condition

Here are the latest errors:

org.springframework.data.mapping.MappingException: Error mapping Record<{u: node<52>, c: relationship<40>, a: node<1>}>
	at org.springframework.data.neo4j.core.mapping.DefaultNeo4jEntityConverter.read(DefaultNeo4jEntityConverter.java:118)
	at org.springframework.data.neo4j.core.mapping.DefaultNeo4jEntityConverter.read(DefaultNeo4jEntityConverter.java:70)
	at org.springframework.data.neo4j.core.mapping.Schema.lambda$getRequiredMappingFunctionFor$0(Schema.java:96)
	at org.springframework.data.neo4j.core.PreparedQuery$AggregatingMappingFunction.apply(PreparedQuery.java:246)
	at org.springframework.data.neo4j.core.PreparedQuery$AggregatingMappingFunction.apply(PreparedQuery.java:158)
	at org.springframework.data.neo4j.core.DelegatingMappingFunctionWithNullCheck.apply(DelegatingMappingFunctionWithNullCheck.java:45)
	at org.springframework.data.neo4j.core.DelegatingMappingFunctionWithNullCheck.apply(DelegatingMappingFunctionWithNullCheck.java:35)
	at org.springframework.data.neo4j.core.DefaultNeo4jClient$DefaultRecordFetchSpec.one(DefaultNeo4jClient.java:455)
	at java.base/java.util.Optional.flatMap(Optional.java:294)
	at org.springframework.data.neo4j.core.Neo4jTemplate$DefaultExecutableQuery.getSingleResult(Neo4jTemplate.java:1019)
	at org.springframework.data.neo4j.repository.query.Neo4jQueryExecution$DefaultQueryExecution.execute(Neo4jQueryExecution.java:53)
	at org.springframework.data.neo4j.repository.query.AbstractNeo4jQuery.execute(AbstractNeo4jQuery.java:94)
	at org.springframework.data.repository.core.support.RepositoryMethodInvoker.doInvoke(RepositoryMethodInvoker.java:137)
	at org.springframework.data.repository.core.support.RepositoryMethodInvoker.invoke(RepositoryMethodInvoker.java:121)
	at org.springframework.data.repository.core.support.QueryExecutorMethodInterceptor.doInvoke(QueryExecutorMethodInterceptor.java:159)
	at org.springframework.data.repository.core.support.QueryExecutorMethodInterceptor.invoke(QueryExecutorMethodInterceptor.java:138)
	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186)
	at org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:123)
	at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:388)
	at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:119)
	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186)
	at org.springframework.dao.support.PersistenceExceptionTranslationInterceptor.invoke(PersistenceExceptionTranslationInterceptor.java:137)
	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186)
	at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:97)
	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186)
	at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:215)
	at com.sun.proxy.$Proxy86.findTopByActiveTrueAndUserAccount_AccountAdminTrueAndUserAccount_Account_Code(Unknown Source)
	at com.cloud.service.UserService.getAdminUser(UserService.java:144)
	at com.cloud.service.UserService$$FastClassBySpringCGLIB$$eec3f2b.invoke(<generated>)
	at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:218)
	at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:783)
	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:163)
	at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.proceed(CglibAopProxy.java:753)
	at org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:123)
	at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:388)
	at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:119)
	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186)
	at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.proceed(CglibAopProxy.java:753)
	at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:698)
	at com.cloud.service.UserService$$EnhancerBySpringCGLIB$$e18c46d2.getAdminUser(<generated>)
	at com.cloud.backbone.service.TicketsCheckService.checkTickets(TicketsCheckService.java:81)
	at com.cloud.backbone.service.TicketsCheckService.lambda$executeCloud$0(TicketsCheckService.java:58)
	at java.base/java.util.LinkedHashMap$LinkedValues.forEach(LinkedHashMap.java:608)
	at com.cloud.backbone.service.TicketsCheckService.executeCloud(TicketsCheckService.java:54)
	at com.cloud.backbone.service.TicketsCheckService.execute(TicketsCheckService.java:49)
	at com.cloud.backbone.service.CloudCheckService.lambda$checkServices$0(CloudCheckService.java:72)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
	at java.base/java.lang.Thread.run(Thread.java:829)
Caused by: java.lang.NullPointerException: null
	at org.springframework.data.neo4j.core.mapping.NodeDescriptionStore.lambda$new$0(NodeDescriptionStore.java:57)
	at org.springframework.data.neo4j.core.mapping.NodeDescriptionStore.deriveConcreteNodeDescription(NodeDescriptionStore.java:101)
	at org.springframework.data.neo4j.core.mapping.DefaultNeo4jEntityConverter.lambda$map$2(DefaultNeo4jEntityConverter.java:277)
	at org.springframework.data.neo4j.core.mapping.DefaultNeo4jEntityConverter.map(DefaultNeo4jEntityConverter.java:300)
	at org.springframework.data.neo4j.core.mapping.DefaultNeo4jEntityConverter.createInstanceOfRelationships(DefaultNeo4jEntityConverter.java:614)
	at org.springframework.data.neo4j.core.mapping.DefaultNeo4jEntityConverter.lambda$populateFrom$6(DefaultNeo4jEntityConverter.java:534)
	at org.springframework.data.mapping.model.BasicPersistentEntity.doWithAssociations(BasicPersistentEntity.java:387)
	at org.springframework.data.neo4j.core.mapping.DefaultNeo4jEntityConverter.populateProperties(DefaultNeo4jEntityConverter.java:350)
	at org.springframework.data.neo4j.core.mapping.DefaultNeo4jEntityConverter.lambda$map$2(DefaultNeo4jEntityConverter.java:287)
	at org.springframework.data.neo4j.core.mapping.DefaultNeo4jEntityConverter.map(DefaultNeo4jEntityConverter.java:300)
	at org.springframework.data.neo4j.core.mapping.DefaultNeo4jEntityConverter.map(DefaultNeo4jEntityConverter.java:255)
	at org.springframework.data.neo4j.core.mapping.DefaultNeo4jEntityConverter.read(DefaultNeo4jEntityConverter.java:116)
	... 48 common frames omitted

@jeferson-cleancloud
Copy link
Author

Hi @meistermeier any return on this

@meistermeier
Copy link
Collaborator

Sorry, that I did not response. Unfortunately I couldn't reproduce the problem. Since I have no idea how to get this failing on my machine, I created a branch that you can check out against your test suite. There will be a 6.3.4-GH-2585-SNAPSHOT available in the next hour that uses a concurrent hash map on for the caches.

@jeferson-cleancloud
Copy link
Author

Hi @meistermeier, tks for the snapshot ... as soon as it is available I will test against it

@jeferson-cleancloud
Copy link
Author

jeferson-cleancloud commented Sep 28, 2022

Hi @meistermeier I got to reproduce the error using this block of code:

@Service
public class Neo4JTestService {

    @Autowired
    private CloudService cloudService;

    private ExecutorService executorService;

    @PostConstruct
    public void init() {
        List<String> cloudCodes = Arrays.asList("code1", "code2");
        executorService = Executors.newCachedThreadPool();
        for (int i = 0; i < 100; i++) {
            cloudCodes.forEach(c -> executorService.execute(() -> {
                try {
                    cloudService.getCloud(c);
                } catch (Exception e) {
                    e.printStackTrace();
                }
            }));
        }
    }

    @PreDestroy
    public void destroy() {
        ExecutorServiceUtil.awaitTermination(executorService, "Awaiting ...");
    }
}

Sometimes it throws the error I had pasted before :)

	at com.cloud.ado.task.service.Neo4JTestService.lambda$init$0(Neo4JTestService.java:29)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
	at java.base/java.lang.Thread.run(Thread.java:834)
Caused by: java.lang.NullPointerException
	at org.springframework.data.neo4j.core.mapping.NodeDescriptionStore.lambda$new$0(NodeDescriptionStore.java:57)
	at org.springframework.data.neo4j.core.mapping.NodeDescriptionStore.deriveConcreteNodeDescription(NodeDescriptionStore.java:101)
	at org.springframework.data.neo4j.core.mapping.DefaultNeo4jEntityConverter.lambda$map$2(DefaultNeo4jEntityConverter.java:277)
	at org.springframework.data.neo4j.core.mapping.DefaultNeo4jEntityConverter.map(DefaultNeo4jEntityConverter.java:300)
	at org.springframework.data.neo4j.core.mapping.DefaultNeo4jEntityConverter.map(DefaultNeo4jEntityConverter.java:255)
	at org.springframework.data.neo4j.core.mapping.DefaultNeo4jEntityConverter.read(DefaultNeo4jEntityConverter.java:116)

Now I will try using the SNAPSHOT of yours

@jeferson-cleancloud
Copy link
Author

Hi @meistermeier is there any specific repository path for the 6.3.4-GH-2585-SNAPSHOT?

I had updated my pom and received:

Cannot resolve org.springframework.data:spring-data-neo4j:6.3.4-GH-2585-SNAPSHOT

@meistermeier
Copy link
Collaborator

This would be:

<repositories>
  <repository>
    <id>spring-milestones</id>
    <name>Spring Milestones</name>
    <url>https://repo.spring.io/milestone</url>
    <snapshots>
      <enabled>false</enabled>
    </snapshots>
  </repository>
  <repository>
    <id>spring-snapshots</id>
    <name>Spring Snapshots</name>
    <url>https://repo.spring.io/snapshot</url>
    <releases>
      <enabled>false</enabled>
    </releases>
  </repository>
</repositories>

Typically the snapshot repo is sufficient, but for completeness I added also the milestone repo.

Thanks for the reproducer. I will have a look right now.

@meistermeier
Copy link
Collaborator

Unfortunately, I cannot reproduce it with the snippet above :(
I think the reproducer is good, but I might have interpreted your class hierarchy wrong. Could you provide your (anonymised) domain? There are some missing bits in the description of the domain that I maybe replaced wrong.
Still in the guessing mode but pretty sure that the mixture of concurrency and a special domain model "ingredient" might uncover this.

@meistermeier meistermeier added status: waiting-for-feedback We need additional information before we can continue and removed status: feedback-provided Feedback has been provided labels Sep 29, 2022
@jeferson-cleancloud
Copy link
Author

Hi @meistermeier, sure. Do you mean anonymised data or the missing classes?

By the way over my tests, 1 out of 30 executions throw the error :/

@spring-projects-issues spring-projects-issues added status: feedback-provided Feedback has been provided and removed status: waiting-for-feedback We need additional information before we can continue labels Sep 30, 2022
@jeferson-cleancloud
Copy link
Author

Hi @meistermeier, I just tested with the SNAPSHOT version but now I am getting a different error:

Exception in thread "pool-2-thread-198" java.lang.NoSuchMethodError: org.springframework.data.neo4j.core.mapping.Neo4jPersistentEntity.getInstanceCreatorMetadata()Lorg/springframework/data/mapping/InstanceCreatorMetadata;
	at org.springframework.data.neo4j.core.mapping.DefaultNeo4jEntityConverter.populateProperties(DefaultNeo4jEntityConverter.java:347)
	at org.springframework.data.neo4j.core.mapping.DefaultNeo4jEntityConverter.lambda$map$2(DefaultNeo4jEntityConverter.java:298)
	at org.springframework.data.neo4j.core.mapping.DefaultNeo4jEntityConverter.map(DefaultNeo4jEntityConverter.java:312)
	at org.springframework.data.neo4j.core.mapping.DefaultNeo4jEntityConverter.map(DefaultNeo4jEntityConverter.java:266)
	at org.springframework.data.neo4j.core.mapping.DefaultNeo4jEntityConverter.read(DefaultNeo4jEntityConverter.java:118)
	at org.springframework.data.neo4j.core.mapping.DefaultNeo4jEntityConverter.read(DefaultNeo4jEntityConverter.java:71)
	at org.springframework.data.neo4j.core.mapping.Schema.lambda$getRequiredMappingFunctionFor$0(Schema.java:96)
	at org.springframework.data.neo4j.core.PreparedQuery$AggregatingMappingFunction.apply(PreparedQuery.java:246)
	at org.springframework.data.neo4j.core.PreparedQuery$AggregatingMappingFunction.apply(PreparedQuery.java:158)
	at org.springframework.data.neo4j.core.DefaultNeo4jClient$DefaultRecordFetchSpec.one(DefaultNeo4jClient.java:456)
	at java.base/java.util.Optional.flatMap(Optional.java:294)
	at org.springframework.data.neo4j.core.Neo4jTemplate$DefaultExecutableQuery.getSingleResult(Neo4jTemplate.java:1114)
	at org.springframework.data.neo4j.repository.query.Neo4jQueryExecution$DefaultQueryExecution.execute(Neo4jQueryExecution.java:53)
	at org.springframework.data.neo4j.repository.query.AbstractNeo4jQuery.execute(AbstractNeo4jQuery.java:94)
	at org.springframework.data.repository.core.support.RepositoryMethodInvoker.doInvoke(RepositoryMethodInvoker.java:137)
	at org.springframework.data.repository.core.support.RepositoryMethodInvoker.invoke(RepositoryMethodInvoker.java:121)
	at org.springframework.data.repository.core.support.QueryExecutorMethodInterceptor.doInvoke(QueryExecutorMethodInterceptor.java:159)
	at org.springframework.data.repository.core.support.QueryExecutorMethodInterceptor.invoke(QueryExecutorMethodInterceptor.java:138)
	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186)
	at org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:123)
	at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:388)
	at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:119)
	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186)
	at org.springframework.dao.support.PersistenceExceptionTranslationInterceptor.invoke(PersistenceExceptionTranslationInterceptor.java:137)
	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186)
	at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:97)
	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186)
	at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:215)
	at com.sun.proxy.$Proxy73.findByCode(Unknown Source)
	at com.cloud.service.CloudService.getCloud(CloudService.java:89)
	at com.cloud.service.CloudService$$FastClassBySpringCGLIB$$90eb4c1f.invoke(<generated>)
	at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:218)
	at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:783)
	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:163)
	at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.proceed(CglibAopProxy.java:753)
	at org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:123)
	at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:388)
	at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:119)
	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186)
	at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.proceed(CglibAopProxy.java:753)
	at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:698)
	at com.cloud.service.CloudService$$EnhancerBySpringCGLIB$$af7a31f3.getCloud(<generated>)
	at com.cloud.ado.task.service.Neo4JTestService.lambda$init$0(Neo4JTestService.java:29)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
	at java.base/java.lang.Thread.run(Thread.java:834)

Should I update any other library version such as JPA? Currently I am using the spring-data-jpa version 2.6.2

@meistermeier
Copy link
Collaborator

Looks like the Spring Data commons dependency from the snapshot (2.7.4-SNAPSHOT) does not get picked up and your project sticks with 2.7.2 defined as a transitive dependency of JPA. Did you maybe define this explicitly somewhere in your project definition (pom.xml / build.gradle)?

@jeferson-cleancloud
Copy link
Author

jeferson-cleancloud commented Oct 12, 2022

Hi @meistermeier, sorry for the long delay on my response... I was traveling and I was away from the computer ;)

So, I got to test with the following versions and the error was not thrown anymore ;)

        <spring.data.commons.version>2.7.4-SNAPSHOT</spring.data.commons.version>
        <spring.data.neo4j.version>6.3.4-GH-2585-SNAPSHOT</spring.data.neo4j.version>
        <spring.data.jpa.version>2.7.2</spring.data.jpa.version>

So I guess the changes you have made took a positive effect ;)

When those changes could be onboarded on the latest release?

@meistermeier
Copy link
Collaborator

When those changes could be onboarded on the latest release?

Sorry I missed this yesterday. If everything works out as expected, the release should go out today.

@jeferson-cleancloud
Copy link
Author

@meistermeier
Copy link
Collaborator

Yes, this is the release. There was a problem in the release pipeline that's why 6.3.5 is now current and 6.3.4 was more or less skipped.

@jeferson-cleancloud
Copy link
Author

Tks much :)

@michael-simons michael-simons mentioned this issue Jan 4, 2023
4 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: feedback-provided Feedback has been provided
Projects
None yet
Development

No branches or pull requests

3 participants