Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EclipseLink » Schema per Tenant issues
Schema per Tenant issues [message #1062321] Fri, 07 June 2013 08:00 Go to next message
Thomas Kratz is currently offline Thomas KratzFriend
Messages: 165
Registered: July 2009
Senior Member
Hi all, I have been playing around with schema per tenant, with little success.

First I couldn't make Inheritance structures with a underlying MappedSuperclass followed by "real" inheritance in the tree. I have seen that ClassDescriptor do not get initialized correctly leading to all over strange errors.

Then for heavens sake, I removed those structures and found that the vm crashes after a while with outofmemory, the heap dump telling me that 100's of Megs of RelationalDescriptors couldn't be collected.

Has anyone seen issues like this?
Re: Schema per Tenant issues [message #1062976 is a reply to message #1062321] Tue, 11 June 2013 15:01 Go to previous messageGo to next message
James Sutherland is currently offline James SutherlandFriend
Messages: 1939
Registered: July 2009
Location: Ottawa, Canada
Senior Member

How have you been using schema per tenant, do you declare the tenant in your persistence.xml, or pass it when you create an EntityManagerFactory or an EntityManager?

Is your application holding onto the old EntityManagers, or EntityManagerFactories? Are you using a server or framework (WLS, Glassfish, Spring, OSGi, etc.)?

If you can isolate a specific test that recreates the inheritance issue, please log a bug.


James : Wiki : Book : Blog : Twitter
Re: Schema per Tenant issues [message #1063166 is a reply to message #1062321] Wed, 12 June 2013 14:09 Go to previous messageGo to next message
Thomas Kratz is currently offline Thomas KratzFriend
Messages: 165
Registered: July 2009
Senior Member


I pass the tenant_id on EM creation in a slightly modified spring transaction manager inside gemini blueprint/osgi.
Spring should be closing the ems after the transcaction.

Could it be that those problems are related to the bundle weaver from angelo zerr that I'm using?

What about including the tenant-id in the keys for the shared cache? Would make life great.

[Updated on: Thu, 13 June 2013 04:45]

Report message to a moderator

Re: Schema per Tenant issues [message #1063912 is a reply to message #1063166] Sat, 15 June 2013 06:36 Go to previous messageGo to next message
Thomas Kratz is currently offline Thomas KratzFriend
Messages: 165
Registered: July 2009
Senior Member
Hey James et al.

I was able to reproduce all of my issues in a simple setup using spring (so I could strip out the blueprint complexity)

I created some testcases
https://github.com/eiswind/eclipselink-schema-per-tenant

And filed a ticket for each of the problems.

Hope this helps.
Re: Schema per Tenant issues [message #1064286 is a reply to message #1063912] Tue, 18 June 2013 14:41 Go to previous messageGo to next message
James Sutherland is currently offline James SutherlandFriend
Messages: 1939
Registered: July 2009
Location: Ottawa, Canada
Senior Member

Can you recreate the issue without Spring? It may be related to your Spring usage.

James : Wiki : Book : Blog : Twitter
Re: Schema per Tenant issues [message #1064290 is a reply to message #1064286] Tue, 18 June 2013 14:48 Go to previous messageGo to next message
Thomas Kratz is currently offline Thomas KratzFriend
Messages: 165
Registered: July 2009
Senior Member
Hey James,

The testcases I provided use spring only for the EMF and datasource creation.
I don't think this should be cross related as those issues dont appear when I use the discriminator approach. I already spent a day on reproducing with testcases, so I hope at least now someone will take a look at it.
Re: Schema per Tenant issues [message #1064312 is a reply to message #1064286] Tue, 18 June 2013 15:42 Go to previous messageGo to next message
Thomas Kratz is currently offline Thomas KratzFriend
Messages: 165
Registered: July 2009
Senior Member
Just to make sure I'm not going wrong I did remove the spring dependencies from the Testcases. Source is at github, issues still valid.
Re: Schema per Tenant issues [message #1211232 is a reply to message #1064312] Tue, 26 November 2013 10:27 Go to previous messageGo to next message
dirvan vargas is currently offline dirvan vargasFriend
Messages: 6
Registered: November 2013
Junior Member
I got some success on this issue by clearing the values ​​of "session.descriptors", "ClassDescriptor.referencingClasses" and "ClassDescriptor.mappingsPostCalculateChanges" on the release of "ClienteSession", does this can cause me future problems? Any predictions correction, because the problem actually exists and is very serious.
Re: Schema per Tenant issues [message #1450698 is a reply to message #1211232] Wed, 22 October 2014 20:19 Go to previous messageGo to next message
dirvan vargas is currently offline dirvan vargasFriend
Messages: 6
Registered: November 2013
Junior Member
I finally identified the cause, but for my lack of experience in the project i could not identify the reason.

In the constructor of the class org.eclipse.persistence.sessions.server.ClientSession them exists um process.
if the tenant is enabled is mada a clone to descriptor.

if ( parent.hasTablePerTenantDescriptors ()) {
... line 129 in trunk source
for (ClassDescriptor descriptor : parent.getTablePerTenantDescriptors()){
ClassDescriptor clonedDescriptor = (ClassDescriptor) descriptor.clone();

This operation generates a memory leak in the framework.

replacing the line
ClassDescriptor clonedDescriptor = ( ClassDescriptor ) descriptor.clone();
by
ClassDescriptor clonedDescriptor = descriptor;

I have gotten in using eclipselink framework with success.

Could someone help me a understand what is being done to correcting this issue.
Re: Schema per Tenant issues [message #1453786 is a reply to message #1450698] Mon, 27 October 2014 13:32 Go to previous messageGo to next message
Chris Delahunt is currently offline Chris DelahuntFriend
Messages: 1389
Registered: July 2009
Senior Member
A leak implies that the memory is never released, yet these cloned descriptors should only be held by the client session that uses them. When it is no longer used, it and all its resources should be released. Can you identify what is preventing garbage collection in your application?
Re: Schema per Tenant issues [message #1453844 is a reply to message #1453786] Mon, 27 October 2014 15:35 Go to previous messageGo to next message
dirvan vargas is currently offline dirvan vargasFriend
Messages: 6
Registered: November 2013
Junior Member
In the constructor of the class org.eclipse.persistence.sessions.server.ClientSession exists a process if the tenant is enabled is generated a clone to descriptor.

if ( parent.hasTablePerTenantDescriptors ()) {
... line 129 in trunk source
for (ClassDescriptor descriptor : parent.getTablePerTenantDescriptors()){
ClassDescriptor clonedDescriptor = (ClassDescriptor) descriptor.clone();

A problem is generated because in clone method the serializable list referencingClasses, mappingsPostCalculateChanges, mappingsPostCalculateChangesOnDeleted are not cloned referencing the initial classdescriptor and in internal process many values are added in referencingClasses and mappingsPostCalculateChanges.

In another case if a not tenant class is referenced in tenant class the ClassDescriptor on method initialize in "referencedDescriptor.referencingClasses.add(this);" many references are added on each transaction.

In example the two cases are reproduced
Re: Schema per Tenant issues [message #1453935 is a reply to message #1453786] Mon, 27 October 2014 18:34 Go to previous message
dirvan vargas is currently offline dirvan vargasFriend
Messages: 6
Registered: November 2013
Junior Member
More information, many objects are cloned including mappings related fields as images attached. In OneToOneMapping the Map insertableField
many objects are added in map mantening one instance per tenant.
But after some time using the system the HashSet insertableField in OneToOneMapping presents its size zero and the internal table
contains a value look image two, and when the system will run insertableFields.contains method the field is not localized and thus is not added
the query causing the following error :

Internal Exception: org.postgresql.util.PSQLException: ERROR: null value
in column "id_usuario" violates not-null constraint
Detalhe: Failing row contains (null, 0, 1).

INSERT INTO "99200056".cfgusuario (st_avisosonorochat,
st_disponibilidadechat) VALUES (?, ?)
bind => [1, 0]
Previous Topic:Database Persistence both via JPA and Stored Procedure Calls
Next Topic:Problem with ReadAllQuery and hierarchical data
Goto Forum:
  


Current Time: Fri Apr 26 14:41:22 GMT 2024

Powered by FUDForum. Page generated in 0.05246 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top