[Hibernate-JIRA] Created: (HHH-2481) Big memory leak in the use of CGLIB
by Paul Malolepsy (JIRA)
Big memory leak in the use of CGLIB
-----------------------------------
Key: HHH-2481
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-2481
Project: Hibernate3
Type: Bug
Components: core
Versions: 3.2.2
Environment: Hibernate 3.2.2
MySQL 5.1
Reporter: Paul Malolepsy
Priority: Critical
The way CGLIBLazyInitializer is creating proxies is resulting in a potentially massive memory leak.
In CGLIBLazyInitializer.getProxy() just before the proxy is instantiated, a call is made to Enhancer.registerCallbacks() passing in the instance of CGLIBLazyInitializer that will manage the proxy. This variable is stored in a static ThreadLocal on the CGLIB created persistentClass so that any subsequent objects instantiated will get this callback class.
The problem is that once this ThreadLocal is set, it is never cleared, so it will stay around (together with the object it's managing, and whatever object graph it may be connected to) until the next time a proxy is created for that type on that thread.
For our application we have about 150 different proxy types, and our app can have over 100 threads. This results in potentially 15,000 proxy objects and their graphs stuck in memory.
The fix for this is simple. Just make another call the Enhancer.registerCallbacks() with a null callback arg, right after the proxy class is instantiated:
Enhancer.registerCallbacks(factory, null);
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://opensource.atlassian.com/projects/hibernate/secure/Administrators....
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira
17 years, 7 months
[Hibernate-JIRA] Created: (ANN-574) CascadeType ALL is not equals to REMOVE+REFRESH+PERSIST+MERGE
by Pascal Alberty (JIRA)
CascadeType ALL is not equals to REMOVE+REFRESH+PERSIST+MERGE
-------------------------------------------------------------
Key: ANN-574
URL: http://opensource.atlassian.com/projects/hibernate/browse/ANN-574
Project: Hibernate Annotations
Type: Bug
Versions: 3.2.1
Reporter: Pascal Alberty
Entity1
With a list of entity2
@OneToMany
Entity2
With a field on entity1
@ManyToOne
@JoinColumn(nullable=false)
Entity2 created with a mock by using Spring injection. 2 beans configured. One Entity2, one Entity1. Entity2 linked to Entity1
JUnit test trying to persist a entity2.
The test fails if no CascadeType is configured (see below)
The test runs if CascadeType is configured to ALL
The test fails if CascadeType is configured to REMOVE+REFRESH+PERSIST+MERGE !!!!!
So REMOVE+REFRESH+PERSIST+MERGE != ALL as noted in http://www.hibernate.org/hib_docs/annotations/reference/en/html_single/#d...
org.springframework.dao.DataIntegrityViolationException: not-null property references a null or transient value: com.xxx.xxx.dto.campaign.TechnicalComponent.campaign; nested exception is org.hibernate.PropertyValueException: not-null property references a null or transient value: com.xxx.xxx.dto.campaign.TechnicalComponent.campaign
Caused by: org.hibernate.PropertyValueException: not-null property references a null or transient value: com.xxx.xxx.dto.campaign.TechnicalComponent.campaign
at org.hibernate.engine.Nullability.checkNullability(Nullability.java:72)
at org.hibernate.event.def.AbstractSaveEventListener.performSaveOrReplicate(AbstractSaveEventListener.java:284)
at org.hibernate.event.def.AbstractSaveEventListener.performSave(AbstractSaveEventListener.java:180)
at org.hibernate.event.def.AbstractSaveEventListener.saveWithGeneratedId(AbstractSaveEventListener.java:108)
at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.saveWithGeneratedOrRequestedId(DefaultSaveOrUpdateEventListener.java:186)
at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.entityIsTransient(DefaultSaveOrUpdateEventListener.java:175)
at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.performSaveOrUpdate(DefaultSaveOrUpdateEventListener.java:98)
at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.onSaveOrUpdate(DefaultSaveOrUpdateEventListener.java:70)
at org.hibernate.impl.SessionImpl.fireSaveOrUpdate(SessionImpl.java:507)
at org.hibernate.impl.SessionImpl.saveOrUpdate(SessionImpl.java:499)
at org.hibernate.impl.SessionImpl.saveOrUpdate(SessionImpl.java:495)
at org.springframework.orm.hibernate3.HibernateTemplate$16.doInHibernate(HibernateTemplate.java:679)
at org.springframework.orm.hibernate3.HibernateTemplate.execute(HibernateTemplate.java:362)
at org.springframework.orm.hibernate3.HibernateTemplate.saveOrUpdate(HibernateTemplate.java:676)
at com.beweb.adbox.dao.impl.BaseDaoHibernate.saveObject(BaseDaoHibernate.java:24)
at com.xxx.xxx.dao.campaign.impl.ComponentDaoHibernate.saveComponent(ComponentDaoHibernate.java:53)
at com.xxx.xxx.dao.campaign.ComponentDaoTest.testSaveComponent(ComponentDaoTest.java:24)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at junit.framework.TestCase.runTest(TestCase.java:154)
at junit.framework.TestCase.runBare(TestCase.java:127)
at org.springframework.test.ConditionalTestCase.runBare(ConditionalTestCase.java:69)
at junit.framework.TestResult$1.protect(TestResult.java:106)
at junit.framework.TestResult.runProtected(TestResult.java:124)
at junit.framework.TestResult.run(TestResult.java:109)
at junit.framework.TestCase.run(TestCase.java:118)
at junit.framework.TestSuite.runTest(TestSuite.java:208)
at junit.framework.TestSuite.run(TestSuite.java:203)
at org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(JUnit3TestReference.java:128)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://opensource.atlassian.com/projects/hibernate/secure/Administrators....
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira
17 years, 8 months
[Hibernate-JIRA] Created: (HBX-919) Roundtripping between @NamedQueries in Java editor and statements in HQL editor
by Joseph Marques (JIRA)
Roundtripping between @NamedQueries in Java editor and statements in HQL editor
-------------------------------------------------------------------------------
Key: HBX-919
URL: http://opensource.atlassian.com/projects/hibernate/browse/HBX-919
Project: Hibernate Tools
Type: New Feature
Versions: 3.2beta10
Reporter: Joseph Marques
I find myself often wanting to tweak queries either because of feature requests, redesigns at the calling layers, or bugs that were found in the system. In all of these circumstances, I have to copy the existing query portion of some @NamedQuery definition into the HQL editor, remove the string quotes and plus signs, tweak the query, then copy it back into the annotation, and add the string quotes and the plus signs again. It would be nice if there were tools to aide in this sequence.
Java Editor --> HQL Editor:
It would be nice to be able to highlight the query part of the @NamedQuery in the java editor, right-click it, and select an option such as "Show in HQL Editor".
This may not seem like such a big deal when the entire query is expressed on a single line, but that case is rare for me. Nearly all of my queries span at least 3 lines, many of them 10 or more lines. There's even one query at the moment spanning 16 lines. The span looks like:
@NamedQuery(name = "queryName",
query = "first fragment" +
"continued fragment" +
"continued fragment" +
...
"last fragment")
So, I'd like to be able to highlight everything including and between "first fragment" and "last fragment" and push it to an HQL Editor. During the push, I'd want the quotes and the plus signs to be removed so that the editor only showed:
first fragment
continued fragment
continued fragment
last fragment
HQL Edtior --> Java Editor:
Then, as part of the roundtripping, I should be able to highlight a query in the HQL editor and punt that back as the 'query' part of my @NamedQuery.
I'm thinking this second part might be implemented through a copy / paste operation in one of two ways:
1) regular copy / special paste
Here, we piggyback on the existing copy operation. All the functionality for the reverse part of the trip would come from a special paste operation that adds the string quotes and plus signs as the data is pulled from the clipboard.
2) special copy / regular paste
Here, all the functionality for the reverse part of the trip would come from a special copy operation that adds the string quotes and plus signs to the clipboard data. Then, this pre-formatted string can be pasted anywhere with the standard paste operation.
---
A third, somewhat similar solution would be to bypass the copy / paste stuff altogether. Instead, a user would copy / paste query fragments between the editors just as they do today. Then, he or she would highlight the pasted contents in the target editor, right-click, and select either "Hibernate Tools > Java2HQL" or "Hibernate Tools > HQL2Java".
Thoughts?
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://opensource.atlassian.com/projects/hibernate/secure/Administrators....
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira
17 years, 8 months
[Hibernate-JIRA] Created: (HBX-918) Trouble configuring Hibernate Console Configuration
by Joseph Marques (JIRA)
Trouble configuring Hibernate Console Configuration
---------------------------------------------------
Key: HBX-918
URL: http://opensource.atlassian.com/projects/hibernate/browse/HBX-918
Project: Hibernate Tools
Type: Bug
Versions: 3.2beta10
Environment: HibernateTools-nodeps-3.2.0.200703151752-nightly
Reporter: Joseph Marques
After I create the Hibernate Console Configuration, right-click it, and select "Create Session Factory" I get:
java.lang.NullPointerException
at org.hibernate.console.ConsoleConfiguration$2.execute(ConsoleConfiguration.java:192)
at org.hibernate.console.execution.DefaultExecutionContext.execute(DefaultExecutionContext.java:65)
at org.hibernate.console.ConsoleConfiguration.buildWith(ConsoleConfiguration.java:185)
at org.hibernate.console.ConsoleConfiguration.build(ConsoleConfiguration.java:106)
at org.hibernate.eclipse.console.actions.BuildSessionFactoryAction.doRun(BuildSessionFactoryAction.java:54)
at org.hibernate.eclipse.console.actions.ConsoleConfigurationBasedAction.run(ConsoleConfigurationBasedAction.java:63)
After reading the source, it seems that line 192 expects the "Property file" element on the "Main" tab of the configuration to be present. However, this does not seem to be a required field in the UI, and ideally shouldn't be required. A dummy properties object could be used if none is specified, so the rest of the block executes normally.
Nevertheless, to appease the code I created a dummy properties file with nothing in it, and reconfigured the HCC. Then, I tried to reopen / recreate the session factory, but this time I got another exception:
java.lang.NullPointerException
at org.hibernate.console.ConsoleConfiguration$2.execute(ConsoleConfiguration.java:193)
at org.hibernate.console.execution.DefaultExecutionContext.execute(DefaultExecutionContext.java:65)
at org.hibernate.console.ConsoleConfiguration.buildWith(ConsoleConfiguration.java:185)
at org.hibernate.console.ConsoleConfiguration.build(ConsoleConfiguration.java:106)
at org.hibernate.eclipse.console.actions.BuildSessionFactoryAction.doRun(BuildSessionFactoryAction.java:54)
at org.hibernate.eclipse.console.actions.ConsoleConfigurationBasedAction.run(ConsoleConfigurationBasedAction.java:63)
Lines 192-195 seems to imply that a dummy hibernate.transaction.manager_lookup_class will be provided if not specified in the file, but the code checks for existence with trim().length(). The javadoc for Properties reads that it will return null if the item is not found, not a zero-length string. The length() check is fine and quite reasonable, but it needs to be done after a null check.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://opensource.atlassian.com/projects/hibernate/secure/Administrators....
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira
17 years, 8 months
[Hibernate-JIRA] Created: (HHH-2493) session is closed
by nir (JIRA)
session is closed
-----------------
Key: HHH-2493
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-2493
Project: Hibernate3
Type: Bug
Environment: Hibernate 3.0 on DB2 using jcc driver
Reporter: nir
org.hibernate.SessionException: Session is closed!
at org.hibernate.impl.AbstractSessionImpl.errorIfClosed(AbstractSessionImpl.java:50)
at org.hibernate.impl.SessionImpl.getPersistenceContext(SessionImpl.java:1794)
at org.hibernate.proxy.BasicLazyInitializer.getReplacement(BasicLazyInitializer.java:100)
at org.hibernate.proxy.BasicLazyInitializer.invoke(BasicLazyInitializer.java:54)
at org.hibernate.proxy.CGLIBLazyInitializer.intercept(CGLIBLazyInitializer.java:156)
at com.dteco.gts.domain.hibernate.GtsAccount$$EnhancerByCGLIB$$5b8a2ff3.writeReplace(<generated>)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at java.io.ObjectStreamClass.invokeWriteReplace(ObjectStreamClass.java:977)
at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1030)
at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1369)
at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1341)
at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1284)
at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1073)
at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:291)
at java.util.ArrayList.writeObject(ArrayList.java:570)
at sun.reflect.GeneratedMethodAccessor11.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at java.io.ObjectStreamClass.invokeWriteObject(ObjectStreamClass.java:890)
at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1333)
at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1284)
at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1073)
at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:291)
at weblogic.rmi.extensions.server.CBVOutputStream.writeObject(CBVOutputStream.java:84)
at weblogic.rmi.internal.ServerRequest.unmarshalReturn(ServerRequest.java:97)
at weblogic.rmi.cluster.ClusterableRemoteRef.invoke(ClusterableRemoteRef.java:315)
at weblogic.rmi.cluster.ClusterableRemoteRef.invoke(ClusterableRemoteRef.java:250)
at com.dteco.gts.process.statements.StatementsEJB_4exsct_EOImpl_910_WLStub.getStatementDetails(Unknown Source)
at com.dteco.gts.statements.StatementsBD.getStatementDetails(StatementsBD.java:60)
at com.dteco.gts.adjustment.AdjustmentSearchBean.getStatementDetails(AdjustmentSearchBean.java:311)
at com.dteco.gts.adjustment.AdjustmentSearchBean.createAdjustment(AdjustmentSearchBean.java:88)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.apache.myfaces.el.MethodBindingImpl.invoke(MethodBindingImpl.java:129)
at org.apache.myfaces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:63)
at javax.faces.component.UICommand.broadcast(UICommand.java:106)
at javax.faces.component.UIViewRoot._broadcastForPhase(UIViewRoot.java:90)
at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:164)
at org.apache.myfaces.lifecycle.LifecycleImpl.invokeApplication(LifecycleImpl.java:316)
at org.apache.myfaces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:86)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:106)
at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:225)
at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:127)
at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:272)
at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:26)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:42)
at org.apache.myfaces.component.html.util.ExtensionsFilter.doFilter(ExtensionsFilter.java:122)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:42)
at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3151)
at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:121)
at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:1973)
at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:1880)
at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1310)
at weblogic.work.ExecuteThread.execute(ExecuteThread.java:207)
at weblogic.work.ExecuteThread.run(ExecuteThread.java:179)
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://opensource.atlassian.com/projects/hibernate/secure/Administrators....
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira
17 years, 8 months