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

Finalizer hit db on lazy dbrefs [DATAMONGO-1076] #1996

Closed
spring-projects-issues opened this issue Oct 27, 2014 · 2 comments
Closed

Finalizer hit db on lazy dbrefs [DATAMONGO-1076] #1996

spring-projects-issues opened this issue Oct 27, 2014 · 2 comments
Assignees
Labels
in: core Issues in core support type: bug A general bug

Comments

@spring-projects-issues
Copy link

@spring-projects-issues spring-projects-issues commented Oct 27, 2014

Pablo Díaz-López opened DATAMONGO-1076 and commented

If we load a Document class that has a lazy annotated DBRef, and we do not navigate through it, the data is not requested to MongoDB as expected, but if we force a GC it seems that the proxy that envelops the attribute with DBRef generates a request to MongoDB.

You can see this issue in logs if trace logs are enabled:

Example to a DBRef to MY_DB.PEOPLE with id=18

2014-10-27 12:24:02.644  INFO 4384 --- [      Finalizer] com.mongodb.TRACE                        : find: MY_DB.PEOPLE { "_id" : 18}

And this is the trace I get debugging:

at com.testapp.model.People$$EnhancerByCGLIB$$c7ff2ba0.finalize(<generated>)
at java.lang.System$2.invokeFinalize(System.java:1267)
at java.lang.ref.Finalizer.runFinalizer(Finalizer.java:98)
at java.lang.ref.Finalizer.access$100(Finalizer.java:34)
at java.lang.ref.Finalizer$FinalizerThread.run(Finalizer.java:210)

The problem seems to be at DefaultDbRefResolver creating the LazyLoadingInterceptor inner class


Affects: 1.6 GA (Evans)

Referenced from: pull request #234

Backported to: 1.6.1 (Evans SR1)

@spring-projects-issues
Copy link
Author

@spring-projects-issues spring-projects-issues commented Oct 27, 2014

Thomas Darimont commented

We now don't try to resolve the proxy during finalization.
Please revise

@spring-projects-issues
Copy link
Author

@spring-projects-issues spring-projects-issues commented Oct 27, 2014

Pablo Díaz-López commented

It works. I don't see any Finalizer Thread logs trying to resolve lazy DBRefs, and lazy DBRef still works when requested.

It will be resolved for 1.6.x too?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: core Issues in core support type: bug A general bug
Projects
None yet
Development

No branches or pull requests

2 participants