RE: [JBoss-user] INSERTING AN ALREADY EXISTING BEAN..... problem
Bill, I tried increasing the to 6000 (10 minutes) so that the cache wouldn't resize during the load and that seems to have sidestepped the problem. I was able to load a total of 9919 records with no "INSERTING AN ALREADY EXISTING BEAN" errors. I think it's safe to say that there is something fishy going on when the LRU cache resizes during heavy consecutive ejbCreates for BMPs. This should at least narrow the problem down a bit and I should be able to produce a platform-independent test for you soon. I've been side-tracked by this issue for a few days and I have to make up the lost development time first. > What I'm trying to do here is isolate the problem. When you run into this > problem, is there only one client hitting JBoss? If this is true, then the > > only thing that I can think of is that the passivation thread is trying > to > > pacify objects in the cache at the same time you are creating things > because > > you have gone over the max. > Yes, I only have one client running. It might not be the passivation thread which is causing the problems though. The server log showed passivation occurring during the loading process. I think it's the cache resizing. > Are you sure that you are solely doing creates? No removes, etc? No removes but I am performing ejbFinds in between creates. > Sorry, docs say that setting to 0 disables resizer-period. I thought it > would help This seems like a bug or the documentation may be outdated. I'll post the question in a separate thread and see what's up with it. > I've got Win2k/Linux and Oracle. If you could duplicate the problem with > InstantDB that would be helpful as well. I need some code to work with. I'll try that. If my theory is correct, I should be able to produce a test case that can use InstantDB. > What are you using for a PK class? If it is a custom class(not Integer, > Long, etc...) could you post it? Or is it too complicated? I'm an old-school database developer, I like my primary keys surrogate (serial numbers) and my tables normalized. My PK class is java.lang.Integer. > The rollback happened because of "INSERTING AN ALREADY EXISTING BEAN..." > correct? Not something else. As far as I can tell, yes. Executing the rolled-back database transaction against the database (cut and paste) worked okay. > No, don't explicity handle the transaction. Everything should work! This > exception should not be happening and it is very very bad. I agree, this is definitely a big problem. Good thing you were able to point me in the right direction. I already had my BEA quotes in my hand a few minutes ago! $10,000 per processor?!?!?! Geez. > Happy to help. This stuff is fundamental and should really be fullproof. > There were a lot of holes patched up in 2.4 Beta in regards to passivation > and Entity and cache synchronization. In the mainline(2.5), a lot of it was > even re-written. If you feel up to it, could you try this on 2.4 Beta or > 2.5? I tried 2.4 Beta last week and the problem was still there. I'll check out 2.5 though maybe it's already fixed. > We're actually in production with a self-modified JBoss 2.2.2. The > modifications we made were the holes I just talked about above with > passivation and Entity/cache synchronizations. I've actually seen the > "INSERTING AN ALREADY EXISTING BEAN..." exception when doing a lot of Entity > removes and creates with Commit option "C". These problems were fixed by > the patches in 2.4. Let me know. I really want this to be fixed. I'll try to make a test case for InstantDB before the week is out. Thanks for your help, Bill. At least we have an idea where the problem is and how to work around it! ___ JBoss-user mailing list [EMAIL PROTECTED] http://lists.sourceforge.net/lists/listinfo/jboss-user
RE: [JBoss-user] INSERTING AN ALREADY EXISTING BEAN..... problem
> -Original Message- > From: Maraya Michael [mailto:[EMAIL PROTECTED]] > Sent: Wednesday, July 11, 2001 12:10 PM > To: [EMAIL PROTECTED]; 'Bill Burke' > Subject: RE: [JBoss-user] INSERTING AN ALREADY EXISTING BEAN. > problem > > > > Thanks for the suggestions, Bill. Here's what happened: > > 1) check . This value is set to 1000, which is well > above 106. Looking at the server log, though, I see that JBoss starts out > with 1000 then brings it down to 50 (the value in ) after a > few minutes. I'm going to try setting higher after sending > this message. > What I'm trying to do here is isolate the problem. When you run into this problem, is there only one client hitting JBoss? If this is true, then the only thing that I can think of is that the passivation thread is trying to pacify objects in the cache at the same time you are creating things because you have gone over the max. Are you sure that you are solely doing creates? No removes, etc? > 2) set to 0. I found standardjboss.xml and located > the Standard BMP EntityBean configuration (commit option was A). Sorry, docs say that setting to 0 disables resizer-period. I thought it would help [snip] > > 3) create a reproducible test case. If you have SQL Server 6.5 and > an ODBC driver for Clipper files (*.DBF), I can put up the files > for you to > test but if not, I'll have to customize the data access objects for your > platform. > I've got Win2k/Linux and Oracle. If you could duplicate the problem with InstantDB that would be helpful as well. I need some code to work with. > 4) check if i'm creating a bean with a previously used primary key. > SQL Server creates the primary key for me (it's an IDENTITY column) and I I really know jack squat about SQL Server. Oracle's my game. > wrap this integer in an Integer class and use that (via "SELECT @@IDENTITY > on the current Connection object) for my EJB PK. But just to be > sure, I ran What are you using for a PK class? If it is a custom class(not Integer, Long, etc...) could you post it? Or is it too complicated? > SQL Trace and I can confirm that the primary key created for the record is > indeed unique. The JDBC driver, however, issued a rollback so > the row never The rollback happened because of "INSERTING AN ALREADY EXISTING BEAN..." correct? Not something else. > gets inserted. Subsequent manual INSERTs into the table in question skip > the database primary key for the rolled-back entry (ie, the next > rows start > with 107 instead of 106) so I assume the insert would have gone through if > the EJB container hadn't rolled back the create. > > 5) check if the creates are inside one transaction. The creates are > called from a client, not a session bean, and I let JBoss handle the > transactions (the create is declared as Required in ejb.xml). Should I > explicitly handle the transaction instead? > No, don't explicity handle the transaction. Everything should work! This exception should not be happening and it is very very bad. > I'm going to fiddle around with the cache some more and see if that > fixes things. Again, thanks for helping me out (read: please don't stop). > Happy to help. This stuff is fundamental and should really be fullproof. There were a lot of holes patched up in 2.4 Beta in regards to passivation and Entity and cache synchronization. In the mainline(2.5), a lot of it was even re-written. If you feel up to it, could you try this on 2.4 Beta or 2.5? We're actually in production with a self-modified JBoss 2.2.2. The modifications we made were the holes I just talked about above with passivation and Entity/cache synchronizations. I've actually seen the "INSERTING AN ALREADY EXISTING BEAN..." exception when doing a lot of Entity removes and creates with Commit option "C". These problems were fixed by the patches in 2.4. Let me know. I really want this to be fixed. Regards, Bill ___ JBoss-user mailing list [EMAIL PROTECTED] http://lists.sourceforge.net/lists/listinfo/jboss-user
RE: [JBoss-user] INSERTING AN ALREADY EXISTING BEAN..... problem
The creates are called from a client, not a session bean, and I let JBoss handle the transactions (the create is declared as Required in ejb.xml). Should I explicitly handle the transaction instead? I'm going to fiddle around with the cache some more and see if that fixes things. Again, thanks for helping me out (read: please don't stop). --- Michael R. Maraya > -- > From: Bill Burke[SMTP:[EMAIL PROTECTED]] > Sent: Wednesday, July 11, 2001 10:34 AM > To: [EMAIL PROTECTED] > Cc: [EMAIL PROTECTED] > Subject: RE: [JBoss-user] INSERTING AN ALREADY EXISTING BEAN. > problem > > Michael, > > In your jboss conf directory where your jboss.jcml file is in, i.e. > .../jboss/conf/default edit standardjboss.xml > > Search for Standard BMP EntityBean. > > Under that selection set to 0. Also make sure that the > is much over 106. If you want to know what that is, go > check > it out in the docs. Basically I'm trying to figure out if the cache size > has anything to do with this problem. > > Can you send me the loop that creates the beans? Can you reproduce this > in > a simpler example so I can run and test this on my machine? Are you > positively sure that you're not trying to create a bean with the same > primary key? Are you doing all these creates inside 1 transaction(i.e. > Inside a Statefull/less session bean method?) > > I need more info. > > Bill > > ___ JBoss-user mailing list [EMAIL PROTECTED] http://lists.sourceforge.net/lists/listinfo/jboss-user
RE: [JBoss-user] INSERTING AN ALREADY EXISTING BEAN..... problem
Michael, In your jboss conf directory where your jboss.jcml file is in, i.e. .../jboss/conf/default edit standardjboss.xml Search for Standard BMP EntityBean. Under that selection set to 0. Also make sure that the is much over 106. If you want to know what that is, go check it out in the docs. Basically I'm trying to figure out if the cache size has anything to do with this problem. Can you send me the loop that creates the beans? Can you reproduce this in a simpler example so I can run and test this on my machine? Are you positively sure that you're not trying to create a bean with the same primary key? Are you doing all these creates inside 1 transaction(i.e. Inside a Statefull/less session bean method?) I need more info. Bill > -Original Message- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED]]On Behalf Of Maraya > Michael > Sent: Tuesday, July 10, 2001 6:13 PM > To: '[EMAIL PROTECTED]' > Subject: RE: [JBoss-user] INSERTING AN ALREADY EXISTING BEAN. > problem > > > > Thanks for replying, Bill. > > I'm using JBoss 2.2.2 and the Entity Bean is configured as a > "Standard BMP EntityBean" (see jboss.xml below) -- I don't know which > commit-option that is resolved as. I guess as a last resort, I can use a > custom configuration but I'd like to make this work if I can. > > No other actions are performed during the creates, it's just one > long series (1242 to be exact) of create calls inside a ResultSet > loop. And > the funny thing is, it always fails at 106 (I've sorted the input data in > the hopes that it's bad data but I still get the problem). > > > > > jdbc/Emps > java:/Common > > > > > Account > emps/account > Standard BMP EntityBean > > jdbc/Emps > jdbc/Emps > > > > > > --- > Michael R. Maraya > > > ------ > > From: Bill Burke[SMTP:[EMAIL PROTECTED]] > > Reply To: [EMAIL PROTECTED] > > Sent: Tuesday, July 10, 2001 5:42 PM > > To: [EMAIL PROTECTED] > > Subject:RE: [JBoss-user] INSERTING AN ALREADY EXISTING BEAN. > > problem > > > > Michael, > > > > What version of JBoss are you running? 2.2.x, 2.4Beta, or 2.5 mainline? > > What commit Option? A, B, or C? > > > > Also what kind of things are you doing(get/sets, creates, removes)? And > > are > > you doing them in one transaction? You definately have a > corrupted cache > > here and I need more information before I can help. The stack > trace below > > is only an effect, not a cause. Are you doing the same sort of thing in > > the > > message you posted? > > > > Regards, > > Bill > > > > > > ___ > JBoss-user mailing list > [EMAIL PROTECTED] > http://lists.sourceforge.net/lists/listinfo/jboss-user > ___ JBoss-user mailing list [EMAIL PROTECTED] http://lists.sourceforge.net/lists/listinfo/jboss-user
RE: [JBoss-user] INSERTING AN ALREADY EXISTING BEAN..... problem
Thanks for replying, Bill. I'm using JBoss 2.2.2 and the Entity Bean is configured as a "Standard BMP EntityBean" (see jboss.xml below) -- I don't know which commit-option that is resolved as. I guess as a last resort, I can use a custom configuration but I'd like to make this work if I can. No other actions are performed during the creates, it's just one long series (1242 to be exact) of create calls inside a ResultSet loop. And the funny thing is, it always fails at 106 (I've sorted the input data in the hopes that it's bad data but I still get the problem). jdbc/Emps java:/Common Account emps/account Standard BMP EntityBean jdbc/Emps jdbc/Emps --- Michael R. Maraya > -- > From: Bill Burke[SMTP:[EMAIL PROTECTED]] > Reply To: [EMAIL PROTECTED] > Sent: Tuesday, July 10, 2001 5:42 PM > To: [EMAIL PROTECTED] > Subject: RE: [JBoss-user] INSERTING AN ALREADY EXISTING BEAN. > problem > > Michael, > > What version of JBoss are you running? 2.2.x, 2.4Beta, or 2.5 mainline? > What commit Option? A, B, or C? > > Also what kind of things are you doing(get/sets, creates, removes)? And > are > you doing them in one transaction? You definately have a corrupted cache > here and I need more information before I can help. The stack trace below > is only an effect, not a cause. Are you doing the same sort of thing in > the > message you posted? > > Regards, > Bill > > ___ JBoss-user mailing list [EMAIL PROTECTED] http://lists.sourceforge.net/lists/listinfo/jboss-user
RE: [JBoss-user] INSERTING AN ALREADY EXISTING BEAN..... problem
Michael, What version of JBoss are you running? 2.2.x, 2.4Beta, or 2.5 mainline? What commit Option? A, B, or C? Also what kind of things are you doing(get/sets, creates, removes)? And are you doing them in one transaction? You definately have a corrupted cache here and I need more information before I can help. The stack trace below is only an effect, not a cause. Are you doing the same sort of thing in the message you posted? Regards, Bill > -Original Message- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED]]On Behalf Of Maraya > Michael > Sent: Tuesday, July 10, 2001 5:18 PM > To: '[EMAIL PROTECTED]' > Subject: [JBoss-user] INSERTING AN ALREADY EXISTING BEAN. problem > > > > I'm developing an application that takes data from our legacy system > and loads that data into the new system using Entity EJBs but > when it starts > to load a certain amount of records from our Accounts table, I get an > IllegalStateException from AbstractInstanceCache.insert(). I believe this > is similar to the problem in a previous post where consecutive inserts > produce the ISE but adding pauses between inserts makes the > problem go away. > > I've tested my code against the RI from Sun and it works fine there. > > I've researched this problem (last message regarding this thread can > be found here > http://www.mail-archive.com/jboss-user@lists.sourceforge.net/msg04 > 395.html) > but I still can't fix it. I've tried modifying > BMPPersistenceManager.createEntity() by wrapping the cache > insertion section > with a synchronized clause against the > AbstractInstanceCache.getCacheLock() > return object (comments in AbstractInstanceCache seem to indicate > that this > should be done) but that hasn't fixed it. > > Does anyone know where I should look to fix it? Is someone else > already working on this? If not, does anyone have a sequence diagram for > ejbCreate()? > > Here's my stack trace: > > [Account] TRANSACTION ROLLBACK EXCEPTION:null; nested exception is: > javax.ejb.EJBException > [Account] java.lang.IllegalStateException: INSERTING AN ALREADY EXISTING > BEAN, ID = 106 > [Account] at > org.jboss.ejb.plugins.AbstractInstanceCache.insert(AbstractInstanc > eCache.jav > a:207) > [Account] at > org.jboss.ejb.plugins.BMPPersistenceManager.createEntity(BMPPersis > tenceManag > er.java:165) > [Account] at > org.jboss.ejb.EntityContainer.createHome(EntityContainer.java:441) > [Account] at java.lang.reflect.Method.invoke(Native Method) > [Account] at > org.jboss.ejb.EntityContainer$ContainerInterceptor.invokeHome(Enti > tyContaine > r.java:639) > [Account] at > org.jboss.ejb.plugins.EntitySynchronizationInterceptor.invokeHome( > EntitySync > hronizationInterceptor.java:160) > [Account] at > org.jboss.ejb.plugins.EntityInstanceInterceptor.invokeHome(EntityI > nstanceInt > erceptor.java:87) > [Account] at > org.jboss.ejb.plugins.TxInterceptorCMT.invokeNext(TxInterceptorCMT > .java:135) > [Account] at > org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInter > ceptorCMT. > java:263) > [Account] at > org.jboss.ejb.plugins.TxInterceptorCMT.invokeHome(TxInterceptorCMT > .java:86) > [Account] at > org.jboss.ejb.plugins.SecurityInterceptor.invokeHome(SecurityInter > ceptor.jav > a:164) > [Account] at > org.jboss.ejb.plugins.LogInterceptor.invokeHome(LogInterceptor.java:106) > [Account] at > org.jboss.ejb.EntityContainer.invokeHome(EntityContainer.java:316) > [Account] at > org.jboss.ejb.plugins.jrmp.server.JRMPContainerInvoker.invokeHome( > JRMPContai > nerInvoker.java:369) > [Account] at java.lang.reflect.Method.invoke(Native Method) > [Account] at > sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:241) > [Account] at sun.rmi.transport.Transport$1.run(Transport.java:152) > [Account] at java.security.AccessController.doPrivileged(Native > Method) > [Account] at > sun.rmi.transport.Transport.serviceCall(Transport.java:148) > [Account] at > sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:465) > [Account] at > sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransp > ort.java:7 > 06) > [Account] at java.lang.Thread.run(Thread.java:484) > > > --- > Michael R. Maraya > DOL / OCFO / OFS / DFAD > (202) 693-6928 > > ___ > JBoss-user mailing list > [EMAIL PROTECTED] > http://lists.sourceforge.net/lists/listinfo/jboss-user > ___ JBoss-user mailing list [EMAIL PROTECTED] http://lists.sourceforge.net/lists/listinfo/jboss-user
RE: [JBoss-user] INSERTING AN ALREADY EXISTING BEAN..... problem
Hey Martin > Hi, > > I recently upgraded from JBoss 2.0 Final to Jboss 2.2.1. > Everything works as > expected but now I get a IllegalStateException when creating > entity beans. > If I wait some minutes after creation and try to create the next bean > everything works. I searched the mailing list and found some > other postings > regarding this issue, but I found no solution. As I have > understood there is > a bug in JBoss` caching Not that I know ;) Are you sure you return the correct pk from ejbCreate ? The problem you have happens for example if ejbCreate always returns the same pk, maybe a typo or a forgot-to-modify cut'n'paste ? HTH, Simon > > Are there any solutions now to solve this prob? > > I´m running JBoss 2.2.1/Tomcat on Linux (SUN JDK 1.3) > -- > -- > > > > [BasketItemApp] TRANSACTION ROLLBACK EXCEPTION:null; nested > exception is: > javax.ejb.EJBException > [BasketItemApp] java.lang.IllegalStateException: INSERTING AN ALREADY > EXISTING BEAN, ID = de.lilienthal.ET.ejb.entity.BasketItemPK@19317757 > [BasketItemApp] at > org.jboss.ejb.plugins.AbstractInstanceCache.insert(AbstractIns > tanceCache.jav > a:207) > [BasketItemApp] at > org.jboss.ejb.plugins.BMPPersistenceManager.createEntity(BMPPe > rsistenceManag > er.java:165) > [BasketItemApp] at > org.jboss.ejb.EntityContainer.createHome(EntityContainer.java:441) > [BasketItemApp] at > java.lang.reflect.Method.invoke(Native Method) > [BasketItemApp] at > org.jboss.ejb.EntityContainer$ContainerInterceptor.invokeHome( > EntityContaine > r.java:639) > [BasketItemApp] at > org.jboss.ejb.plugins.EntitySynchronizationInterceptor.invokeH > ome(EntitySync > hronizationInterceptor.java:160) > [BasketItemApp] at > org.jboss.ejb.plugins.EntityInstanceInterceptor.invokeHome(Ent > ityInstanceInt > erceptor.java:87) > [BasketItemApp] at > org.jboss.ejb.plugins.TxInterceptorCMT.invokeNext(TxIntercepto > rCMT.java:135) > [BasketItemApp] at > org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxI > nterceptorCMT. > java:263) > [BasketItemApp] at > org.jboss.ejb.plugins.TxInterceptorCMT.invokeHome(TxIntercepto > rCMT.java:86) > [BasketItemApp] at > org.jboss.ejb.plugins.SecurityInterceptor.invokeHome(SecurityI > nterceptor.jav > a:164) > [BasketItemApp] at > org.jboss.ejb.plugins.LogInterceptor.invokeHome(LogInterceptor > .java:106) > [BasketItemApp] at > org.jboss.ejb.EntityContainer.invokeHome(EntityContainer.java:316) > [BasketItemApp] at > org.jboss.ejb.plugins.jrmp.server.JRMPContainerInvoker.invokeH > ome(JRMPContai > nerInvoker.java:436) > [BasketItemApp] at > org.jboss.ejb.plugins.jrmp.interfaces.HomeProxy.invoke(HomePro > xy.java:212) > [BasketItemApp] at $Proxy27.create(Unknown Source) > > > > > regards, > > > Martin > > > ___ > JBoss-user mailing list > [EMAIL PROTECTED] > http://lists.sourceforge.net/lists/listinfo/jboss-user > ___ JBoss-user mailing list [EMAIL PROTECTED] http://lists.sourceforge.net/lists/listinfo/jboss-user
RE: [JBoss-user] INSERTING AN ALREADY EXISTING BEAN..... problem
Ulp ! > yes, the problem exists and no, iv'e no fix on it yet. What is exactly the problem ? I probably missed it... Do you have a simple test that fails ? Simon > I said for some weeks ago that i would take on it but there > hasn't been any time for it yet :-( > > /Lennart > > > ___ > JBoss-user mailing list > [EMAIL PROTECTED] > http://lists.sourceforge.net/lists/listinfo/jboss-user > ___ JBoss-user mailing list [EMAIL PROTECTED] http://lists.sourceforge.net/lists/listinfo/jboss-user